Skip to contentSkip to conversation

build-sys: support unshare.static

PATCH Applied Georg Schiesser 2 participants 2 messages May 5, 2015 – May 18, 2015 Util-Linux package

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 build-sys: support unshare.static

This patch adds support for building a static version of unshare. We need to add unshare to the list of possible static programs, and provide build flags for the compiler and linker, which are equivalent to the flags of the non-static program, except additional static linking. See also: commit 2fa60c5 build-sys: support nsenter.static

---
 configure.ac            | 2 +-
 sys-utils/Makemodule.am | 8 ++++++++
 2 files changed, 9 insertions(+), 1 deletion(-)
configure.ac +1 -1
index 6bc9efd..52c531e 100644
@@ -442,7 +442,7 @@ AC_LINK_IFELSE([AC_LANG_PROGRAM([extern char *__progname;],
 	   AC_MSG_RESULT([no]))
 
 dnl Static compilation
-m4_define([UL_STATIC_PROGRAMS], [losetup, mount, umount, fdisk, sfdisk, blkid, nsenter])
+m4_define([UL_STATIC_PROGRAMS], [losetup, mount, umount, fdisk, sfdisk, blkid, nsenter, unshare])
 
 AC_ARG_ENABLE([static-programs],
   [AS_HELP_STRING([--enable-static-programs=LIST],
sys-utils/Makemodule.am +8 -0
index 15d0a95..93b1644 100644
@@ -350,6 +350,14 @@ dist_man_MANS += sys-utils/unshare.1
 unshare_SOURCES = sys-utils/unshare.c
 unshare_LDADD = $(LDADD) libcommon.la
 unshare_CFLAGS = $(AM_CFLAGS) -I$(ul_libmount_incdir)
+
+if HAVE_STATIC_UNSHARE
+usrbin_exec_PROGRAMS += unshare.static
+unshare_static_SOURCES = $(unshare_SOURCES)
+unshare_static_LDFLAGS = -all-static
+unshare_static_LDADD = $(unshare_LDADD)
+unshare_static_CFLAGS = $(unshare_CFLAGS)
+endif
 endif
 
 if BUILD_NSENTER
Signature · 1 line
2.1.4
maintainer Applied
#1 lore raw
Quoted 3 lines · Georg Schiesser
 configure.ac            | 2 +-
 sys-utils/Makemodule.am | 8 ++++++++
 2 files changed, 9 insertions(+), 1 deletion(-)

Applied, thanks.

Signature · 2 lines
 Karel Zak  <[email protected]>
 http://karelzak.blogspot.com