[CRIU] [PATCH] build: Bring install back to life
Cyrill Gorcunov
gorcunov at openvz.org
Thu Feb 18 06:13:17 PST 2016
Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
---
Makefile.install | 65 ++++++++++++++++++++++++++++++++-------------------
criu/Makefile | 11 ++++++++-
lib/Makefile | 18 ++++++++++++++
scripts/crit-setup.py | 3 +--
4 files changed, 70 insertions(+), 27 deletions(-)
diff --git a/Makefile.install b/Makefile.install
index dfb65452d6ce..6fcf25e25562 100644
--- a/Makefile.install
+++ b/Makefile.install
@@ -1,31 +1,48 @@
-install: install-criu install-man
+#
+# Installation paths.
+DESTDIR ?=
+PREFIX ?= /usr/local
+SBINDIR ?= $(PREFIX)/sbin
+MANDIR ?= $(PREFIX)/share/man
+SYSTEMDUNITDIR ?= $(PREFIX)/lib/systemd/system/
+LOGROTATEDIR ?= $(PREFIX)/etc/logrotate.d/
+LIBDIR ?= $(PREFIX)/lib
+INCLUDEDIR ?= $(PREFIX)/include/criu
-install-criu: all $(CRIU-LIB) install-crit
- $(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)/$(CRIU-SO).so.$(VERSION_SO_MAJOR).$(VERSION_SO_MINOR)
- $(Q) ln -fns $(CRIU-SO).so.$(VERSION_SO_MAJOR).$(VERSION_SO_MINOR) \
- $(DESTDIR)$(LIBDIR)/$(CRIU-SO).so.$(VERSION_SO_MAJOR)
- $(Q) ln -fns $(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)
+#
+# 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)
+else
+ #
+ # For most other systems
+ ifeq "$(shell uname -m)" "x86_64"
+ LIBDIR ?= $(PREFIX)/lib64
+ endif
+endif
+
+export SBINDIR MANDIR SYSTEMDUNITDIR LOGROTATEDIR
+export INCLUDEDIR LIBDIR DESTDIR PREFIX
+
+install-tree:
$(Q) mkdir -p $(DESTDIR)$(SYSTEMDUNITDIR)
- $(Q) sed -e 's, at version@,$(CRTOOLSVERSION),' \
- -e 's, at libdir@,$(LIBDIR),' \
- -e 's, at includedir@,$(dir $(INCLUDEDIR)),' \
- lib/criu.pc.in > lib/c/criu.pc
- $(Q) mkdir -p $(DESTDIR)$(LIBDIR)/pkgconfig
- $(Q) install -m 644 lib/c/criu.pc $(DESTDIR)$(LIBDIR)/pkgconfig
+ $(Q) mkdir -p $(DESTDIR)$(LOGROTATEDIR)
+ $(Q) mkdir -p $(DESTDIR)$(INCLUDEDIR)
+.PHONY: install-tree
install-man:
$(Q) $(MAKE) -C Documentation install
+.PHONY: install-man
+
+install-lib: lib
+ $(Q) $(MAKE) -C lib install
+.PHONY: install-lib
-install-crit: crit/crit
- $(E) " INSTALL crit"
- $(Q) python scripts/crit-setup.py install --root=$(DESTDIR) --prefix=$(PREFIX)
+install-criu: criu
+ $(Q) $(MAKE) -C criu install
+.PHONY: install-criu
-.PHONY: install install-man install-crit install-criu
+install: install-man install-lib install-criu
+ @true
+.PHONY: install
diff --git a/criu/Makefile b/criu/Makefile
index c639b1115b1c..cc35f3771f88 100644
--- a/criu/Makefile
+++ b/criu/Makefile
@@ -155,9 +155,18 @@ clean:
$(Q) $(RM) $(CONFIG_HEADER)
$(Q) $(RM) criu
+UAPI_HEADERS := include/criu-plugin.h include/criu-log.h
+
+install: criu
+ $(E) " INSTALL " criu
+ $(Q) mkdir -p $(DESTDIR)$(SBINDIR)
+ $(Q) install -m 755 criu $(DESTDIR)$(SBINDIR)
+ $(Q) mkdir -p $(DESTDIR)$(INCLUDEDIR)
+ $(Q) install -m 644 $(UAPI_HEADERS) $(DESTDIR)$(INCLUDEDIR)
+
#
# Final @all target.
all: $(PHONY)
@true
-.PHONY: $(PHONY) clean
+.PHONY: $(PHONY) clean install
diff --git a/lib/Makefile b/lib/Makefile
index 34dd3b8e46b6..df2907eded31 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -2,6 +2,7 @@ include $(__nmk_dir)/include.mk
include $(__nmk_dir)/macro.mk
CRIU_SO := libcriu.so
+UAPI_HEADERS := c/criu.h ../images/rpc.proto
#
# C language bindings.
@@ -28,6 +29,7 @@ clean:
$(call msg-clean, lib-c)
$(Q) $(MAKE) $(build)=c $@
$(Q) $(RM) c/$(CRIU_SO)
+ $(Q) $(RM) c/criu.pc
$(call msg-clean, lib-py)
$(Q) $(MAKE) -C pycriu/images $@
@@ -35,4 +37,20 @@ all: $(PHONY)
@true
PHONY += all
+install: lib-c lib-py ../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)
+ $(Q) ln -fns $(CRIU_SO).$(CRIU_SO_VERSION_MAJOR).$(CRIU_SO_VERSION_MINOR) $(DESTDIR)$(LIBDIR)/$(CRIU_SO).$(CRIU_SO_VERSION_MAJOR)
+ $(Q) ln -fns $(CRIU_SO).$(CRIU_SO_VERSION_MAJOR).$(CRIU_SO_VERSION_MINOR) $(DESTDIR)$(LIBDIR)/$(CRIU_SO)
+ $(Q) mkdir -p $(DESTDIR)$(INCLUDEDIR)
+ $(Q) install -m 644 $(UAPI_HEADERS) $(DESTDIR)$(INCLUDEDIR)
+ $(E) " INSTALL " pkgconfig/criu.pc
+ $(Q) mkdir -p $(DESTDIR)$(LIBDIR)/pkgconfig
+ $(Q) sed -e 's, at version@,$(CRIU_VERSION),' -e 's, at libdir@,$(LIBDIR),' -e 's, at 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
diff --git a/scripts/crit-setup.py b/scripts/crit-setup.py
index fbdc66518e40..38a71c33aa13 100644
--- a/scripts/crit-setup.py
+++ b/scripts/crit-setup.py
@@ -6,7 +6,6 @@ setup(name = "crit",
author = "CRIU team",
author_email = "criu at openvz.org",
url = "https://github.com/xemul/criu",
- package_dir = {'': "lib"},
packages = ["pycriu", "pycriu.images"],
- scripts = ["crit/crit"]
+ scripts = ["../crit/crit"]
)
--
2.5.0
More information about the CRIU
mailing list