summary refs log tree commit diff
diff options
context:
space:
mode:
authorJoe Hermaszewski <git@monoid.al>2020-11-10 13:31:02 +0800
committerJoe Hermaszewski <git@monoid.al>2020-11-12 14:03:08 +0800
commitc3b1e7e7a9077e2bc431fff7eef26bfbd4eefb50 (patch)
tree11d25fe285a31fb57e8f6333ceb0c5bfb316df70
parent06145fec65d0e1243495167537671c1ac60068b8 (diff)
downloadnixpkgs-c3b1e7e7a9077e2bc431fff7eef26bfbd4eefb50.tar
nixpkgs-c3b1e7e7a9077e2bc431fff7eef26bfbd4eefb50.tar.gz
nixpkgs-c3b1e7e7a9077e2bc431fff7eef26bfbd4eefb50.tar.bz2
nixpkgs-c3b1e7e7a9077e2bc431fff7eef26bfbd4eefb50.tar.lz
nixpkgs-c3b1e7e7a9077e2bc431fff7eef26bfbd4eefb50.tar.xz
nixpkgs-c3b1e7e7a9077e2bc431fff7eef26bfbd4eefb50.tar.zst
nixpkgs-c3b1e7e7a9077e2bc431fff7eef26bfbd4eefb50.zip
audiofile: fix static build
Fixes https://github.com/NixOS/nixpkgs/issues/103215
-rw-r--r--pkgs/development/libraries/audiofile/default.nix15
1 files changed, 15 insertions, 0 deletions
diff --git a/pkgs/development/libraries/audiofile/default.nix b/pkgs/development/libraries/audiofile/default.nix
index 46c29e2fa12..9f945b15dec 100644
--- a/pkgs/development/libraries/audiofile/default.nix
+++ b/pkgs/development/libraries/audiofile/default.nix
@@ -28,6 +28,21 @@ stdenv.mkDerivation rec {
   # fix build with gcc9
   NIX_CFLAGS_LINK = lib.optional (stdenv.system == "i686-linux") "-lgcc";
 
+  # Even when statically linking, libstdc++.la is put in dependency_libs here,
+  # and hence libstdc++.so passed to the linker, just pass -lstdc++ and let the
+  # compiler do what it does best.  (libaudiofile.la is a generated file, so we
+  # have to run `make` that far first).
+  #
+  # Without this, the executables in this package (sfcommands and examples)
+  # fail to build: https://github.com/NixOS/nixpkgs/issues/103215
+  #
+  # There might be a more sensible way to do this with autotools, but I am not
+  # smart enough to discover it.
+  preBuild = lib.optionalString stdenv.targetPlatform.isStatic ''
+    make -C libaudiofile $makeFlags
+    sed -i "s/dependency_libs=.*/dependency_libs=' -lstdc++'/" libaudiofile/libaudiofile.la
+  '';
+
   patches = [
     ./gcc-6.patch
     ./CVE-2015-7747.patch