From c8a230069b95520abc24a2c3daa51956e21411a8 Mon Sep 17 00:00:00 2001 From: WilliButz Date: Mon, 3 Nov 2025 11:44:45 +0100 Subject: [PATCH] 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. --- pkgs/by-name/bo/botan3/package.nix | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/pkgs/by-name/bo/botan3/package.nix b/pkgs/by-name/bo/botan3/package.nix index df822c92caa7..04fdafff9153 100644 --- a/pkgs/by-name/bo/botan3/package.nix +++ b/pkgs/by-name/bo/botan3/package.nix @@ -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" ]