Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ghc: support musl-native! #43369

Merged
merged 3 commits into from
Jul 12, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions pkgs/development/compilers/ghc/8.2.1-binary.nix
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{ stdenv
, fetchurl, perl, gcc, llvm_39
, ncurses5, gmp, libiconv
, ncurses5, gmp, glibc, libiconv
}:

# Prebuilt only does native
Expand All @@ -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 {
Expand Down Expand Up @@ -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

Expand All @@ -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)
Expand Down