Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions pkgs/development/libraries/libxcrypt/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
lib,
stdenv,
fetchurl,
fetchpatch,
perl,
# Update the enabled crypt scheme ids in passthru when the enabled hashes change
enableHashes ? "strong",
Expand All @@ -19,6 +20,11 @@ stdenv.mkDerivation (finalAttrs: {
hash = "sha256-cVE6McAaQovM1TZ6Mv2V8RXW2sUPtbYMd51ceUKuwHE=";
};

patches = [
# https://github.com/besser82/libxcrypt/pull/221
./fix-symver-on-non-elf.patch
];

# this could be accomplished by updateAutotoolsGnuConfigScriptsHook, but that causes infinite recursion
# necessary for FreeBSD code path in configure
postPatch = ''
Expand All @@ -36,15 +42,16 @@ stdenv.mkDerivation (finalAttrs: {
"--disable-failure-tokens"
# required for musl, android, march=native
"--disable-werror"
];
]
++ lib.optional stdenv.hostPlatform.isCygwin "--disable-symvers";

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" ]
++ lib.optionals stdenv.hostPlatform.isPE [ "LDFLAGS+=-no-undefined" ]

# lld 17 sets `--no-undefined-version` by default and `libxcrypt`'s
# version script unconditionally lists legacy compatibility symbols, even
Expand Down
26 changes: 26 additions & 0 deletions pkgs/development/libraries/libxcrypt/fix-symver-on-non-elf.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
From 2806cc84abb7bf6aa9d9ff062944d664ab644127 Mon Sep 17 00:00:00 2001
From: David McFarland <[email protected]>
Date: Fri, 2 Jan 2026 13:09:02 -0400
Subject: [PATCH] Fix compilation on Cygwin

Cygwin uses COFF like Windows, so it needs the symver stub.
---
lib/crypt-port.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/crypt-port.h b/lib/crypt-port.h
index 23c7efa..0c90ade 100644
--- a/lib/crypt-port.h
+++ b/lib/crypt-port.h
@@ -205,7 +205,7 @@ extern size_t strcpy_or_abort (void *dst, size_t d_size, const void *src);
__asm__(".globl _" extstr); \
__asm__(".set _" extstr ", _" #intname)

-#elif defined _WIN32
+#elif defined _WIN32 || defined __CYGWIN__

/* .symver is only supported for ELF format, Windows uses COFF/PE */
# define symver_set(extstr, intname, version, mode)
--
2.51.2

Loading