Create -devel subpackage

This commit is contained in:
Adrian Reber 2014-02-07 16:22:00 +01:00
parent 242347c219
commit aa89a15c6b
5 changed files with 260 additions and 2 deletions

View File

@ -0,0 +1,49 @@
From fd02dcdc7a0faaf972f6c9e8eda3f44b24dda337 Mon Sep 17 00:00:00 2001
From: Adrian Reber <adrian@lisas.de>
Date: Fri, 7 Feb 2014 16:11:50 +0100
Subject: [PATCH] Makefile: fix libcriu.so links and man page installation
The links to the versioned libcriu.so.* included $(DESTDIR) and
$(LIBDIR) which will generate wrong links if building criu packages.
Now the links points to the correct file without any path.
For some reason criu.8 was installed with executable permission. Use
'install' with '-m 644' to make sure this does not happen.
Signed-off-by: Adrian Reber <adrian@lisas.de>
---
Documentation/Makefile | 2 +-
Makefile | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/Documentation/Makefile b/Documentation/Makefile
index 50e4526..e236635 100644
--- a/Documentation/Makefile
+++ b/Documentation/Makefile
@@ -46,6 +46,6 @@ clean:
install: $(MANS)
$(E) " INSTALL " $(MANS)
$(Q) mkdir -p $(DESTDIR)$(MAN8DIR)
- $(Q) install $(MANS) $(DESTDIR)$(MAN8DIR)
+ $(Q) install -m 644 $(MANS) $(DESTDIR)$(MAN8DIR)
.PHONY: clean install
diff --git a/Makefile b/Makefile
index 9ed45bd..a4d560a 100644
--- a/Makefile
+++ b/Makefile
@@ -241,9 +241,9 @@ install: $(PROGRAM) install-man
$(Q) mkdir -p $(DESTDIR)$(LIBDIR)
$(Q) install -m 755 $(CRIU-LIB) \
$(DESTDIR)$(LIBDIR)/$(CRIU-SO).so.$(VERSION_SO_MAJOR).$(VERSION_SO_MINOR)
- $(Q) ln -s $(DESTDIR)$(LIBDIR)/$(CRIU-SO).so.$(VERSION_SO_MAJOR).$(VERSION_SO_MINOR) \
+ $(Q) ln -s $(CRIU-SO).so.$(VERSION_SO_MAJOR).$(VERSION_SO_MINOR) \
$(DESTDIR)$(LIBDIR)/$(CRIU-SO).so.$(VERSION_SO_MAJOR)
- $(Q) ln -s $(DESTDIR)$(LIBDIR)/$(CRIU-SO).so.$(VERSION_SO_MAJOR).$(VERSION_SO_MINOR) \
+ $(Q) ln -s $(CRIU-SO).so.$(VERSION_SO_MAJOR).$(VERSION_SO_MINOR) \
$(DESTDIR)$(LIBDIR)/$(CRIU-SO).so
$(Q) mkdir -p $(DESTDIR)$(INCLUDEDIR)
$(Q) install -m 644 $(CRIU-INC) $(DESTDIR)$(INCLUDEDIR)
--
1.8.5.3

View File

@ -0,0 +1,54 @@
From 48b22f0d9578561660ae67c0cfdd66040362c9cf Mon Sep 17 00:00:00 2001
From: Adrian Reber <adrian@lisas.de>
Date: Wed, 5 Feb 2014 01:05:00 +0400
Subject: [PATCH] Makefile: Also install libcriu.so and headers
To link Open MPI against CRIU I need the header files installed.
Attached is a patch which adds the necessary Makefile rules to
install libcriu.so and the header file to compile against CRIU.
Signed-off-by: Adrian Reber <adrian@lisas.de>
Acked-by: Kir Kolyshkin <kir@openvz.org>
Acked-by: Andrew Vagin <avagin@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
---
Makefile | 5 +++++
Makefile.inc | 2 ++
2 files changed, 7 insertions(+), 0 deletions(-)
diff --git a/Makefile b/Makefile
index f8ee59a..985b8c9 100644
--- a/Makefile
+++ b/Makefile
@@ -104,6 +104,7 @@ CFLAGS += $(WARNINGS) $(DEFINES)
SYSCALL-LIB := arch/$(ARCH)/syscalls.built-in.o
ARCH-LIB := arch/$(ARCH)/crtools.built-in.o
CRIU-LIB := lib/libcriu.so
+CRIU-INC := lib/criu.h include/criu-plugin.h include/criu-log.h protobuf/rpc.proto
export CC MAKE CFLAGS LIBS ARCH DEFINES MAKEFLAGS
export SRC_DIR SYSCALL-LIB SH RM ARCH_DIR OBJCOPY LDARCH LD
@@ -233,6 +234,10 @@ install: $(PROGRAM) install-man
$(E) " INSTALL " $(PROGRAM)
$(Q) mkdir -p $(DESTDIR)$(SBINDIR)
$(Q) install -m 755 $(PROGRAM) $(DESTDIR)$(SBINDIR)
+ $(Q) mkdir -p $(DESTDIR)$(LIBDIR)
+ $(Q) install -m 755 $(CRIU-LIB) $(DESTDIR)$(LIBDIR)
+ $(Q) mkdir -p $(DESTDIR)$(INCLUDEDIR)
+ $(Q) install -m 644 $(CRIU-INC) $(DESTDIR)$(INCLUDEDIR)
$(Q) mkdir -p $(DESTDIR)$(SYSTEMDUNITDIR)
$(Q) install -m 644 scripts/sd/criu.socket $(DESTDIR)$(SYSTEMDUNITDIR)
$(Q) install -m 644 scripts/sd/criu.service $(DESTDIR)$(SYSTEMDUNITDIR)
diff --git a/Makefile.inc b/Makefile.inc
index 87a267a..032a99a 100644
--- a/Makefile.inc
+++ b/Makefile.inc
@@ -15,3 +15,5 @@ PREFIX := /usr/local
SBINDIR := $(PREFIX)/sbin
MANDIR := $(PREFIX)/share/man
SYSTEMDUNITDIR := $(PREFIX)/lib/systemd/system/
+LIBDIR := $(PREFIX)/lib
+INCLUDEDIR := $(PREFIX)/include/criu
--
1.7.1

View File

@ -0,0 +1,84 @@
From b0e6ebc1c7a529dfc3073c26f2a18733a1088458 Mon Sep 17 00:00:00 2001
From: Adrian Reber <adrian@lisas.de>
Date: Wed, 5 Feb 2014 18:28:00 +0400
Subject: [PATCH] Makefile: add soname to libcriu.so
Using a soname makes it easy for applications to
detect if the ABI of libcriu.so has changed.
It still creates libcriu.so as before in lib. During
'make install' additional links are created:
libcriu.so -> libcriu.so.1.0
libcriu.so.1 -> libcriu.so.1.0
Signed-off-by: Adrian Reber <adrian@lisas.de>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
---
Makefile | 15 ++++++++++++---
lib/Makefile | 4 ++--
2 files changed, 14 insertions(+), 5 deletions(-)
diff --git a/Makefile b/Makefile
index 985b8c9..9ed45bd 100644
--- a/Makefile
+++ b/Makefile
@@ -3,8 +3,11 @@ VERSION_MINOR := 1
VERSION_SUBLEVEL :=
VERSION_EXTRA :=
VERSION_NAME :=
+VERSION_SO_MAJOR := 1
+VERSION_SO_MINOR := 0
export VERSION_MAJOR VERSION_MINOR VERSION_SUBLEVEL VERSION_EXTRA VERSION_NAME
+export VERSION_SO_MAJOR VERSION_SO_MINOR
#
# FIXME zdtm building procedure requires implicit rules
@@ -103,10 +106,11 @@ endif
CFLAGS += $(WARNINGS) $(DEFINES)
SYSCALL-LIB := arch/$(ARCH)/syscalls.built-in.o
ARCH-LIB := arch/$(ARCH)/crtools.built-in.o
-CRIU-LIB := lib/libcriu.so
+CRIU-SO := libcriu
+CRIU-LIB := lib/$(CRIU-SO).so
CRIU-INC := lib/criu.h include/criu-plugin.h include/criu-log.h protobuf/rpc.proto
-export CC MAKE CFLAGS LIBS ARCH DEFINES MAKEFLAGS
+export CC MAKE CFLAGS LIBS ARCH DEFINES MAKEFLAGS CRIU-SO
export SRC_DIR SYSCALL-LIB SH RM ARCH_DIR OBJCOPY LDARCH LD
export cflags-y
@@ -235,7 +239,12 @@ install: $(PROGRAM) install-man
$(Q) mkdir -p $(DESTDIR)$(SBINDIR)
$(Q) install -m 755 $(PROGRAM) $(DESTDIR)$(SBINDIR)
$(Q) mkdir -p $(DESTDIR)$(LIBDIR)
- $(Q) install -m 755 $(CRIU-LIB) $(DESTDIR)$(LIBDIR)
+ $(Q) install -m 755 $(CRIU-LIB) \
+ $(DESTDIR)$(LIBDIR)/$(CRIU-SO).so.$(VERSION_SO_MAJOR).$(VERSION_SO_MINOR)
+ $(Q) ln -s $(DESTDIR)$(LIBDIR)/$(CRIU-SO).so.$(VERSION_SO_MAJOR).$(VERSION_SO_MINOR) \
+ $(DESTDIR)$(LIBDIR)/$(CRIU-SO).so.$(VERSION_SO_MAJOR)
+ $(Q) ln -s $(DESTDIR)$(LIBDIR)/$(CRIU-SO).so.$(VERSION_SO_MAJOR).$(VERSION_SO_MINOR) \
+ $(DESTDIR)$(LIBDIR)/$(CRIU-SO).so
$(Q) mkdir -p $(DESTDIR)$(INCLUDEDIR)
$(Q) install -m 644 $(CRIU-INC) $(DESTDIR)$(INCLUDEDIR)
$(Q) mkdir -p $(DESTDIR)$(SYSTEMDUNITDIR)
diff --git a/lib/Makefile b/lib/Makefile
index e9beace..aec6d84 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -1,10 +1,10 @@
-lib-so += libcriu
+lib-so += $(CRIU-SO)
obj-y += criu.o
obj-ext-src-y += protobuf/rpc.pb-c.o
includes += -iquote $(obj)/../arch/$(ARCH)/include -iquote $(obj)/../include -iquote $(obj)/.. -iquote $(obj)/../protobuf
cflags-y += $(includes) -fPIC -Wa,--noexecstack -fno-stack-protector
-cflags-so += -rdynamic
+cflags-so += -rdynamic -Wl,-soname,$(lib-so).so.$(VERSION_SO_MAJOR)
ldflags-so += -lprotobuf-c
.SECONDARY:
--
1.7.1

View File

@ -1,6 +1,6 @@
Name: criu
Version: 1.1
Release: 3%{?dist}
Release: 4%{?dist}
Provides: crtools = %{version}-%{release}
Obsoletes: crtools <= 1.0-2
Summary: Tool for Checkpoint/Restore in User-space
@ -9,6 +9,11 @@ License: GPLv2
URL: http://criu.org/
Source0: http://download.openvz.org/criu/criu-%{version}.tar.bz2
Patch0: ptrace_peeksiginfo_args.patch
Patch1: http://git.criu.org/?p=criu.git;a=patch;h=48b22f0d9578561660ae67c0cfdd66040362c9cf
Patch2: http://git.criu.org/?p=criu.git;a=patch;h=f5f9fb9c0007a613273064626b87ad62ad4b5923
Patch3: http://git.criu.org/?p=criu.git;a=patch;h=b0e6ebc1c7a529dfc3073c26f2a18733a1088458
Patch4: 0001-Makefile-fix-libcriu.so-links-and-man-page-installat.patch
BuildRequires: protobuf-c-devel asciidoc xmlto
@ -23,10 +28,24 @@ criu is the user-space part of Checkpoint/Restore in User-space
(CRIU), a project to implement checkpoint/restore functionality for
Linux in user-space.
%package devel
Summary: Header files and libraries for %{name}
Group: Development/Libraries
Requires: %{name} = %{version}-%{release}
%description devel
This package contains header files and libraries for %{name}.
%prep
%setup -q -n criu-%{version}
%if 0%{fedora} > 20
%patch0 -p1
%endif
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
%build
# %{?_smp_mflags} does not work
@ -36,20 +55,32 @@ make docs V=1
%install
make install DESTDIR=$RPM_BUILD_ROOT PREFIX=%{_prefix}
make install DESTDIR=$RPM_BUILD_ROOT PREFIX=%{_prefix} LIBDIR=%{_libdir}
# upstream renamed to binary to criu
ln -s %{_sbindir}/criu $RPM_BUILD_ROOT%{_sbindir}/crtools
%post -p /sbin/ldconfig
%postun -p /sbin/ldconfig
%files
%{_sbindir}/%{name}
%{_sbindir}/crtools
%{_mandir}/man8/*
%{_unitdir}/criu.service
%{_unitdir}/criu.socket
%{_libdir}/*.so.*
%doc README COPYING
%files devel
%{_includedir}/criu
%{_libdir}/*.so
%changelog
* Tue Feb 04 2014 Adrian Reber <adrian@lisas.de> - 1.1-4
- Create -devel subpackage
* Wed Dec 11 2013 Andrew Vagin <avagin@openvz.org> - 1.0-3
- Fix the epoch of crtools

View File

@ -0,0 +1,40 @@
From f5f9fb9c0007a613273064626b87ad62ad4b5923 Mon Sep 17 00:00:00 2001
From: Kir Kolyshkin <kir@openvz.org>
Date: Fri, 7 Feb 2014 15:31:34 +0400
Subject: [PATCH] make install: guess LIBDIR
For x86_64, LIBDIR can be tricky to find out. Nevertheless, this
works for at least RedHat/CentOS/Fedora, SLES/openSUSE, Debian/Ubuntu
and Gentoo. So, while it can guess LIBDIR wrong, this is still
a good approximation for those installing criu from source.
Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Acked-by: Cyrill Gorcunov <gorcunov@openvz.org>
Acked-by: Adrian Reber <adrian@lisas.de>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
---
Makefile.inc | 10 ++++++++++
1 files changed, 10 insertions(+), 0 deletions(-)
diff --git a/Makefile.inc b/Makefile.inc
index 032a99a..49cee8f 100644
--- a/Makefile.inc
+++ b/Makefile.inc
@@ -16,4 +16,14 @@ SBINDIR := $(PREFIX)/sbin
MANDIR := $(PREFIX)/share/man
SYSTEMDUNITDIR := $(PREFIX)/lib/systemd/system/
LIBDIR := $(PREFIX)/lib
+# For recent Debian/Ubuntu with multiarch support
+DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture \
+ -qDEB_HOST_MULTIARCH 2>/dev/null)
+ifneq "$(DEB_HOST_MULTIARCH)" ""
+LIBDIR := $(PREFIX)/lib/$(DEB_HOST_MULTIARCH)
+# For most other systems
+else ifeq "$(shell uname -m)" "x86_64"
+LIBDIR := $(PREFIX)/lib64
+endif
+
INCLUDEDIR := $(PREFIX)/include/criu
--
1.7.1