ghc prebuilt: Simplify and harden Darwin fixup

- Patch all executables and libraries, while skipping scripts. Base at
   least uses libiconv, so should need this too---I suspect it wasn't a
   problem before as we got away with the immpurity.

 - Rather than hardcoding the symlinks to add, do one per mach-o as
   needed

TEMP no -L no script
This commit is contained in:
John Ericson
2017-12-25 16:36:47 +00:00
committed by Domen Kožar
parent 150255e318
commit b6867f71f4
2 changed files with 8 additions and 18 deletions
@@ -106,15 +106,10 @@ stdenv.mkDerivation rec {
-exec patchelf --set-rpath "${libPath}" {} \; -exec patchelf --set-rpath "${libPath}" {} \;
'' + stdenv.lib.optionalString stdenv.isDarwin '' '' + stdenv.lib.optionalString stdenv.isDarwin ''
# not enough room in the object files for the full path to libiconv :( # not enough room in the object files for the full path to libiconv :(
ln -s ${libiconv}/lib/libiconv.dylib $out/bin for exe in $(find "$out" -type f -executable); do
ln -s ${libiconv}/lib/libiconv.dylib $out/lib/ghc-${version}/libiconv.dylib isScript $exe && continue
ln -fs ${libiconv}/lib/libiconv.dylib $(dirname $exe)/libiconv.dylib
fix () { install_name_tool -change /usr/lib/libiconv.2.dylib @executable_path/libiconv.dylib $exe
install_name_tool -change /usr/lib/libiconv.2.dylib @executable_path/libiconv.dylib $1
}
for file in ghc-cabal ghc-pwd ghc-stage2 ghc-pkg haddock hsc2hs hpc; do
fix $(find "$out" -type f -name $file)
done done
for file in $(find "$out" -name setup-config); do for file in $(find "$out" -name setup-config); do
@@ -107,15 +107,10 @@ stdenv.mkDerivation rec {
-exec patchelf --set-rpath "${libPath}" {} \; -exec patchelf --set-rpath "${libPath}" {} \;
'' + stdenv.lib.optionalString stdenv.isDarwin '' '' + stdenv.lib.optionalString stdenv.isDarwin ''
# not enough room in the object files for the full path to libiconv :( # not enough room in the object files for the full path to libiconv :(
ln -s ${libiconv}/lib/libiconv.dylib $out/bin for exe in $(find "$out" -type f -executable); do
ln -s ${libiconv}/lib/libiconv.dylib $out/lib/ghc-${version}/libiconv.dylib isScript $exe && continue
ln -fs ${libiconv}/lib/libiconv.dylib $(dirname $exe)/libiconv.dylib
fix () { install_name_tool -change /usr/lib/libiconv.2.dylib @executable_path/libiconv.dylib $exe
install_name_tool -change /usr/lib/libiconv.2.dylib @executable_path/libiconv.dylib $1
}
for file in ghc-cabal ghc-pwd ghc-stage2 ghc-pkg haddock hsc2hs hpc; do
fix $(find "$out" -type f -name $file)
done done
for file in $(find "$out" -name setup-config); do for file in $(find "$out" -name setup-config); do