about summary refs log tree commit diff
path: root/pkgs/development/haskell-modules
diff options
context:
space:
mode:
authorIan-Woo Kim <ianwookim@gmail.com>2023-04-03 14:33:07 -0700
committerIan-Woo Kim <ianwookim@gmail.com>2023-06-14 10:04:56 -0700
commitb1600b56721473fb1f779ff49311afa7a8d498e2 (patch)
tree13a6ac074ff358f156adacb311cdf82786f58531 /pkgs/development/haskell-modules
parent91c754d38151fb0330891177e8f3d4979cd552bf (diff)
downloadnixlib-b1600b56721473fb1f779ff49311afa7a8d498e2.tar
nixlib-b1600b56721473fb1f779ff49311afa7a8d498e2.tar.gz
nixlib-b1600b56721473fb1f779ff49311afa7a8d498e2.tar.bz2
nixlib-b1600b56721473fb1f779ff49311afa7a8d498e2.tar.lz
nixlib-b1600b56721473fb1f779ff49311afa7a8d498e2.tar.xz
nixlib-b1600b56721473fb1f779ff49311afa7a8d498e2.tar.zst
nixlib-b1600b56721473fb1f779ff49311afa7a8d498e2.zip
ghcWithPackages: handle the boot dylib links separately for GHC 9.6
From GHC 9.6 on, the boot libraries (dependencies of the ghc library) are
present in a separate directory after the installation, and thus the
wrapper environment provided by ghcWithPackages needs to handle the links
to the boot dynamic libraries separately than other ordinary ones.
Diffstat (limited to 'pkgs/development/haskell-modules')
-rw-r--r--pkgs/development/haskell-modules/with-packages-wrapper.nix14
1 files changed, 13 insertions, 1 deletions
diff --git a/pkgs/development/haskell-modules/with-packages-wrapper.nix b/pkgs/development/haskell-modules/with-packages-wrapper.nix
index 34eb2b71d759..78e0bb91232e 100644
--- a/pkgs/development/haskell-modules/with-packages-wrapper.nix
+++ b/pkgs/development/haskell-modules/with-packages-wrapper.nix
@@ -55,6 +55,12 @@ let
   libDir        = if isHaLVM then "$out/lib/HaLVM-${ghc.version}"
                   else "$out/lib/${ghc.targetPrefix}${ghc.haskellCompilerName}"
                     + lib.optionalString (ghc ? hadrian) "/lib";
+  # Boot libraries for GHC are present in a separate directory.
+  bootLibDir    = let arch = if stdenv.targetPlatform.isAarch64
+                             then "aarch64"
+                             else "x86_64";
+                      platform = if stdenv.targetPlatform.isDarwin then "osx" else "linux";
+                  in "${ghc}/lib/${ghc.haskellCompilerName}/lib/${arch}-${platform}-${ghc.haskellCompilerName}";
   docDir        = "$out/share/doc/ghc/html";
   packageCfgDir = "${libDir}/package.conf.d";
   paths         = lib.concatLists (
@@ -131,11 +137,17 @@ symlinkJoin {
   '' + (lib.optionalString (stdenv.targetPlatform.isDarwin && !isGhcjs && !stdenv.targetPlatform.isiOS) ''
     # Work around a linker limit in macOS Sierra (see generic-builder.nix):
     local packageConfDir="${packageCfgDir}";
-    local dynamicLinksDir="$out/lib/links"
+    local dynamicLinksDir="$out/lib/links";
     mkdir -p $dynamicLinksDir
     # Clean up the old links that may have been (transitively) included by
     # symlinkJoin:
     rm -f $dynamicLinksDir/*
+
+    # Boot libraries are located differently than other libraries since GHC 9.6, so handle them separately.
+    if [[ -x "${bootLibDir}" ]]; then
+      ln -s "${bootLibDir}"/*.dylib $dynamicLinksDir
+    fi
+
     for d in $(grep -Poz "dynamic-library-dirs:\s*\K .+\n" $packageConfDir/*|awk '{print $2}'|sort -u); do
       ln -s $d/*.dylib $dynamicLinksDir
     done