git.iko.soy/typeable/nixpkgs
on master help sign in
Merge pull request #166548 from sternenseemann/fix-ghclibdir-computation

[haskell-updates] ghcWithPackages: fix ghclibdir computation with variantSuffix

commit103d1715266565fa872d690da7ff4b3daef0c13a authorsternenseemann <sternenseemann@systemli.org> dateSun 3 Apr 2022, 14:22 (5 years ago) parent038d0d86016ed5
4 files changed+15−13
nixos/modules/services/misc/gitit.nix+1−1 pkgs/development/haskell-modules/configuration-common.nix+3−3 pkgs/development/haskell-modules/generic-builder.nix+7−5 pkgs/development/haskell-modules/with-packages-wrapper.nix+4−4
nixos/modules/services/misc/gitit.nix+1−1
@@ -10,7 +10,7 @@ let
1010
1111 toYesNo = b: if b then "yes" else "no";
1212
13− gititShared = with cfg.haskellPackages; gitit + "/share/" + pkgs.stdenv.hostPlatform.system + "-" + ghc.name + "/" + gitit.pname + "-" + gitit.version;
13+ gititShared = with cfg.haskellPackages; gitit + "/share/" + ghc.targetPrefix + ghc.haskellCompilerName + "/" + gitit.pname + "-" + gitit.version;
1414
1515 gititWithPkgs = hsPkgs: extras: hsPkgs.ghcWithPackages (self: with self; [ gitit ] ++ (extras self));
1616
pkgs/development/haskell-modules/configuration-common.nix+3−3
@@ -619,7 +619,7 @@ self: super: {
619619 doCheck = false; # https://github.com/kazu-yamamoto/ghc-mod/issues/335
620620 executableToolDepends = drv.executableToolDepends or [] ++ [pkgs.buildPackages.emacs];
621621 postInstall = ''
622− local lispdir=( "$data/share/${self.ghc.name}/*/${drv.pname}-${drv.version}/elisp" )
622+ local lispdir=( "$data/share/${self.ghc.targetPrefix}${self.ghc.haskellCompilerName}/*/${drv.pname}-${drv.version}/elisp" )
623623 make -C $lispdir
624624 mkdir -p $data/share/emacs/site-lisp
625625 ln -s "$lispdir/"*.el{,c} $data/share/emacs/site-lisp/
@@ -654,7 +654,7 @@ self: super: {
654654 # cannot easily byte-compile these files, unfortunately, because they
655655 # depend on a new version of haskell-mode that we don't have yet.
656656 postInstall = ''
657− local lispdir=( "$data/share/${self.ghc.name}/"*"/${drv.pname}-"*"/elisp" )
657+ local lispdir=( "$data/share/${self.ghc.targetPrefix}${self.ghc.haskellCompilerName}/"*"/${drv.pname}-"*"/elisp" )
658658 mkdir -p $data/share/emacs
659659 ln -s $lispdir $data/share/emacs/site-lisp
660660 '';
@@ -665,7 +665,7 @@ self: super: {
665665 # We cannot easily byte-compile these files, unfortunately, because they
666666 # depend on a new version of haskell-mode that we don't have yet.
667667 postInstall = ''
668− local lispdir=( "$data/share/${self.ghc.name}/"*"/${drv.pname}-"*"/elisp" )
668+ local lispdir=( "$data/share/${self.ghc.targetPrefix}${self.ghc.haskellCompilerName}/"*"/${drv.pname}-"*"/elisp" )
669669 mkdir -p $data/share/emacs
670670 ln -s $lispdir $data/share/emacs/site-lisp
671671 '';
pkgs/development/haskell-modules/generic-builder.nix+7−5
@@ -196,13 +196,13 @@ let
196196 "--prefix=$out"
197197 "--libdir=\\$prefix/lib/\\$compiler"
198198 "--libsubdir=\\$abi/\\$libname"
199− (optionalString enableSeparateDataOutput "--datadir=$data/share/${ghc.name}")
199+ (optionalString enableSeparateDataOutput "--datadir=$data/share/${ghcNameWithPrefix}")
200200 (optionalString enableSeparateDocOutput "--docdir=${docdir "$doc"}")
201201 ] ++ optionals stdenv.hasCC [
202202 "--with-gcc=$CC" # Clang won't work without that extra information.
203203 ] ++ [
204204 "--package-db=$packageConfDir"
205− (optionalString (enableSharedExecutables && stdenv.isLinux) "--ghc-option=-optl=-Wl,-rpath=$out/lib/${ghc.name}/${pname}-${version}")
205+ (optionalString (enableSharedExecutables && stdenv.isLinux) "--ghc-option=-optl=-Wl,-rpath=$out/lib/${ghcNameWithPrefix}/${pname}-${version}")
206206 (optionalString (enableSharedExecutables && stdenv.isDarwin) "--ghc-option=-optl=-Wl,-headerpad_max_install_names")
207207 (optionalString enableParallelBuilding "--ghc-options=${parallelBuildingFlags}")
208208 (optionalString useCpphs "--with-cpphs=${cpphs}/bin/cpphs --ghc-options=-cpp --ghc-options=-pgmP${cpphs}/bin/cpphs --ghc-options=-optP--cpp")
@@ -275,6 +275,8 @@ let
275275 ghcCommand' = if isGhcjs then "ghcjs" else "ghc";
276276 ghcCommand = "${ghc.targetPrefix}${ghcCommand'}";
277277
278+ ghcNameWithPrefix = "${ghc.targetPrefix}${ghc.haskellCompilerName}";
279+
278280 nativeGhcCommand = "${nativeGhc.targetPrefix}ghc";
279281
280282 buildPkgDb = ghcName: packageConfDir: ''
@@ -350,14 +352,14 @@ stdenv.mkDerivation ({
350352 # pkgs* arrays defined in stdenv/setup.hs
351353 + ''
352354 for p in "''${pkgsBuildBuild[@]}" "''${pkgsBuildHost[@]}" "''${pkgsBuildTarget[@]}"; do
353− ${buildPkgDb nativeGhc.name "$setupPackageConfDir"}
355+ ${buildPkgDb "${nativeGhcCommand}-${nativeGhc.version}" "$setupPackageConfDir"}
354356 done
355357 ${nativeGhcCommand}-pkg --${nativePackageDbFlag}="$setupPackageConfDir" recache
356358 ''
357359 # For normal components
358360 + ''
359361 for p in "''${pkgsHostHost[@]}" "''${pkgsHostTarget[@]}"; do
360− ${buildPkgDb ghc.name "$packageConfDir"}
362+ ${buildPkgDb ghcNameWithPrefix "$packageConfDir"}
361363 if [ -d "$p/include" ]; then
362364 configureFlags+=" --extra-include-dirs=$p/include"
363365 fi
@@ -494,7 +496,7 @@ stdenv.mkDerivation ({
494496 # just the target specified; "install" will error here, since not all targets have been built.
495497 else ''
496498 ${setupCommand} copy ${buildTarget}
497− local packageConfDir="$out/lib/${ghc.name}/package.conf.d"
499+ local packageConfDir="$out/lib/${ghcNameWithPrefix}/package.conf.d"
498500 local packageConfFile="$packageConfDir/${pname}-${version}.conf"
499501 mkdir -p "$packageConfDir"
500502 ${setupCommand} register --gen-pkg-config=$packageConfFile
pkgs/development/haskell-modules/with-packages-wrapper.nix+4−4
@@ -51,7 +51,7 @@ let
5151 ghcCommand = "${ghc.targetPrefix}${ghcCommand'}";
5252 ghcCommandCaps= lib.toUpper ghcCommand';
5353 libDir = if isHaLVM then "$out/lib/HaLVM-${ghc.version}"
54− else "$out/lib/${ghcCommand}-${ghc.version}";
54+ else "$out/lib/${ghc.targetPrefix}${ghc.haskellCompilerName}";
5555 docDir = "$out/share/doc/ghc/html";
5656 packageCfgDir = "${libDir}/package.conf.d";
5757 paths = lib.filter (x: x ? isHaskellLibrary) (lib.closePropagation packages);
@@ -121,7 +121,7 @@ symlinkJoin {
121121
122122 '' + (lib.optionalString (stdenv.targetPlatform.isDarwin && !isGhcjs && !stdenv.targetPlatform.isiOS) ''
123123 # Work around a linker limit in macOS Sierra (see generic-builder.nix):
124− local packageConfDir="$out/lib/${ghc.name}/package.conf.d";
124+ local packageConfDir="${packageCfgDir}";
125125 local dynamicLinksDir="$out/lib/links"
126126 mkdir -p $dynamicLinksDir
127127 # Clean up the old links that may have been (transitively) included by
@@ -148,8 +148,8 @@ symlinkJoin {
148148 # to another nix derivation, so they are not writable. Removing
149149 # them allow the correct behavior of ghc-pkg recache
150150 # See: https://github.com/NixOS/nixpkgs/issues/79441
151− rm $out/lib/${ghc.name}/package.conf.d/package.cache.lock
152− rm $out/lib/${ghc.name}/package.conf.d/package.cache
151+ rm ${packageCfgDir}/package.cache.lock
152+ rm ${packageCfgDir}/package.cache
153153
154154 $out/bin/${ghcCommand}-pkg recache
155155 ''}