From 461b7bb9813a50a43b434f1cfa6f50abf133fba8 Mon Sep 17 00:00:00 2001 From: Moritz Angermann Date: Sun, 10 Jun 2018 08:11:55 +0800 Subject: [PATCH] Stop haskell from generating $out/lib. Nix cc logic relies on passing /lib for each dependency as a library search path. This makes little sense for haskell packages, as their libs are nested deeply in the /lib tree. Also GHC will generate the right library serach paths on its own from the package database entries. The larger issue though is that with one search path entry for each library, and a similar one generated by GHC for each dependency will eventually overflow the command line argument limits. As such we do *not* put haskell libraries into $out anymore. --- pkgs/development/haskell-modules/generic-builder.nix | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/pkgs/development/haskell-modules/generic-builder.nix b/pkgs/development/haskell-modules/generic-builder.nix index 2d966af47ad..f00c0197af3 100644 --- a/pkgs/development/haskell-modules/generic-builder.nix +++ b/pkgs/development/haskell-modules/generic-builder.nix @@ -131,12 +131,12 @@ let buildFlagsString = optionalString (buildFlags != []) (" " + concatStringsSep " " buildFlags); defaultConfigureFlags = [ - "--verbose" "--prefix=$out" "--libdir=\\$prefix/lib/\\$compiler" "--libsubdir=\\$pkgid" + "--verbose" "--prefix=$out" "--libdir=\\$prefix/\\$compiler" "--libsubdir=\\$pkgid" (optionalString enableSeparateDataOutput "--datadir=$data/share/${ghc.name}") (optionalString enableSeparateDocOutput "--docdir=${docdir "$doc"}") "--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/${ghc.name}/${pname}-${version}") (optionalString (enableSharedExecutables && stdenv.isDarwin) "--ghc-option=-optl=-Wl,-headerpad_max_install_names") (optionalString enableParallelBuilding "--ghc-option=-j$NIX_BUILD_CORES") (optionalString useCpphs "--with-cpphs=${cpphs}/bin/cpphs --ghc-options=-cpp --ghc-options=-pgmP${cpphs}/bin/cpphs --ghc-options=-optP--cpp") @@ -251,7 +251,7 @@ stdenv.mkDerivation ({ setupCompilerEnvironmentPhase = (optionalString doVerbose '' - set -x + # set -x '') + '' runHook preSetupCompilerEnvironment @@ -271,9 +271,9 @@ stdenv.mkDerivation ({ for p in "''${pkgsHostHost[@]}" "''${pkgsHostTarget[@]}"; do ${optionalString doVerbose '' echo $p - echo $p/lib/${ghc.name}/package.conf.d - ''}if [ -d "$p/lib/${ghc.name}/package.conf.d" ]; then - cp -f "$p/lib/${ghc.name}/package.conf.d/"*.conf $packageConfDir/ + echo $p/${ghc.name}/package.conf.d + ''}if [ -d "$p/${ghc.name}/package.conf.d" ]; then + cp -f "$p/${ghc.name}/package.conf.d/"*.conf $packageConfDir/ continue fi if [ -d "$p/include" ]; then @@ -348,7 +348,7 @@ stdenv.mkDerivation ({ buildPhase = '' runHook preBuild - ${setupCommand} build ${buildTarget}${crossCabalFlagsString}${buildFlagsString}${optionalString doVerbose " -v3"} + ${setupCommand} build ${buildTarget}${crossCabalFlagsString}${buildFlagsString}${optionalString doVerbose ""} runHook postBuild ''; @@ -373,7 +373,7 @@ stdenv.mkDerivation ({ ${if !hasActiveLibrary then "${setupCommand} install" else '' ${setupCommand} copy - local packageConfDir="$out/lib/${ghc.name}/package.conf.d" + local packageConfDir="$out/${ghc.name}/package.conf.d" local packageConfFile="$packageConfDir/${pname}-${version}.conf" mkdir -p "$packageConfDir" ${setupCommand} register --gen-pkg-config=$packageConfFile @@ -398,7 +398,7 @@ stdenv.mkDerivation ({ ${optionalString doCoverage "mkdir -p $out/share && cp -r dist/hpc $out/share"} ${optionalString (enableSharedExecutables && isExecutable && !isGhcjs && stdenv.isDarwin && stdenv.lib.versionOlder ghc.version "7.10") '' for exe in "$out/bin/"* ; do - install_name_tool -add_rpath "$out/lib/ghc-${ghc.version}/${pname}-${version}" "$exe" + install_name_tool -add_rpath "$out/ghc-${ghc.version}/${pname}-${version}" "$exe" done ''} @@ -479,4 +479,5 @@ stdenv.mkDerivation ({ // optionalAttrs (dontStrip) { inherit dontStrip; } // optionalAttrs (hardeningDisable != []) { inherit hardeningDisable; } // optionalAttrs (buildPlatform.libc == "glibc"){ LOCALE_ARCHIVE = "${glibcLocales}/lib/locale/locale-archive"; } + // optionalAttrs doVerbose { NIX_DEBUG = 1; } ) -- 2.14.3 (Apple Git-98)