about summary refs log tree commit diff
path: root/pkgs/development/compilers
diff options
context:
space:
mode:
authorWill Dietz <github@wdtz.org>2018-07-11 21:31:46 -0500
committerGitHub <noreply@github.com>2018-07-11 21:31:46 -0500
commitfcfd66cea285e35cf3d2c2f99a5572561e225331 (patch)
tree6a3b062b26a7b74ecf830199f33ddd6e8abe4264 /pkgs/development/compilers
parent2ea2cce39165c1cd5c7ada6da0c813a53b1afa4b (diff)
parente065779af185b07566b9bbc4d2fc2ea70fdf3856 (diff)
downloadnixlib-fcfd66cea285e35cf3d2c2f99a5572561e225331.tar
nixlib-fcfd66cea285e35cf3d2c2f99a5572561e225331.tar.gz
nixlib-fcfd66cea285e35cf3d2c2f99a5572561e225331.tar.bz2
nixlib-fcfd66cea285e35cf3d2c2f99a5572561e225331.tar.lz
nixlib-fcfd66cea285e35cf3d2c2f99a5572561e225331.tar.xz
nixlib-fcfd66cea285e35cf3d2c2f99a5572561e225331.tar.zst
nixlib-fcfd66cea285e35cf3d2c2f99a5572561e225331.zip
Merge pull request #43369 from dtzWill/experimental/ghc-musl-bootstrap
ghc: support musl-native!
Diffstat (limited to 'pkgs/development/compilers')
-rw-r--r--pkgs/development/compilers/ghc/8.2.1-binary.nix14
1 files changed, 11 insertions, 3 deletions
diff --git a/pkgs/development/compilers/ghc/8.2.1-binary.nix b/pkgs/development/compilers/ghc/8.2.1-binary.nix
index 9bd7dfcb9fc1..bfb9c4cd6164 100644
--- a/pkgs/development/compilers/ghc/8.2.1-binary.nix
+++ b/pkgs/development/compilers/ghc/8.2.1-binary.nix
@@ -1,6 +1,6 @@
 { stdenv
 , fetchurl, perl, gcc, llvm_39
-, ncurses5, gmp, libiconv
+, ncurses5, gmp, glibc, libiconv
 }:
 
 # Prebuilt only does native
@@ -14,6 +14,13 @@ let
   libEnvVar = stdenv.lib.optionalString stdenv.hostPlatform.isDarwin "DY"
     + "LD_LIBRARY_PATH";
 
+  glibcDynLinker = assert stdenv.isLinux;
+    if stdenv.hostPlatform.libc == "glibc" then
+       # Could be stdenv.cc.bintools.dynamicLinker, keeping as-is to avoid rebuild.
+       ''"$(cat $NIX_CC/nix-support/dynamic-linker)"''
+    else
+      "${stdenv.lib.getLib glibc}/lib/ld-linux*";
+
 in
 
 stdenv.mkDerivation rec {
@@ -95,7 +102,7 @@ stdenv.mkDerivation rec {
       find . -type f -perm -0100 -exec patchelf \
           --replace-needed libncurses${stdenv.lib.optionalString stdenv.is64bit "w"}.so.5 libncurses.so \
           --replace-needed libtinfo.so libtinfo.so.5 \
-          --interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" {} \;
+          --interpreter ${glibcDynLinker} {} \;
 
       paxmark m ./ghc-${version}/ghc/stage2/build/tmp/ghc-stage2
 
@@ -107,7 +114,8 @@ stdenv.mkDerivation rec {
   configureFlags = [
     "--with-gmp-libraries=${stdenv.lib.getLib gmp}/lib"
     "--with-gmp-includes=${stdenv.lib.getDev gmp}/include"
-  ] ++ stdenv.lib.optional stdenv.isDarwin "--with-gcc=${./gcc-clang-wrapper.sh}";
+  ] ++ stdenv.lib.optional stdenv.isDarwin "--with-gcc=${./gcc-clang-wrapper.sh}"
+    ++ stdenv.lib.optional stdenv.hostPlatform.isMusl "--disable-ld-override";
 
   # Stripping combined with patchelf breaks the executables (they die
   # with a segfault or the kernel even refuses the execve). (NIXPKGS-85)