Revert "haskell: workaround for bug with dynamic libraries on darwin"
This reverts commit 19e2e7290a25819bd66a94db389e7e0d268f7fc0. See the correct fix in aa64994b48a29ea8d12323942f1743fa4133527a General purpose solution will be once we implement https://github.com/NixOS/nixpkgs/issues/21624
This commit is contained in:
parent
af2cfc076f
commit
663048f378
@ -244,41 +244,9 @@ stdenv.mkDerivation ({
|
|||||||
runHook postConfigure
|
runHook postConfigure
|
||||||
'';
|
'';
|
||||||
|
|
||||||
# The darwin pre/post build sections are a workaround https://github.com/haskell/cabal/issues/4183
|
|
||||||
# It seems like --extra-lib-dirs from the previous steps is not detected properly,
|
|
||||||
# to work around this we build using a DYLD_LIBRARY_PATH and fixup the build afterwards.
|
|
||||||
buildPhase = ''
|
buildPhase = ''
|
||||||
runHook preBuild
|
runHook preBuild
|
||||||
${optionalString stdenv.isDarwin ''
|
|
||||||
local inputClosure=""
|
|
||||||
for i in $propagatedNativeBuildInputs $nativeBuildInputs; do
|
|
||||||
findInputs $i inputClosure propagated-native-build-inputs
|
|
||||||
done
|
|
||||||
local -a inputLibs=()
|
|
||||||
for p in $inputClosure; do
|
|
||||||
if [ -d "$p/lib/${ghc.name}/package.conf.d" ]; then
|
|
||||||
continue
|
|
||||||
fi
|
|
||||||
if [ -d "$p/lib" ]; then
|
|
||||||
inputLibs+="$p/lib"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
for lib in $inputLibs; do
|
|
||||||
export DYLD_LIBRARY_PATH="$lib:''${DYLD_LIBRARY_PATH:+:$DYLD_LIBRARY_PATH}"
|
|
||||||
done
|
|
||||||
''}
|
|
||||||
${setupCommand} build ${buildTarget}${crossCabalFlagsString}
|
${setupCommand} build ${buildTarget}${crossCabalFlagsString}
|
||||||
${optionalString stdenv.isDarwin ''
|
|
||||||
unset DYLD_LIBRARY_PATH
|
|
||||||
|
|
||||||
local outputLib=dist/build/*-ghc${ghc.version}.dylib
|
|
||||||
for lib in $inputLib/*.dylib; do
|
|
||||||
for name in $(otool -L $outputLib | awk '$1 ~ /^'$(basename lib)'/ {print $1}' | cat); do
|
|
||||||
install_name_tool -change $name $lib $outputLib
|
|
||||||
done
|
|
||||||
done
|
|
||||||
''}
|
|
||||||
runHook postBuild
|
runHook postBuild
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user