botan3: fix static cli build through empty-libgcc_eh workaround

Prior to this commit the build of `pkgsStatic.botan3.bin` produced a
dynamically linked binary, indenpendently of the move to
`pkgs/by-name`. Previous commit message and comments also suggest this
it was expected for the static build to only produce the static library,
not the statically linked cli.
This commit is contained in:
WilliButz
2025-11-03 14:20:17 +01:00
parent fc3665f74a
commit c8a230069b
+20 -1
View File
@@ -4,6 +4,8 @@
libcxxStdenv,
fetchurl,
pkgsStatic,
runCommandLocal,
binutils,
python3,
docutils,
bzip2,
@@ -11,7 +13,7 @@
jitterentropy,
esdm,
tpm2-tss,
static ? stdenv.hostPlatform.isStatic, # generates static libraries *only*
static ? stdenv.hostPlatform.isStatic,
windows,
# build ESDM RNG plugin
@@ -33,6 +35,21 @@ assert lib.assertOneOf "policy" policy [
];
let
stdenv = if static then libcxxStdenv else args.stdenv;
# (based on same workaround from capnproto package)
#
# HACK: work around https://github.com/NixOS/nixpkgs/issues/177129
# Though this is an issue between Clang and GCC,
# so it may not get fixed anytime soon...
empty-libgcc_eh =
runCommandLocal "empty-libgcc_eh"
{
nativeBuildInputs = [ binutils ];
}
''
mkdir -p "$out"/lib
${stdenv.cc.targetPrefix}ar r "$out"/lib/libgcc_eh.a
'';
in
stdenv.mkDerivation (finalAttrs: {
version = "3.9.0";
@@ -80,6 +97,8 @@ stdenv.mkDerivation (finalAttrs: {
windows.pthreads
];
propagatedBuildInputs = lib.optional static empty-libgcc_eh;
buildTargets = [
"cli"
]