sys-process/criu: Add python useflag and fix build with LDFLAGS not matching default.
authorAlexis Ballier <aballier@gentoo.org>
Tue, 15 Mar 2016 15:01:08 +0000 (16:01 +0100)
committerAlexis Ballier <aballier@gentoo.org>
Tue, 15 Mar 2016 15:12:55 +0000 (16:12 +0100)
Adapt makefile patch to use RAW_LDFLAGS for ld which we feed from ebuild.
Patch makefile to allow disabling python and make it optional with proper deps, bug #576716.

Package-Manager: portage-2.2.28
Signed-off-by: Alexis Ballier <aballier@gentoo.org>
sys-process/criu/criu-2.0.ebuild
sys-process/criu/files/2.0/criu-2.0-makefile.patch

index 90689a6ec8643fdd5df1f889bca6d5c46599241a..2d4b80a1c1d17b3614faa359f0dfeface9889d43 100644 (file)
@@ -4,7 +4,9 @@
 
 EAPI=5
 
-inherit eutils toolchain-funcs linux-info flag-o-matic
+PYTHON_COMPAT=( python2_7 )
+
+inherit eutils toolchain-funcs linux-info flag-o-matic python-r1 python-utils-r1
 
 DESCRIPTION="utility to checkpoint/restore a process tree"
 HOMEPAGE="http://criu.org/"
@@ -13,13 +15,19 @@ SRC_URI="http://download.openvz.org/criu/${P}.tar.bz2"
 LICENSE="GPL-2"
 SLOT="0"
 KEYWORDS="~amd64 ~arm ~arm64"
-IUSE="setproctitle"
+IUSE="python setproctitle"
 
 RDEPEND="dev-libs/protobuf-c
+       python? ( ${PYTHON_DEPS} )
        setproctitle? ( dev-libs/libbsd )"
 DEPEND="${RDEPEND}
        app-text/asciidoc
        app-text/xmlto"
+RDEPEND="${RDEPEND}
+       python? (
+               dev-libs/protobuf[python,${PYTHON_USEDEP}]
+               dev-python/ipaddr[${PYTHON_USEDEP}]
+       )"
 
 CONFIG_CHECK="~CHECKPOINT_RESTORE ~NAMESPACES ~PID_NS ~FHANDLE ~EVENTFD ~EPOLL ~INOTIFY_USER
        ~IA32_EMULATION ~UNIX_DIAG ~INET_DIAG ~INET_UDP_DIAG ~PACKET_DIAG ~NETLINK_DIAG"
@@ -42,13 +50,14 @@ criu_arch() {
 }
 
 src_compile() {
-       emake \
+       RAW_LDFLAGS="$(raw-ldflags)" emake \
                CC="$(tc-getCC)" \
                LD="$(tc-getLD)" \
                OBJCOPY="$(tc-getOBJCOPY)" \
                ARCH="$(criu_arch)" \
                V=1 WERROR=0 DEBUG=0 \
                SETPROCTITLE=$(usex setproctitle) \
+               PYCRIU=$(usex python) \
                all docs
 }
 
@@ -59,6 +68,10 @@ src_test() {
        fi
 }
 
+install_crit() {
+       "${PYTHON:-python}" ../scripts/crit-setup.py install --root=${D} --prefix="${EPREFIX}/usr/"
+}
+
 src_install() {
        emake \
                ARCH="$(criu_arch)" \
@@ -68,4 +81,9 @@ src_install() {
                install
 
        dodoc CREDITS README.md
+
+       if use python ; then
+               cd lib
+               python_foreach_impl install_crit
+       fi
 }
index 4c7d67fcf002d435be58c892b1f00badd3137221..b9c9cb4d83b31bab8a603e88ab8202c9d690c3cd 100644 (file)
@@ -1,7 +1,7 @@
-diff --git a/Makefile.install b/Makefile.install
-index 6fcf25e..0d12ff9 100644
---- a/Makefile.install
-+++ b/Makefile.install
+Index: criu-2.0/Makefile.install
+===================================================================
+--- criu-2.0.orig/Makefile.install
++++ criu-2.0/Makefile.install
 @@ -5,13 +5,12 @@ PREFIX               ?= /usr/local
  SBINDIR               ?= $(PREFIX)/sbin
  MANDIR                ?= $(PREFIX)/share/man
@@ -18,17 +18,51 @@ index 6fcf25e..0d12ff9 100644
  ifneq "$(DEB_HOST_MULTIARCH)" ""
          LIBDIR                        ?= $(PREFIX)/lib/$(DEB_HOST_MULTIARCH)
  else
-diff --git a/scripts/nmk/scripts/build.mk b/scripts/nmk/scripts/build.mk
-index 10a5d44..6b20569 100644
---- a/scripts/nmk/scripts/build.mk
-+++ b/scripts/nmk/scripts/build.mk
-@@ -43,7 +43,9 @@ builtin-name := $(strip $(builtin-name))
+Index: criu-2.0/scripts/nmk/scripts/build.mk
+===================================================================
+--- criu-2.0.orig/scripts/nmk/scripts/build.mk
++++ criu-2.0/scripts/nmk/scripts/build.mk
+@@ -43,7 +43,7 @@ builtin-name := $(strip $(builtin-name))
  
  #
  # Link flags.
-+ld_filter_flags = -Wl,-O1 -Wl,--as-needed
- ld_flags      := $(strip $(LDFLAGS) $(ldflags-y))
-+ld_flags      := $(filter-out $(ld_filter_flags),$(ld_flags))
+-ld_flags      := $(strip $(LDFLAGS) $(ldflags-y))
++ld_flags      := $(strip $(RAW_LDFLAGS) $(ldflags-y))
  
  #
  # Prepare targets.
+Index: criu-2.0/lib/Makefile
+===================================================================
+--- criu-2.0.orig/lib/Makefile
++++ criu-2.0/lib/Makefile
+@@ -20,10 +20,12 @@ PHONY += lib-c
+ 
+ #
+ # Python bindings.
++ifeq ($(PYCRIU),yes)
+ lib-py:
+       $(call msg-gen, $@)
+       $(Q) $(MAKE) -C py all
+ PHONY += lib-py
++endif
+ 
+ clean:
+       $(call msg-clean, lib-c)
+@@ -37,7 +39,7 @@ all: $(PHONY)
+       @true
+ PHONY += all
+ 
+-install: lib-c lib-py ../crit/crit c/criu.pc.in
++install: lib-c ../crit/crit c/criu.pc.in
+       $(E) "  INSTALL " $(CRIU_SO)
+       $(Q) mkdir -p $(DESTDIR)$(LIBDIR)
+       $(Q) install -m 755 c/$(CRIU_SO) $(DESTDIR)$(LIBDIR)/$(CRIU_SO).$(CRIU_SO_VERSION_MAJOR).$(CRIU_SO_VERSION_MINOR)
+@@ -49,8 +51,6 @@ install: lib-c lib-py ../crit/crit c/cri
+       $(Q) mkdir -p $(DESTDIR)$(LIBDIR)/pkgconfig
+       $(Q) sed -e 's,@version@,$(CRIU_VERSION),' -e 's,@libdir@,$(LIBDIR),' -e 's,@includedir@,$(dir $(INCLUDEDIR)),' c/criu.pc.in > c/criu.pc
+       $(Q) install -m 644 c/criu.pc $(DESTDIR)$(LIBDIR)/pkgconfig
+-      $(E) "  INSTALL " crit
+-      $(Q) python ../scripts/crit-setup.py install --root=$(DESTDIR) --prefix=$(PREFIX)
+ .PHONY: install
+ 
+ .PHONY: $(PHONY) clean