ghc821-binary: use glibc on musl

These prebuilt binaries need to be used with glibc,
it doesn't matter what we're using otherwise.

This may seem a bit strange but has the huge advantage
of not needing to create/host/download musl-specific variants,
and instead continue to use the official ones from upstream.
This commit is contained in:
Will Dietz 2018-07-10 22:06:23 -05:00
parent 2d1d17032b
commit 4a1d311c49

View File

@ -1,6 +1,6 @@
{ stdenv
, fetchurl, perl, gcc, llvm_39
, ncurses5, gmp, libiconv
, ncurses5, gmp, glibc, libiconv
}:
# Prebuilt only does native
@ -14,6 +14,12 @@ let
libEnvVar = stdenv.lib.optionalString stdenv.hostPlatform.isDarwin "DY"
+ "LD_LIBRARY_PATH";
glibcDynLinker = assert stdenv.isLinux;
if stdenv.hostPlatform.libc == "glibc" then
stdenv.cc.bintools.dynamicLinker
else
"${stdenv.lib.getLib glibc}/lib/ld-linux*";
in
stdenv.mkDerivation rec {
@ -95,7 +101,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