about summary refs log tree commit diff
path: root/pkgs/development/haskell-modules
diff options
context:
space:
mode:
authorBen Siraphob <bensiraphob@gmail.com>2023-06-28 19:22:50 +0700
committerGitHub <noreply@github.com>2023-06-28 19:22:50 +0700
commit6eb5c1b5bacbb28804abbb5f4421003b34333685 (patch)
treef956fcc7224b521d9c353fa940d78c2754e845eb /pkgs/development/haskell-modules
parent5c13477d4013c89f97244facc56957e11d8e634e (diff)
parent77504c6a1e05a5434e7c831bae405e89acae4edf (diff)
downloadnixlib-6eb5c1b5bacbb28804abbb5f4421003b34333685.tar
nixlib-6eb5c1b5bacbb28804abbb5f4421003b34333685.tar.gz
nixlib-6eb5c1b5bacbb28804abbb5f4421003b34333685.tar.bz2
nixlib-6eb5c1b5bacbb28804abbb5f4421003b34333685.tar.lz
nixlib-6eb5c1b5bacbb28804abbb5f4421003b34333685.tar.xz
nixlib-6eb5c1b5bacbb28804abbb5f4421003b34333685.tar.zst
nixlib-6eb5c1b5bacbb28804abbb5f4421003b34333685.zip
Merge pull request #224542 from wavewave/ghcWithPackages-ghc96-fix
Diffstat (limited to 'pkgs/development/haskell-modules')
-rw-r--r--pkgs/development/haskell-modules/with-packages-wrapper.nix16
1 files changed, 14 insertions, 2 deletions
diff --git a/pkgs/development/haskell-modules/with-packages-wrapper.nix b/pkgs/development/haskell-modules/with-packages-wrapper.nix
index 34eb2b71d759..03f59302a0d3 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
@@ -146,7 +158,7 @@ symlinkJoin {
       # $dynamicLinksDir
       cp $f $f-tmp
       rm $f
-      sed "N;s,dynamic-library-dirs:\s*.*,dynamic-library-dirs: $dynamicLinksDir," $f-tmp > $f
+      sed "N;s,dynamic-library-dirs:\s*.*\n,dynamic-library-dirs: $dynamicLinksDir\n," $f-tmp > $f
       rm $f-tmp
     done
   '') + ''