Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion nixos/modules/services/misc/gitit.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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));

Expand Down
6 changes: 3 additions & 3 deletions pkgs/development/haskell-modules/configuration-common.nix
Original file line number Diff line number Diff line change
Expand Up @@ -613,7 +613,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/
Expand Down Expand Up @@ -648,7 +648,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
'';
Expand All @@ -659,7 +659,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
'';
Expand Down
12 changes: 7 additions & 5 deletions pkgs/development/haskell-modules/generic-builder.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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: ''
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions pkgs/development/haskell-modules/with-packages-wrapper.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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
Expand All @@ -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
''}
Expand Down