The following pull request was submitted through Github. It can be accessed and reviewed at: https://github.com/lxc/lxc/pull/2452
This e-mail was sent by the LXC bot, direct replies will not reach the author unless they happen to be subscribed to this list. === Description (from pull-request) === Signed-off-by: Christian Brauner <[email protected]> Cc: Serge Hallyn <[email protected]> Cc: Tycho Andersen <[email protected]>
From 30aad7ab44c07e5b3a751c7776ba21a642d7eb27 Mon Sep 17 00:00:00 2001 From: Christian Brauner <[email protected]> Date: Fri, 6 Jul 2018 12:36:44 +0200 Subject: [PATCH] autools: build both a shared and static liblxc Signed-off-by: Christian Brauner <[email protected]> Cc: Serge Hallyn <[email protected]> Cc: Tycho Andersen <[email protected]> --- src/lxc/Makefile.am | 61 +++++++++++++++++++++++++++++++++++------------------ 1 file changed, 41 insertions(+), 20 deletions(-) diff --git a/src/lxc/Makefile.am b/src/lxc/Makefile.am index da647740b..0c64c205b 100644 --- a/src/lxc/Makefile.am +++ b/src/lxc/Makefile.am @@ -79,7 +79,7 @@ if ENABLE_SELINUX LSM_SOURCES += lsm/selinux.c endif -lib_LTLIBRARIES = liblxc.la +lib_LTLIBRARIES = liblxc.la liblxc_static.la liblxc_la_SOURCES = \ storage/storage.c storage/storage.h \ storage/btrfs.c storage/btrfs.h \ @@ -141,16 +141,20 @@ liblxc_la_SOURCES += \ ../include/lxcmntent.c ../include/lxcmntent.h endif +if !HAVE_GETLINE +if HAVE_FGETLN +liblxc_la_SOURCES += ../include/getline.c ../include/getline.h +endif +endif + if !HAVE_PRLIMIT if HAVE_PRLIMIT64 liblxc_la_SOURCES += ../include/prlimit.c ../include/prlimit.h endif endif -if !HAVE_GETLINE -if HAVE_FGETLN -liblxc_la_SOURCES += ../include/getline.c ../include/getline.h -endif +if ENABLE_SECCOMP +liblxc_la_SOURCES += seccomp.c endif if !HAVE_STRLCPY @@ -192,6 +196,10 @@ if ENABLE_GNUTLS AM_CFLAGS += -DHAVE_LIBGNUTLS endif +if ENABLE_SECCOMP +AM_CFLAGS += -DHAVE_SECCOMP $(SECCOMP_CFLAGS) +endif + if ENABLE_SELINUX AM_CFLAGS += -DHAVE_SELINUX endif @@ -200,20 +208,34 @@ if USE_CONFIGPATH_LOGS AM_CFLAGS += -DUSE_CONFIGPATH_LOGS endif -if ENABLE_SECCOMP -AM_CFLAGS += -DHAVE_SECCOMP $(SECCOMP_CFLAGS) -liblxc_la_SOURCES += seccomp.c -endif +# build the shared library +liblxc_la_CFLAGS = -fPIC \ + -DPIC \ + $(AM_CFLAGS) \ + -pthread -liblxc_la_CFLAGS = -fPIC -DPIC $(AM_CFLAGS) -pthread +liblxc_la_LDFLAGS = -pthread \ + -shared \ + -Wl,-soname,liblxc.so.$(firstword $(subst ., ,@LXC_ABI@)) \ + -version-info @LXC_ABI_MAJOR@ -liblxc_la_LDFLAGS = \ - -pthread \ - -shared \ - -Wl,-soname,liblxc.so.$(firstword $(subst ., ,@LXC_ABI@)) \ - -version-info @LXC_ABI_MAJOR@ +liblxc_la_LIBADD = $(CAP_LIBS) \ + $(GNUTLS_LIBS) \ + $(SELINUX_LIBS) \ + $(SECCOMP_LIBS) -liblxc_la_LIBADD = $(CAP_LIBS) $(GNUTLS_LIBS) $(SELINUX_LIBS) $(SECCOMP_LIBS) +# build the static library +liblxc_static_la_SOURCES = $(liblxc_la_SOURCES) +liblxc_static_la_CFLAGS = $(AM_CFLAGS) \ + -pthread + +liblxc_static_la_LDFLAGS = -all-static \ + -pthread + +liblxc_static_la_LIBADD = $(CAP_LIBS) \ + $(GNUTLS_LIBS) \ + $(SELINUX_LIBS) \ + $(SECCOMP_LIBS) bin_SCRIPTS= @@ -322,10 +344,6 @@ if !HAVE_STRLCAT init_lxc_static_SOURCES += ../include/strlcat.c ../include/strlcat.h endif -if !HAVE_GETGRGID_R -liblxc_la_SOURCES += ../include/getgrgid_r.c ../include/getgrgid_r.h -endif - init_lxc_static_LDFLAGS = -all-static init_lxc_static_LDADD = @CAP_LIBS@ init_lxc_static_CFLAGS = $(AM_CFLAGS) -DNO_LXC_CONF @@ -350,12 +368,15 @@ install-exec-local: install-libLTLIBRARIES cd $(DESTDIR)$(libdir); \ ln -sf liblxc.so.@LXC_ABI@ liblxc.so.$(firstword $(subst ., ,@LXC_ABI@)); \ ln -sf liblxc.so.$(firstword $(subst ., ,@LXC_ABI@)) liblxc.so + rm -f $(DESTDIR)$(libdir)/liblxc_static.a + mv $(shell readlink -f $(DESTDIR)$(libdir)/liblxc_static.a) $(DESTDIR)$(libdir)/liblxc_static.a install-exec-hook: chmod u+s $(DESTDIR)$(libexecdir)/lxc/lxc-user-nic uninstall-local: $(RM) $(DESTDIR)$(libdir)/liblxc.so* + $(RM) $(DESTDIR)$(libdir)/liblxc_static.a if ENABLE_PAM if HAVE_PAM $(RM) $(DESTDIR)$(pamdir)/pam_cgfs.so*
_______________________________________________ lxc-devel mailing list [email protected] http://lists.linuxcontainers.org/listinfo/lxc-devel
