[CRIU] [PATCH 6/6] compel: Add installation

Cyrill Gorcunov gorcunov at openvz.org
Wed Nov 16 07:06:53 PST 2016


To ship plugins, libs and dev headers.

Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
---
 Makefile.compel         | 13 ++++++++++---
 Makefile.install        |  9 ++++++++-
 compel/Makefile         | 43 ++++++++++++++++++++++++++++++++++++++++++-
 compel/plugins/Makefile | 27 +++++++++++++++++++++++++++
 4 files changed, 87 insertions(+), 5 deletions(-)

diff --git a/Makefile.compel b/Makefile.compel
index 42d05bc412f0..d15b26763b9b 100644
--- a/Makefile.compel
+++ b/Makefile.compel
@@ -35,6 +35,10 @@ compel-deps		+= $(COMPEL_VERSION_HEADER)
 compel-deps		+= $(CONFIG_HEADER)
 compel-deps		+= include/common/asm
 
+LIBCOMPEL_SO		:= libcompel.so
+LIBCOMPEL_A		:= libcompel.a
+export LIBCOMPEL_SO LIBCOMPEL_A
+
 #
 # Compel itself.
 compel/%: $(compel-deps) compel/plugins/std.built-in.o .FORCE
@@ -58,14 +62,17 @@ compel/plugins/shmem.built-in.o: $(compel-deps) .FORCE
 compel/plugins/fds.built-in.o: $(compel-deps) .FORCE
 	$(Q) $(MAKE) $(build)=compel/plugins $@
 
-compel/compel: compel/built-in.o compel/libcompel.a | $(compel-deps)
+compel/compel: compel/built-in.o compel/$(LIBCOMPEL_A) | $(compel-deps)
 	$(call msg-link, $@)
 	$(Q) $(CC) $(CFLAGS) $^ $(WRAPFLAGS) $(LDFLAGS) -rdynamic -o $@
 
 #
 # And compel library.
-LIBCOMPEL_SO		:= libcompel.so
 LIBCOMPEL_SO_CFLAGS	+= $(CFLAGS) -rdynamic -Wl,-soname,$(LIBCOMPEL_SO).$(COMPEL_SO_VERSION_MAJOR)
-compel/$(LIBCOMPEL_SO): compel/libcompel.a
+compel/$(LIBCOMPEL_SO): compel/$(LIBCOMPEL_A)
 	$(call msg-link, $@)
 	$(Q) $(CC) -shared $(LIBCOMPEL_SO_CFLAGS) -o $@ -Wl,--whole-archive $^ -Wl,--no-whole-archive $(LDFLAGS)
+
+compel-install-targets	+= compel/$(LIBCOMPEL_SO)
+compel-install-targets	+= compel/compel
+compel-install-targets	+= compel/plugins/std.built-in.o
diff --git a/Makefile.install b/Makefile.install
index 939bcf9cbbef..9e45e0e9f4d3 100644
--- a/Makefile.install
+++ b/Makefile.install
@@ -46,7 +46,12 @@ install-criu: criu
 	$(Q) $(MAKE) $(build)=criu install
 .PHONY: install-criu
 
-install: install-man install-lib install-criu
+install-compel: $(compel-install-targets)
+	$(Q) $(MAKE) $(build)=compel install
+	$(Q) $(MAKE) $(build)=compel/plugins install
+.PHONY: install-compel
+
+install: install-man install-lib install-criu install-compel
 	@true
 .PHONY: install
 
@@ -54,4 +59,6 @@ uninstall:
 	$(Q) $(MAKE) -C Documentation $@
 	$(Q) $(MAKE) -C lib $@
 	$(Q) $(MAKE) -C criu $@
+	$(Q) $(MAKE) $(build)=compel $@
+	$(Q) $(MAKE) $(build)=compel/plugins $@
 .PHONY: uninstall
diff --git a/compel/Makefile b/compel/Makefile
index 27ef59c52bc5..b15d30e967d6 100644
--- a/compel/Makefile
+++ b/compel/Makefile
@@ -14,7 +14,7 @@ ccflags-y		+= -fPIC
 ccflags-y		+= -I compel/include/uapi
 ccflags-y		+= -I compel/plugins/include/uapi
 
-lib-name		:= libcompel.a
+lib-name		:= $(LIBCOMPEL_A)
 lib-y			+= src/lib/log.o
 host-lib-y		+= src/lib/log.o
 
@@ -51,3 +51,44 @@ endif
 cleanup-y		+= compel/compel
 cleanup-y		+= compel/compel-host
 cleanup-y		+= compel/libcompel.so
+
+install: compel/compel compel/$(LIBCOMPEL_SO) compel/$(LIBCOMPEL_A)
+	$(E) "  INSTALL " compel
+	$(Q) mkdir -p $(DESTDIR)$(SBINDIR)
+	$(Q) install -m 755 compel/compel $(DESTDIR)$(SBINDIR)
+	$(E) "  INSTALL " $(LIBCOMPEL_SO)
+	$(Q) mkdir -p $(DESTDIR)$(LIBDIR)
+	$(Q) install -m 0644 compel/$(LIBCOMPEL_SO) $(DESTDIR)$(LIBDIR)
+	$(Q) install -m 755 compel/$(LIBCOMPEL_SO) $(DESTDIR)$(LIBDIR)/$(LIBCOMPEL_SO).$(COMPEL_SO_VERSION_MAJOR).$(COMPEL_SO_VERSION_MINOR)
+	$(Q) ln -fns $(LIBCOMPEL_SO).$(COMPEL_SO_VERSION_MAJOR).$(COMPEL_SO_VERSION_MINOR) $(DESTDIR)$(LIBDIR)/$(LIBCOMPEL_SO).$(COMPEL_SO_VERSION_MAJOR)
+	$(Q) ln -fns $(LIBCOMPEL_SO).$(COMPEL_SO_VERSION_MAJOR).$(COMPEL_SO_VERSION_MINOR) $(DESTDIR)$(LIBDIR)/$(LIBCOMPEL_SO)
+	$(E) "  INSTALL " $(LIBCOMPEL_A)
+	$(Q) install -m 0644 compel/$(LIBCOMPEL_A) $(DESTDIR)$(LIBDIR)
+	$(E) "  INSTALL " compel uapi
+	$(Q) mkdir -p $(DESTDIR)$(LIBEXECDIR)/compel/
+	$(Q) mkdir -p $(DESTDIR)$(INCLUDEDIR)/compel/asm
+	$(Q) cp -fr compel/include/uapi/compel/*.h $(DESTDIR)$(INCLUDEDIR)/compel
+	$(Q) cp -fr compel/include/uapi/compel/asm/*.h $(DESTDIR)$(INCLUDEDIR)/compel/asm
+	$(Q) mkdir -p $(DESTDIR)$(INCLUDEDIR)/compel/common/asm
+	$(Q) cp -fr include/common/compiler.h $(DESTDIR)$(INCLUDEDIR)/compel/common/
+	$(Q) cp -fr include/common/asm/page.h $(DESTDIR)$(INCLUDEDIR)/compel/common/asm
+.PHONY: install
+
+uninstall:
+	$(E) " UNINSTALL" compel
+	$(Q) $(RM) $(addprefix $(DESTDIR)$(SBINDIR)/,compel)
+	$(E) " UNINSTALL" $(LIBCOMPEL_SO)
+	$(Q) $(RM) $(addprefix $(DESTDIR)$(LIBDIR)/,$(LIBCOMPEL_SO))
+	$(Q) $(RM) $(addprefix $(DESTDIR)$(LIBDIR)/,$(LIBCOMPEL_SO).$(COMPEL_SO_VERSION_MAJOR))
+	$(Q) $(RM) $(addprefix $(DESTDIR)$(LIBDIR)/,$(LIBCOMPEL_SO).$(COMPEL_SO_VERSION_MAJOR).$(COMPEL_SO_VERSION_MINOR))
+	$(E) " UNINSTALL" $(LIBCOMPEL_A)
+	$(Q) $(RM) $(addprefix $(DESTDIR)$(LIBDIR)/,$(LIBCOMPEL_A))
+	$(E) " UNINSTALL" compel uapi
+	$(Q) $(RM) $(addprefix $(DESTDIR)$(INCLUDEDIR),compel/*.h)
+	$(Q) $(RM) $(addprefix $(DESTDIR)$(INCLUDEDIR),compel/asm/*.h)
+	$(Q) $(RM) -rf $(addprefix $(DESTDIR)$(INCLUDEDIR),compel/asm/)
+	$(Q) $(RM) $(addprefix $(DESTDIR)$(INCLUDEDIR),compel/common/*.h)
+	$(Q) $(RM) $(addprefix $(DESTDIR)$(INCLUDEDIR),compel/common/asm/*.h)
+	$(Q) $(RM) -rf $(addprefix $(DESTDIR)$(INCLUDEDIR),compel/common/asm/)
+	$(Q) $(RM) -rf $(addprefix $(DESTDIR)$(INCLUDEDIR),compel/common/)
+.PHONY: uninstall
diff --git a/compel/plugins/Makefile b/compel/plugins/Makefile
index 9e66c74bb343..320f55853678 100644
--- a/compel/plugins/Makefile
+++ b/compel/plugins/Makefile
@@ -67,3 +67,30 @@ endef
 # and definitions so we have to order their
 # generation manually.
 $(foreach t,$(target),$(eval $(call syscall-priority,$(t)-obj-y,std-headers-deps)))
+
+#
+# FIXME syscall-types.h should be setup earlier
+#
+install: compel/plugins/std.built-in.o compel/plugins/fds.built-in.o
+	$(E) "  INSTALL " compel plugins
+	$(Q) mkdir -p $(DESTDIR)$(LIBEXECDIR)/compel/
+	$(Q) install -m 0644 compel/plugins/std.built-in.o $(DESTDIR)$(LIBEXECDIR)/compel/
+	$(Q) install -m 0644 compel/plugins/fds.built-in.o $(DESTDIR)$(LIBEXECDIR)/compel/
+	$(Q) mkdir -p $(DESTDIR)$(LIBEXECDIR)/compel/scripts
+	$(Q) install -m 0644 compel/arch/$(ARCH)/scripts/compel-pack.lds.S $(DESTDIR)$(LIBEXECDIR)/compel/scripts
+	$(E) "  INSTALL " compel plugins uapi
+	$(Q) mkdir -p $(DESTDIR)$(INCLUDEDIR)/compel/plugins/std/asm
+	$(Q) cp -fr compel/include/uapi/compel/plugins/plugin-std.h $(DESTDIR)$(INCLUDEDIR)/compel/plugins
+	$(Q) cp -fr compel/include/uapi/compel/plugins/std/*.h $(DESTDIR)$(INCLUDEDIR)/compel/plugins/std
+	$(Q) cp -fr compel/arch/$(ARCH)/plugins/include/asm/syscall-types.h $(DESTDIR)$(INCLUDEDIR)/compel/plugins/std/asm
+	$(Q) cp -fr compel/include/uapi/compel/plugins/plugin-fds.h $(DESTDIR)$(INCLUDEDIR)/compel/plugins
+.PHONY: install
+
+uninstall:
+	$(E) " UNINSTALL" compel plugins
+	$(Q) $(RM) $(addprefix $(DESTDIR)$(LIBEXECDIR)/compel/,std.built-in.o)
+	$(Q) $(RM) $(addprefix $(DESTDIR)$(LIBEXECDIR)/compel/,fds.built-in.o)
+	$(Q) $(RM) $(addprefix $(DESTDIR)$(LIBEXECDIR)/compel/scripts,compel-pack.lds.S)
+	$(E) " UNINSTALL" compel and plugins uapi
+	$(Q) $(RM) -rf $(addprefix $(DESTDIR)$(INCLUDEDIR),compel/plugins)
+.PHONY: uninstall
-- 
2.7.4



More information about the CRIU mailing list