diff options
author | sternenseemann <sternenseemann@systemli.org> | 2023-01-22 02:12:17 +0100 |
---|---|---|
committer | sternenseemann <sternenseemann@systemli.org> | 2023-02-05 14:01:25 +0100 |
commit | a9b8a272ea8c9ce1a13dd49af679ebc2b31626bd (patch) | |
tree | d6ef9b2960cda2bcd65a94995de34252463b48fa /pkgs/development/haskell-modules/generic-builder.nix | |
parent | 18c0c48857f550e3b85bc51390593f1c0a4aa2bd (diff) | |
download | nixpkgs-a9b8a272ea8c9ce1a13dd49af679ebc2b31626bd.tar nixpkgs-a9b8a272ea8c9ce1a13dd49af679ebc2b31626bd.tar.gz nixpkgs-a9b8a272ea8c9ce1a13dd49af679ebc2b31626bd.tar.bz2 nixpkgs-a9b8a272ea8c9ce1a13dd49af679ebc2b31626bd.tar.lz nixpkgs-a9b8a272ea8c9ce1a13dd49af679ebc2b31626bd.tar.xz nixpkgs-a9b8a272ea8c9ce1a13dd49af679ebc2b31626bd.tar.zst nixpkgs-a9b8a272ea8c9ce1a13dd49af679ebc2b31626bd.zip |
haskellPackages.mkDerivation: refactor libdir calculation
Diffstat (limited to 'pkgs/development/haskell-modules/generic-builder.nix')
-rw-r--r-- | pkgs/development/haskell-modules/generic-builder.nix | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/pkgs/development/haskell-modules/generic-builder.nix b/pkgs/development/haskell-modules/generic-builder.nix index 5cb44f35a06..fc3af476a3b 100644 --- a/pkgs/development/haskell-modules/generic-builder.nix +++ b/pkgs/development/haskell-modules/generic-builder.nix @@ -199,6 +199,7 @@ let defaultConfigureFlags = [ "--verbose" "--prefix=$out" + # Note: This must be kept in sync manually with mkGhcLibdir "--libdir=\\$prefix/lib/\\$compiler" "--libsubdir=\\$abi/\\$libname" (optionalString enableSeparateDataOutput "--datadir=$data/share/${ghcNameWithPrefix}") @@ -207,7 +208,7 @@ let "--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/${ghcNameWithPrefix}/${pname}-${version}") + (optionalString (enableSharedExecutables && stdenv.isLinux) "--ghc-option=-optl=-Wl,-rpath=$out/${ghcLibdir}/${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") @@ -284,6 +285,8 @@ let ghcCommand = "${ghc.targetPrefix}${ghcCommand'}"; ghcNameWithPrefix = "${ghc.targetPrefix}${ghc.haskellCompilerName}"; + mkGhcLibdir = ghc: "lib/${ghc.targetPrefix}${ghc.haskellCompilerName}"; + ghcLibdir = mkGhcLibdir ghc; nativeGhcCommand = "${nativeGhc.targetPrefix}ghc"; @@ -297,8 +300,8 @@ let # we compile with it, and doing so can result in having multiple copies of # e.g. Cabal in the database with the same name and version, which is # ambiguous. - if [ -d "$p/lib/${thisGhc.haskellCompilerName}/package.conf.d" ] && [ "$p" != "${ghc}" ] && [ "$p" != "${nativeGhc}" ]; then - cp -f "$p/lib/${thisGhc.haskellCompilerName}/package.conf.d/"*.conf ${packageConfDir}/ + if [ -d "$p/${mkGhcLibdir thisGhc}/package.conf.d" ] && [ "$p" != "${ghc}" ] && [ "$p" != "${nativeGhc}" ]; then + cp -f "$p/${mkGhcLibdir thisGhc}/package.conf.d/"*.conf ${packageConfDir}/ continue fi ''; @@ -510,7 +513,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/${ghcNameWithPrefix}/package.conf.d" + local packageConfDir="$out/${ghcLibdir}/package.conf.d" local packageConfFile="$packageConfDir/${pname}-${version}.conf" mkdir -p "$packageConfDir" ${setupCommand} register --gen-pkg-config=$packageConfFile @@ -539,7 +542,7 @@ stdenv.mkDerivation ({ ${optionalString doCoverage "mkdir -p $out/share && cp -r dist/hpc $out/share"} ${optionalString (enableSharedExecutables && isExecutable && !isGhcjs && stdenv.isDarwin && lib.versionOlder ghc.version "7.10") '' for exe in "${binDir}/"* ; do - install_name_tool -add_rpath "$out/lib/ghc-${ghc.version}/${pname}-${version}" "$exe" + install_name_tool -add_rpath "$out/${ghcLibdir}/${pname}-${version}" "$exe" done ''} @@ -675,7 +678,7 @@ stdenv.mkDerivation ({ "NIX_${ghcCommandCaps}_DOCDIR" = "${ghcEnv}/share/doc/ghc/html"; "NIX_${ghcCommandCaps}_LIBDIR" = if ghc.isHaLVM or false then "${ghcEnv}/lib/HaLVM-${ghc.version}" - else "${ghcEnv}/lib/${ghcCommand}-${ghc.version}"; + else "${ghcEnv}/${ghcLibdir}"; }); env = envFunc { }; |