From b6867f71f4d20e544372114350f00ceb1fdca74a Mon Sep 17 00:00:00 2001 From: John Ericson Date: Sat, 23 Sep 2017 10:13:21 -0400 Subject: [PATCH] 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 --- pkgs/development/compilers/ghc/7.0.4-binary.nix | 13 ++++--------- pkgs/development/compilers/ghc/7.4.2-binary.nix | 13 ++++--------- 2 files changed, 8 insertions(+), 18 deletions(-) diff --git a/pkgs/development/compilers/ghc/7.0.4-binary.nix b/pkgs/development/compilers/ghc/7.0.4-binary.nix index bb592a6cfe3..c518c67d16b 100644 --- a/pkgs/development/compilers/ghc/7.0.4-binary.nix +++ b/pkgs/development/compilers/ghc/7.0.4-binary.nix @@ -106,15 +106,10 @@ stdenv.mkDerivation rec { -exec patchelf --set-rpath "${libPath}" {} \; '' + stdenv.lib.optionalString stdenv.isDarwin '' # not enough room in the object files for the full path to libiconv :( - ln -s ${libiconv}/lib/libiconv.dylib $out/bin - ln -s ${libiconv}/lib/libiconv.dylib $out/lib/ghc-${version}/libiconv.dylib - - fix () { - 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) + for exe in $(find "$out" -type f -executable); do + isScript $exe && continue + ln -fs ${libiconv}/lib/libiconv.dylib $(dirname $exe)/libiconv.dylib + install_name_tool -change /usr/lib/libiconv.2.dylib @executable_path/libiconv.dylib $exe done for file in $(find "$out" -name setup-config); do diff --git a/pkgs/development/compilers/ghc/7.4.2-binary.nix b/pkgs/development/compilers/ghc/7.4.2-binary.nix index 65a3d2a7f73..3cb28e2c820 100644 --- a/pkgs/development/compilers/ghc/7.4.2-binary.nix +++ b/pkgs/development/compilers/ghc/7.4.2-binary.nix @@ -107,15 +107,10 @@ stdenv.mkDerivation rec { -exec patchelf --set-rpath "${libPath}" {} \; '' + stdenv.lib.optionalString stdenv.isDarwin '' # not enough room in the object files for the full path to libiconv :( - ln -s ${libiconv}/lib/libiconv.dylib $out/bin - ln -s ${libiconv}/lib/libiconv.dylib $out/lib/ghc-${version}/libiconv.dylib - - fix () { - 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) + for exe in $(find "$out" -type f -executable); do + isScript $exe && continue + ln -fs ${libiconv}/lib/libiconv.dylib $(dirname $exe)/libiconv.dylib + install_name_tool -change /usr/lib/libiconv.2.dylib @executable_path/libiconv.dylib $exe done for file in $(find "$out" -name setup-config); do