about summary refs log tree commit diff
path: root/pkgs/development/haskell-modules/generic-builder.nix
diff options
context:
space:
mode:
authorsternenseemann <sternenseemann@systemli.org>2022-03-31 12:47:54 +0200
committersternenseemann <sternenseemann@systemli.org>2022-03-31 12:47:54 +0200
commit78a93b5352a26bbbad4a9f22f0fcdaf76f5dc176 (patch)
treebb0d40fdffe740913cb9d0a4804d2b5dc593750b /pkgs/development/haskell-modules/generic-builder.nix
parent383fbfadccaa12f908f79ab83f21fa5dbe10c6be (diff)
downloadnixlib-78a93b5352a26bbbad4a9f22f0fcdaf76f5dc176.tar
nixlib-78a93b5352a26bbbad4a9f22f0fcdaf76f5dc176.tar.gz
nixlib-78a93b5352a26bbbad4a9f22f0fcdaf76f5dc176.tar.bz2
nixlib-78a93b5352a26bbbad4a9f22f0fcdaf76f5dc176.tar.lz
nixlib-78a93b5352a26bbbad4a9f22f0fcdaf76f5dc176.tar.xz
nixlib-78a93b5352a26bbbad4a9f22f0fcdaf76f5dc176.tar.zst
nixlib-78a93b5352a26bbbad4a9f22f0fcdaf76f5dc176.zip
haskellPackages.mkDerivation: get ghclibdir via haskellCompilerName
This is the correctest and clearest way to do it I can think of at the
moment that doesn't need us to add anything.
"${ghcCommand}-${ghc.version}" also works, but is clunkier and harder to
replicate for downstream users.
Diffstat (limited to 'pkgs/development/haskell-modules/generic-builder.nix')
-rw-r--r--pkgs/development/haskell-modules/generic-builder.nix12
1 files changed, 7 insertions, 5 deletions
diff --git a/pkgs/development/haskell-modules/generic-builder.nix b/pkgs/development/haskell-modules/generic-builder.nix
index 04973d3251e6..f63533137030 100644
--- a/pkgs/development/haskell-modules/generic-builder.nix
+++ b/pkgs/development/haskell-modules/generic-builder.nix
@@ -195,13 +195,13 @@ let
     "--prefix=$out"
     "--libdir=\\$prefix/lib/\\$compiler"
     "--libsubdir=\\$abi/\\$libname"
-    (optionalString enableSeparateDataOutput "--datadir=$data/share/${ghc.name}")
+    (optionalString enableSeparateDataOutput "--datadir=$data/share/${ghcNameWithPrefix}")
     (optionalString enableSeparateDocOutput "--docdir=${docdir "$doc"}")
   ] ++ optionals stdenv.hasCC [
     "--with-gcc=$CC" # Clang won't work without that extra information.
   ] ++ [
     "--package-db=$packageConfDir"
-    (optionalString (enableSharedExecutables && stdenv.isLinux) "--ghc-option=-optl=-Wl,-rpath=$out/lib/${ghc.name}/${pname}-${version}")
+    (optionalString (enableSharedExecutables && stdenv.isLinux) "--ghc-option=-optl=-Wl,-rpath=$out/lib/${ghcNameWithPrefix}/${pname}-${version}")
     (optionalString (enableSharedExecutables && stdenv.isDarwin) "--ghc-option=-optl=-Wl,-headerpad_max_install_names")
     (optionalString enableParallelBuilding "--ghc-options=${parallelBuildingFlags}")
     (optionalString useCpphs "--with-cpphs=${cpphs}/bin/cpphs --ghc-options=-cpp --ghc-options=-pgmP${cpphs}/bin/cpphs --ghc-options=-optP--cpp")
@@ -274,6 +274,8 @@ let
   ghcCommand' = if isGhcjs then "ghcjs" else "ghc";
   ghcCommand = "${ghc.targetPrefix}${ghcCommand'}";
 
+  ghcNameWithPrefix = "${ghc.targetPrefix}${ghc.haskellCompilerName}";
+
   nativeGhcCommand = "${nativeGhc.targetPrefix}ghc";
 
   buildPkgDb = ghcName: packageConfDir: ''
@@ -349,14 +351,14 @@ stdenv.mkDerivation ({
   # pkgs* arrays defined in stdenv/setup.hs
   + ''
     for p in "''${pkgsBuildBuild[@]}" "''${pkgsBuildHost[@]}" "''${pkgsBuildTarget[@]}"; do
-      ${buildPkgDb nativeGhc.name "$setupPackageConfDir"}
+      ${buildPkgDb "${nativeGhcCommand}-${nativeGhc.version}" "$setupPackageConfDir"}
     done
     ${nativeGhcCommand}-pkg --${nativePackageDbFlag}="$setupPackageConfDir" recache
   ''
   # For normal components
   + ''
     for p in "''${pkgsHostHost[@]}" "''${pkgsHostTarget[@]}"; do
-      ${buildPkgDb ghc.name "$packageConfDir"}
+      ${buildPkgDb ghcNameWithPrefix "$packageConfDir"}
       if [ -d "$p/include" ]; then
         configureFlags+=" --extra-include-dirs=$p/include"
       fi
@@ -493,7 +495,7 @@ stdenv.mkDerivation ({
       # just the target specified; "install" will error here, since not all targets have been built.
     else ''
       ${setupCommand} copy ${buildTarget}
-      local packageConfDir="$out/lib/${ghc.name}/package.conf.d"
+      local packageConfDir="$out/lib/${ghcNameWithPrefix}/package.conf.d"
       local packageConfFile="$packageConfDir/${pname}-${version}.conf"
       mkdir -p "$packageConfDir"
       ${setupCommand} register --gen-pkg-config=$packageConfFile