Skip to content
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
29 changes: 21 additions & 8 deletions pkgs/development/compilers/ghc/9.0.2-binary.nix
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ let
fileToCheckFor = null;
}
];
isHadrian = true;
};
aarch64-darwin = {
variantSuffix = "";
Expand All @@ -158,6 +159,7 @@ let
fileToCheckFor = null;
}
];
isHadrian = true;
};
};
# Binary distributions for the musl libc for the respective system.
Expand All @@ -179,6 +181,7 @@ let
fileToCheckFor = "libncursesw.so.6";
}
];
isHadrian = true;
};
};
};
Expand Down Expand Up @@ -310,7 +313,7 @@ stdenv.mkDerivation {
# To link RTS in the end we also need libffi now
find . -name 'rts*.conf' \
-exec sed -e '/^[a-z-]*library-dirs/a \ ${lib.getLib libffi}/lib' \
-e 's@/Library/Developer/.*/usr/include/ffi@${lib.getDev libffi}/include@' \
-e 's@/.*/Developer/.*/usr/include/ffi@${lib.getDev libffi}/include@' \
-i {} \;
''
+
Expand Down Expand Up @@ -360,13 +363,23 @@ stdenv.mkDerivation {
makeFlags = lib.optionals stdenv.buildPlatform.isDarwin [ "XATTR=/does-not-exist" ];

# Patch scripts to include runtime dependencies in $PATH.
postInstall = ''
for i in "$out/bin/"*; do
test ! -h "$i" || continue
isScript "$i" || continue
sed -i -e '2i export PATH="${lib.makeBinPath runtimeDeps}:$PATH"' "$i"
done
'';
postInstall =
''
for i in "$out/bin/"*; do
test ! -h "$i" || continue
isScript "$i" || continue
sed -i -e '2i export PATH="${lib.makeBinPath runtimeDeps}:$PATH"' "$i"
done
''
# On Darwin, GHC doesn't install a bundled libffi.so, but instead uses the
# system one (see postUnpack). Due to a bug in Hadrian, the (bundled) libffi
# headers are installed anyways. This problem has been fixed in GHC 9.2:
# https://gitlab.haskell.org/ghc/ghc/-/merge_requests/8189. While the system
# header should shadow the GHC installed ones, remove them to be safe.
+ lib.optionalString (stdenv.hostPlatform.isDarwin && binDistUsed.isHadrian or false) ''
echo Deleting redundant libffi headers:
find "$out" '(' -name ffi.h -or -name ffitarget.h ')' -print -delete
'';

# Apparently necessary for the ghc Alpine (musl) bindist:
# When we strip, and then run the
Expand Down