[CRIU] [PATCH 03/14] soccr: Wire into builder

Pavel Emelyanov xemul at virtuozzo.com
Mon Apr 18 06:03:11 PDT 2016


This patch is to be fixed :) Also need

- install section
- so name and version

Need help here -- if I copy this stuff from lib/c/
would that work?

Signed-off-by: Pavel Emelyanov <xemul at virtuozzo.com>
---
 Makefile          | 17 +++++++++++++++--
 Makefile.versions |  7 +++++++
 criu/Makefile     |  2 +-
 criu/sk-tcp.c     |  2 ++
 soccr/Makefile    |  5 +++++
 soccr/soccr.c     |  1 +
 soccr/soccr.h     |  3 +++
 7 files changed, 34 insertions(+), 3 deletions(-)
 create mode 100644 soccr/Makefile
 create mode 100644 soccr/soccr.c
 create mode 100644 soccr/soccr.h

diff --git a/Makefile b/Makefile
index 625cf31..c8dc424 100644
--- a/Makefile
+++ b/Makefile
@@ -113,6 +113,17 @@ compel/%:
 	$(Q) $(MAKE) $(build)=compel $@
 
 #
+# Next the socket CR library
+#
+$(eval $(call gen-built-in,soccr))
+.PHONY: soccr
+
+SOCCR_SO := libsoccr.so
+soccr/$(SOCCR_SO): soccr/built-in.o
+	$(call msg-link, $@)
+	$(Q) $(CC) -shared $(cflags-so) -o $@ $^ $(ldflags-so) $(LDFLAGS)
+
+#
 # CRIU building done in own directory
 # with slightly different rules so we
 # can't use nmk engine directly (we
@@ -122,7 +133,7 @@ compel/%:
 # the nmk so we can reuse it there.
 criu/%: images/built-in.o compel/compel
 	$(Q) $(MAKE) -C criu $@
-criu: images/built-in.o compel/compel
+criu: images/built-in.o compel/compel soccr/$(SOCCR_SO)
 	$(Q) $(MAKE) -C criu all
 .PHONY: criu
 
@@ -136,13 +147,14 @@ lib: criu
 	$(Q) $(MAKE) -C lib all
 .PHONY: lib
 
-all: compel criu lib
+all: compel criu lib soccr/$(SOCCR_SO)
 .PHONY: all
 
 subclean:
 	$(call msg-clean, criu)
 	$(Q) $(MAKE) -C lib clean
 	$(Q) $(MAKE) -C Documentation clean
+	$(Q) $(MAKE) $(build)=soccr clean
 	$(Q) $(RM) .gitid
 .PHONY: subclean
 
@@ -159,6 +171,7 @@ mrproper: subclean
 	$(Q) $(MAKE) -C criu $@
 	$(Q) $(RM) cscope.*
 	$(Q) $(RM) tags TAGS
+	$(Q) $(RM) soccr/$(SOCCR_SO)
 .PHONY: mrproper
 
 #
diff --git a/Makefile.versions b/Makefile.versions
index 2e4bc37..6806d29 100644
--- a/Makefile.versions
+++ b/Makefile.versions
@@ -21,3 +21,10 @@ COMPEL_SO_VERSION_MAJOR	:= 1
 COMPEL_SO_VERSION_MINOR	:= 0
 
 export COMPEL_SO_VERSION_MAJOR COMPEL_SO_VERSION_MINOR
+
+#
+# SOCCR library.
+SOCCR_SO_VERSION_MAJOR	:= 1
+SOCCR_SO_VERSION_MINOR	:= 0
+
+export SOCCR_SO_VERSION_MAJOR SOCCR_SO_VERSION_MINOR
diff --git a/criu/Makefile b/criu/Makefile
index acd44ac..66c046a 100644
--- a/criu/Makefile
+++ b/criu/Makefile
@@ -59,7 +59,7 @@ ccflags-y		+= -I/usr/include/libnl3
 
 export ccflags-y
 
-LIBS			:= -lrt -lpthread -lprotobuf-c -ldl -lnl-3
+LIBS			:= -lrt -lpthread -lprotobuf-c -ldl -lnl-3 -lsoccr -L ../soccr/
 
 REQ-RPM-PKG-NAMES	+= protobuf
 REQ-RPM-PKG-NAMES	+= protobuf-c
diff --git a/criu/sk-tcp.c b/criu/sk-tcp.c
index d6ce73a..29ad06d 100644
--- a/criu/sk-tcp.c
+++ b/criu/sk-tcp.c
@@ -8,6 +8,8 @@
 #include <sched.h>
 #include <netinet/in.h>
 
+#include "../soccr/soccr.h"
+
 #include "cr_options.h"
 #include "util.h"
 #include "list.h"
diff --git a/soccr/Makefile b/soccr/Makefile
new file mode 100644
index 0000000..32818aa
--- /dev/null
+++ b/soccr/Makefile
@@ -0,0 +1,5 @@
+obj-y			+= soccr.o
+ccflags-y		+= -fPIC -Wa,--noexecstack -fno-stack-protector
+
+cflags-so		+= $(CFLAGS) -rdynamic -Wl,-soname,$(SOCCR_SO).$(SOCCR_SO_VERSION_MAJOR)
+ldflags-so		+= -lprotobuf-c
diff --git a/soccr/soccr.c b/soccr/soccr.c
new file mode 100644
index 0000000..f33c50c
--- /dev/null
+++ b/soccr/soccr.c
@@ -0,0 +1 @@
+#include "soccr.h"
diff --git a/soccr/soccr.h b/soccr/soccr.h
new file mode 100644
index 0000000..eaae1a2
--- /dev/null
+++ b/soccr/soccr.h
@@ -0,0 +1,3 @@
+#ifndef __LIBSOCCR_H__
+#define __LIBSOCCR_H__
+#endif
-- 
2.5.0



More information about the CRIU mailing list