Merge pull request #166548 from sternenseemann/fix-ghclibdir-computation

[haskell-updates] ghcWithPackages: fix ghclibdir computation with variantSuffix
This commit is contained in:
sternenseemann 2022-04-03 14:22:34 +02:00 committed by GitHub
commit 103d171526
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 15 additions and 13 deletions

View file

@ -10,7 +10,7 @@ let
toYesNo = b: if b then "yes" else "no";
gititShared = with cfg.haskellPackages; gitit + "/share/" + pkgs.stdenv.hostPlatform.system + "-" + ghc.name + "/" + gitit.pname + "-" + gitit.version;
gititShared = with cfg.haskellPackages; gitit + "/share/" + ghc.targetPrefix + ghc.haskellCompilerName + "/" + gitit.pname + "-" + gitit.version;
gititWithPkgs = hsPkgs: extras: hsPkgs.ghcWithPackages (self: with self; [ gitit ] ++ (extras self));

View file

@ -619,7 +619,7 @@ self: super: {
doCheck = false; # https://github.com/kazu-yamamoto/ghc-mod/issues/335
executableToolDepends = drv.executableToolDepends or [] ++ [pkgs.buildPackages.emacs];
postInstall = ''
local lispdir=( "$data/share/${self.ghc.name}/*/${drv.pname}-${drv.version}/elisp" )
local lispdir=( "$data/share/${self.ghc.targetPrefix}${self.ghc.haskellCompilerName}/*/${drv.pname}-${drv.version}/elisp" )
make -C $lispdir
mkdir -p $data/share/emacs/site-lisp
ln -s "$lispdir/"*.el{,c} $data/share/emacs/site-lisp/
@ -654,7 +654,7 @@ self: super: {
# cannot easily byte-compile these files, unfortunately, because they
# depend on a new version of haskell-mode that we don't have yet.
postInstall = ''
local lispdir=( "$data/share/${self.ghc.name}/"*"/${drv.pname}-"*"/elisp" )
local lispdir=( "$data/share/${self.ghc.targetPrefix}${self.ghc.haskellCompilerName}/"*"/${drv.pname}-"*"/elisp" )
mkdir -p $data/share/emacs
ln -s $lispdir $data/share/emacs/site-lisp
'';
@ -665,7 +665,7 @@ self: super: {
# We cannot easily byte-compile these files, unfortunately, because they
# depend on a new version of haskell-mode that we don't have yet.
postInstall = ''
local lispdir=( "$data/share/${self.ghc.name}/"*"/${drv.pname}-"*"/elisp" )
local lispdir=( "$data/share/${self.ghc.targetPrefix}${self.ghc.haskellCompilerName}/"*"/${drv.pname}-"*"/elisp" )
mkdir -p $data/share/emacs
ln -s $lispdir $data/share/emacs/site-lisp
'';

View file

@ -196,13 +196,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")
@ -275,6 +275,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: ''
@ -350,14 +352,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
@ -494,7 +496,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

View file

@ -51,7 +51,7 @@ let
ghcCommand = "${ghc.targetPrefix}${ghcCommand'}";
ghcCommandCaps= lib.toUpper ghcCommand';
libDir = if isHaLVM then "$out/lib/HaLVM-${ghc.version}"
else "$out/lib/${ghcCommand}-${ghc.version}";
else "$out/lib/${ghc.targetPrefix}${ghc.haskellCompilerName}";
docDir = "$out/share/doc/ghc/html";
packageCfgDir = "${libDir}/package.conf.d";
paths = lib.filter (x: x ? isHaskellLibrary) (lib.closePropagation packages);
@ -121,7 +121,7 @@ symlinkJoin {
'' + (lib.optionalString (stdenv.targetPlatform.isDarwin && !isGhcjs && !stdenv.targetPlatform.isiOS) ''
# Work around a linker limit in macOS Sierra (see generic-builder.nix):
local packageConfDir="$out/lib/${ghc.name}/package.conf.d";
local packageConfDir="${packageCfgDir}";
local dynamicLinksDir="$out/lib/links"
mkdir -p $dynamicLinksDir
# Clean up the old links that may have been (transitively) included by
@ -148,8 +148,8 @@ symlinkJoin {
# to another nix derivation, so they are not writable. Removing
# them allow the correct behavior of ghc-pkg recache
# See: https://github.com/NixOS/nixpkgs/issues/79441
rm $out/lib/${ghc.name}/package.conf.d/package.cache.lock
rm $out/lib/${ghc.name}/package.conf.d/package.cache
rm ${packageCfgDir}/package.cache.lock
rm ${packageCfgDir}/package.cache
$out/bin/${ghcCommand}-pkg recache
''}