haskell.compiler.ghc*Binary: don't propagate LLVM, use wrapper
Copy the approach from the normal GHC derivations for adding an `export PATH` into the scripts in `$out/bin` and use it to put the specific LLVM version of the binary GHC into its PATH. This will prevent the LLVM version of the GHC we are building later to take precedence over the LLVM version this GHC needs.
This commit is contained in:
@@ -140,6 +140,10 @@ let
|
||||
libEnvVar = lib.optionalString stdenv.hostPlatform.isDarwin "DY"
|
||||
+ "LD_LIBRARY_PATH";
|
||||
|
||||
runtimeDeps = lib.optionals useLLVM [
|
||||
(lib.getBin llvmPackages.llvm)
|
||||
];
|
||||
|
||||
in
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
@@ -156,7 +160,6 @@ stdenv.mkDerivation rec {
|
||||
|
||||
nativeBuildInputs = [ perl ];
|
||||
propagatedBuildInputs =
|
||||
lib.optionals useLLVM [ llvmPackages.llvm ]
|
||||
# Because musl bindists currently provide no way to tell where
|
||||
# libgmp is (see not [musl bindists have no .buildinfo]), we need
|
||||
# to propagate `gmp`, otherwise programs built by this ghc will
|
||||
@@ -177,7 +180,7 @@ stdenv.mkDerivation rec {
|
||||
# fixing the above-mentioned release issue,
|
||||
# and for GHC >= 9.* it is not clear as of writing whether that switch
|
||||
# will be made there too.
|
||||
++ lib.optionals stdenv.hostPlatform.isMusl [ gmp ]; # musl bindist needs this
|
||||
lib.optionals stdenv.hostPlatform.isMusl [ gmp ]; # musl bindist needs this
|
||||
|
||||
# Set LD_LIBRARY_PATH or equivalent so that the programs running as part
|
||||
# of the bindist installer can find the libraries they expect.
|
||||
@@ -278,6 +281,15 @@ stdenv.mkDerivation rec {
|
||||
# calls install-strip ...
|
||||
dontBuild = true;
|
||||
|
||||
# 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
|
||||
'';
|
||||
|
||||
# Apparently necessary for the ghc Alpine (musl) bindist:
|
||||
# When we strip, and then run the
|
||||
# patchelf --set-rpath "${libPath}:$(patchelf --print-rpath $p)" $p
|
||||
|
||||
@@ -155,6 +155,10 @@ let
|
||||
libEnvVar = lib.optionalString stdenv.hostPlatform.isDarwin "DY"
|
||||
+ "LD_LIBRARY_PATH";
|
||||
|
||||
runtimeDeps = lib.optionals useLLVM [
|
||||
(lib.getBin llvmPackages.llvm)
|
||||
];
|
||||
|
||||
in
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
@@ -175,9 +179,6 @@ stdenv.mkDerivation rec {
|
||||
# and update this comment accordingly.
|
||||
|
||||
nativeBuildInputs = [ perl ];
|
||||
propagatedBuildInputs =
|
||||
lib.optionals useLLVM [ llvmPackages.llvm ]
|
||||
;
|
||||
|
||||
# Set LD_LIBRARY_PATH or equivalent so that the programs running as part
|
||||
# of the bindist installer can find the libraries they expect.
|
||||
@@ -278,6 +279,15 @@ stdenv.mkDerivation rec {
|
||||
# calls install-strip ...
|
||||
dontBuild = true;
|
||||
|
||||
# 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
|
||||
'';
|
||||
|
||||
# Apparently necessary for the ghc Alpine (musl) bindist:
|
||||
# When we strip, and then run the
|
||||
# patchelf --set-rpath "${libPath}:$(patchelf --print-rpath $p)" $p
|
||||
|
||||
@@ -30,6 +30,10 @@ let
|
||||
|
||||
downloadsUrl = "https://downloads.haskell.org/ghc";
|
||||
|
||||
runtimeDeps = lib.optionals useLLVM [
|
||||
(lib.getBin llvmPackages.llvm)
|
||||
];
|
||||
|
||||
in
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
@@ -62,7 +66,6 @@ stdenv.mkDerivation rec {
|
||||
or (throw "cannot bootstrap GHC on this platform"));
|
||||
|
||||
nativeBuildInputs = [ perl ];
|
||||
propagatedBuildInputs = lib.optionals useLLVM [ llvmPackages.llvm ];
|
||||
|
||||
# Cannot patchelf beforehand due to relative RPATHs that anticipate
|
||||
# the final install location/
|
||||
@@ -130,6 +133,15 @@ stdenv.mkDerivation rec {
|
||||
# calls install-strip ...
|
||||
dontBuild = true;
|
||||
|
||||
# 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
|
||||
'';
|
||||
|
||||
# On Linux, use patchelf to modify the executables so that they can
|
||||
# find editline/gmp.
|
||||
postFixup = lib.optionalString stdenv.isLinux ''
|
||||
|
||||
Reference in New Issue
Block a user