From 1f0ef842ca88a57613faf1ef4cd9a5d4e77efd81 Mon Sep 17 00:00:00 2001 From: SCOTT-HAMILTON Date: Fri, 26 Nov 2021 00:00:24 +0100 Subject: [PATCH 1/2] util-linux: fix static build --- pkgs/os-specific/linux/util-linux/default.nix | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/pkgs/os-specific/linux/util-linux/default.nix b/pkgs/os-specific/linux/util-linux/default.nix index 0818d7bde794e..b3536e038f0bb 100644 --- a/pkgs/os-specific/linux/util-linux/default.nix +++ b/pkgs/os-specific/linux/util-linux/default.nix @@ -1,8 +1,11 @@ { lib, stdenv, fetchurl, pkg-config, zlib, shadow, libcap_ng , ncurses ? null, pam, systemd ? null , nlsSupport ? true +, audit ? null }: +assert stdenv.hostPlatform.isStatic -> audit != null; + stdenv.mkDerivation rec { pname = "util-linux"; version = "2.37.2"; @@ -57,7 +60,17 @@ stdenv.mkDerivation rec { nativeBuildInputs = [ pkg-config ]; buildInputs = [ zlib pam libcap_ng ] - ++ lib.filter (p: p != null) [ ncurses systemd ]; + ++ lib.filter (p: p != null) [ ncurses systemd ] + # not sure how util-linux is linking with linux-pam, + # probably just with a simplistic -lpam. + # linux-pam doesn't seem to have a .pc file so I can't + # add -laudit to the Requires.private. + # libaudit is also needed directly anyway cf login-utils/login.c + # and sys-utils/hwclock.c, not sure how we got it working + # without audit on dynamic builds. + ++ lib.optionals stdenv.hostPlatform.isStatic [ audit ]; + + NIX_CFLAGS_LINK = lib.optionalString stdenv.hostPlatform.isStatic "-laudit"; doCheck = false; # "For development purpose only. Don't execute on production system!" From 9a57309c8283799160dc37134517d63bfb99fd45 Mon Sep 17 00:00:00 2001 From: SCOTT-HAMILTON Date: Sat, 21 Aug 2021 15:09:30 +0200 Subject: [PATCH 2/2] dbus: use autoreconfHook and fix static build --- pkgs/development/libraries/dbus/default.nix | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/pkgs/development/libraries/dbus/default.nix b/pkgs/development/libraries/dbus/default.nix index 22798fb1d8455..a3c5bbbf70be6 100644 --- a/pkgs/development/libraries/dbus/default.nix +++ b/pkgs/development/libraries/dbus/default.nix @@ -1,5 +1,6 @@ { stdenv , lib +, fetchpatch , fetchurl , pkg-config , expat @@ -15,6 +16,8 @@ , docbook_xml_dtd_44 , docbook-xsl-nons , xmlto +, autoreconfHook +, autoconf-archive }: stdenv.mkDerivation rec { @@ -32,15 +35,23 @@ stdenv.mkDerivation rec { # Also applied upstream in https://gitlab.freedesktop.org/dbus/dbus/-/merge_requests/189, # expected in version 1.14 ./docs-reproducible-ids.patch + # AC_PATH_XTRA doesn't seem to find X11 libs even though libX11 seems + # to provide valid pkg-config files. This replace AC_PATH_XTRA with + # PKG_CHECK_MODULES. + # MR merged cf https://gitlab.freedesktop.org/dbus/dbus/-/merge_requests/212/diffs?commit_id=23880a181e82ee7f + (fetchpatch { + url = "https://gitlab.freedesktop.org/dbus/dbus/-/commit/6bfaea0707ba1a7788c4b6d30c18fb094f3a1dd4.patch"; + sha256 = "1d8ay55n2ksw5faqx3hsdpfni3xl3gq9hnjl65073xcfnx67x8d2"; + }) ] ++ (lib.optional stdenv.isSunOS ./implement-getgrouplist.patch); postPatch = '' - substituteInPlace tools/Makefile.in \ - --replace 'install-localstatelibDATA:' 'disabled:' \ + substituteInPlace bus/Makefile.am \ + --replace 'install-data-hook:' 'disabled:' \ + --replace '$(mkinstalldirs) $(DESTDIR)$(localstatedir)/run/dbus' ':' + substituteInPlace tools/Makefile.am \ --replace 'install-data-local:' 'disabled:' \ --replace 'installcheck-local:' 'disabled:' - substituteInPlace bus/Makefile.in \ - --replace '$(mkinstalldirs) $(DESTDIR)$(localstatedir)/run/dbus' ':' '' + /* cleanup of runtime references */ '' substituteInPlace ./dbus/dbus-sysdeps-unix.c \ --replace 'DBUS_BINDIR "/dbus-launch"' "\"$lib/bin/dbus-launch\"" @@ -51,6 +62,8 @@ stdenv.mkDerivation rec { outputs = [ "out" "dev" "lib" "doc" "man" ]; nativeBuildInputs = [ + autoreconfHook + autoconf-archive pkg-config docbook_xml_dtd_44 docbook-xsl-nons