Initial support for building Finit statically (incomplete)

This patch adresses issue #5.  However, there still remains a few issues
to work around before Finit can be built completely standalone.

    $ make clean all STATIC=1
    LINK    finit
    helpers.o: In function `getgroup':
    helpers.c:(.text+0x10a7): warning: Using 'getgrnam' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
    helpers.o: In function `getuser':
    helpers.c:(.text+0x108e): warning: Using 'getpwnam' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
    inetd.o: In function `getent':
    inetd.c:(.text+0x127): warning: Using 'getprotobyname' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
    inetd.c:(.text+0xce): warning: Using 'getservbyname' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking

The problem is the NSS plugins and similar issues that prevent static
linking when using the above functions.  See issue #5 for more on this.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
Joachim Nilsson committed 2015-03-06 21:58:56 +01:00
1 parent 52664791f5
commit a74b640507
5 files changed
+68 -19

No files matched your search

+19 -6
View File
@@ -56,6 +56,19 @@ FINIT_FIFO ?= /dev/initctl
FINIT_CONF ?= $(sysconfdir)/finit.conf
FINIT_RCSD ?= $(sysconfdir)/finit.d
# Some people may want to build Finit with statically linked libraries
# invocation: make STATIC=1
ifeq ($(STATIC), 1)
LDFLAGS += -static
CPPFLAGS += -DPLUGINS_STATIC
PLUGINS = ""
SRCS += $(wjldcard plugins/*.c)
OBJS := $(SRCS:.c=.o)
else
LDFLAGS += -rdynamic
LDLIBS += -ldl
endif
CFLAGS += -W -Wall -Werror -Os
# Disable annoying gcc warning for "warn_unused_result", see GIT 37af997
CPPFLAGS += -U_FORTIFY_SOURCE
@@ -64,12 +77,12 @@ CPPFLAGS += -D_XOPEN_SOURCE=600 -D_BSD_SOURCE -D_GNU_SOURCE
CPPFLAGS += -DVERSION=\"$(VERSION)\" -DWHOAMI=\"`whoami`@`hostname`\"
CPPFLAGS += -DFINIT_FIFO=\"$(FINIT_FIFO)\" -DFINIT_CONF=\"$(FINIT_CONF)\"
CPPFLAGS += -DFINIT_RCSD=\"$(FINIT_RCSD)\" -DPLUGIN_PATH=\"$(plugindir)\"
LDFLAGS += -rdynamic -L$(TOPDIR)/libite
DEPLIBS = libite/libite.so libuev/libuev.a
LDLIBS += -ldl -lite
LDFLAGS += -L$(TOPDIR)/libite -L$(TOPDIR)/libuev
DEPLIBS = libite/libite.a libuev/libuev.a
LDLIBS += -lite -luev
include common.mk
export libdir plugindir incdir ROOTDIR CPPFLAGS LDFLAGS LDLIBS
export libdir plugindir incdir ROOTDIR CPPFLAGS LDFLAGS LDLIBS STATIC
all: $(DEPLIBS) $(EXEC)
+$(MAKE) -C plugins $@
@@ -78,9 +91,9 @@ $(DEPLIBS): Makefile
+$(MAKE) -C libite all
+$(MAKE) -C libuev all
$(OBJS): Makefile
$(OBJS): Makefile $(DEPLIBS)
finit: $(OBJS) $(DEPLIBS)
finit: $(OBJS)
reboot: reboot.o $(DEPLIBS)