mirror of https://github.com/containers/conmon.git
Merge pull request #573 from jnovy/348
Add optional systemd support for static builds
This commit is contained in:
commit
11bcc31eae
4
Makefile
4
Makefile
|
|
@ -38,10 +38,14 @@ override CFLAGS += $(shell $(PKG_CONFIG) --cflags glib-2.0) -DVERSION=\"$(VERSIO
|
|||
# "pkg-config --exists" will error if the package doesn't exist. Make can only compare
|
||||
# output of commands, so the echo commands are to allow pkg-config to error out, make to catch it,
|
||||
# and allow the compilation to complete.
|
||||
#
|
||||
# For static builds, systemd can be disabled with DISABLE_SYSTEMD=1
|
||||
ifneq ($(DISABLE_SYSTEMD), 1)
|
||||
ifeq ($(shell $(PKG_CONFIG) --exists libsystemd && echo "0"), 0)
|
||||
override LIBS += $(shell $(PKG_CONFIG) --libs libsystemd)
|
||||
override CFLAGS += $(shell $(PKG_CONFIG) --cflags libsystemd) -D USE_JOURNALD=1
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(shell hack/seccomp-notify.sh), 0)
|
||||
override LIBS += $(shell $(PKG_CONFIG) --libs libseccomp) -ldl
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
{ stdenv
|
||||
, pkgs
|
||||
, enableSystemd ? false
|
||||
}:
|
||||
with pkgs; stdenv.mkDerivation rec {
|
||||
name = "conmon";
|
||||
|
|
@ -18,11 +19,15 @@ with pkgs; stdenv.mkDerivation rec {
|
|||
] ++ [
|
||||
pkgsStatic.glib
|
||||
libseccomp
|
||||
] ++ lib.optionals enableSystemd [
|
||||
# Only include systemd for dynamic builds, not static builds
|
||||
# Static builds will use PKG_CONFIG_PATH approach instead
|
||||
];
|
||||
prePatch = ''
|
||||
export CFLAGS='-static -pthread'
|
||||
export LDFLAGS='-s -w -static-libgcc -static'
|
||||
export EXTRA_LDFLAGS='-s -w -linkmode external -extldflags "-static -lm"'
|
||||
${lib.optionalString (!enableSystemd) "export DISABLE_SYSTEMD=1"}
|
||||
'';
|
||||
buildPhase = ''
|
||||
patchShebangs .
|
||||
|
|
|
|||
Loading…
Reference in New Issue