git.iko.soy/typeable/nixpkgs
on master help sign in
Merge pull request #43369 from dtzWill/experimental/ghc-musl-bootstrap

ghc: support musl-native!

commitfcfd66cea285e35cf3d2c2f99a5572561e225331 authorWill Dietz <github@wdtz.org> dateWed 11 Jul 2018, 21:31 (8 years ago) parent2ea2ccee065779
1 file changed+11−3
pkgs/development/compilers/ghc/8.2.1-binary.nix+11−3
pkgs/development/compilers/ghc/8.2.1-binary.nix+11−3
@@ -1,6 +1,6 @@
11{ stdenv
22, fetchurl, perl, gcc, llvm_39
3−, ncurses5, gmp, libiconv
3+, ncurses5, gmp, glibc, libiconv
44}:
55
66# Prebuilt only does native
@@ -14,6 +14,13 @@ let
1414 libEnvVar = stdenv.lib.optionalString stdenv.hostPlatform.isDarwin "DY"
1515 + "LD_LIBRARY_PATH";
1616
17+ glibcDynLinker = assert stdenv.isLinux;
18+ if stdenv.hostPlatform.libc == "glibc" then
19+ # Could be stdenv.cc.bintools.dynamicLinker, keeping as-is to avoid rebuild.
20+ ''"$(cat $NIX_CC/nix-support/dynamic-linker)"''
21+ else
22+ "${stdenv.lib.getLib glibc}/lib/ld-linux*";
23+
1724in
1825
1926stdenv.mkDerivation rec {
@@ -95,7 +102,7 @@ stdenv.mkDerivation rec {
95102 find . -type f -perm -0100 -exec patchelf \
96103 --replace-needed libncurses${stdenv.lib.optionalString stdenv.is64bit "w"}.so.5 libncurses.so \
97104 --replace-needed libtinfo.so libtinfo.so.5 \
98− --interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" {} \;
105+ --interpreter ${glibcDynLinker} {} \;
99106
100107 paxmark m ./ghc-${version}/ghc/stage2/build/tmp/ghc-stage2
101108
@@ -107,7 +114,8 @@ stdenv.mkDerivation rec {
107114 configureFlags = [
108115 "--with-gmp-libraries=${stdenv.lib.getLib gmp}/lib"
109116 "--with-gmp-includes=${stdenv.lib.getDev gmp}/include"
110− ] ++ stdenv.lib.optional stdenv.isDarwin "--with-gcc=${./gcc-clang-wrapper.sh}";
117+ ] ++ stdenv.lib.optional stdenv.isDarwin "--with-gcc=${./gcc-clang-wrapper.sh}"
118+ ++ stdenv.lib.optional stdenv.hostPlatform.isMusl "--disable-ld-override";
111119
112120 # Stripping combined with patchelf breaks the executables (they die
113121 # with a segfault or the kernel even refuses the execve). (NIXPKGS-85)