about summary refs log tree commit diff
path: root/pkgs/development/libraries/libxcrypt/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/development/libraries/libxcrypt/default.nix')
-rw-r--r--pkgs/development/libraries/libxcrypt/default.nix20
1 files changed, 18 insertions, 2 deletions
diff --git a/pkgs/development/libraries/libxcrypt/default.nix b/pkgs/development/libraries/libxcrypt/default.nix
index 067141883977d..efd3acb643fbe 100644
--- a/pkgs/development/libraries/libxcrypt/default.nix
+++ b/pkgs/development/libraries/libxcrypt/default.nix
@@ -15,6 +15,12 @@ stdenv.mkDerivation (finalAttrs: {
     hash = "sha256-5eH0yu4KAd4q7ibjE4gH1tPKK45nKHlm0f79ZeH9iUM=";
   };
 
+  # this could be accomplished by updateAutotoolsGnuConfigScriptsHook, but that causes infinite recursion
+  # necessary for FreeBSD code path in configure
+  postPatch = ''
+    substituteInPlace ./build-aux/m4-autogen/config.guess --replace-fail /usr/bin/uname uname
+  '';
+
   outputs = [
     "out"
     "man"
@@ -28,8 +34,18 @@ stdenv.mkDerivation (finalAttrs: {
     "--disable-werror"
   ];
 
-  # fixes: can't build x86_64-w64-mingw32 shared library unless -no-undefined is specified
-  makeFlags = lib.optionals stdenv.hostPlatform.isWindows [ "LDFLAGS=-no-undefined"] ;
+  makeFlags = let
+    lld17Plus = stdenv.cc.bintools.isLLVM
+      && lib.versionAtLeast stdenv.cc.bintools.version "17";
+  in []
+    # fixes: can't build x86_64-w64-mingw32 shared library unless -no-undefined is specified
+    ++ lib.optionals stdenv.hostPlatform.isWindows [ "LDFLAGS+=-no-undefined" ]
+
+    # lld 17 sets `--no-undefined-version` by default and `libxcrypt`'s
+    # version script unconditionally lists legacy compatibility symbols, even
+    # when not exported: https://github.com/besser82/libxcrypt/issues/181
+    ++ lib.optionals lld17Plus [ "LDFLAGS+=-Wl,--undefined-version" ]
+  ;
 
   nativeBuildInputs = [
     perl