Merge pull request #217568 from trofi/stdenv-parallel-install

stdenv/generic/setup.sh: enable parallel installs for parallel builds
This commit is contained in:
Martin Weinelt 2023-03-15 17:10:19 +00:00 committed by GitHub
commit 19680e9902
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
24 changed files with 89 additions and 0 deletions

View File

@ -16,6 +16,10 @@ mkDerivation rec {
buildInputs = [ alsa-lib fluidsynth libjack2 qtbase qttools qtx11extras ];
enableParallelBuilding = true;
# Missing install depends:
# lrelease error: Parse error at src/translations/qsynth_ru.ts:1503:33: Premature end of document.
# make: *** [Makefile:107: src/translations/qsynth_ru.qm] Error 1
enableParallelInstalling = false;
meta = with lib; {
description = "Fluidsynth GUI";

View File

@ -28,6 +28,10 @@ stdenv.mkDerivation rec {
nativeBuildInputs = [ pkg-config ];
enableParallelBuilding = true;
# Missing install depends:
# cp: cannot stat '...-gretl-2022c/share/gretl/data/plotbars': Not a directory
# make[1]: *** [Makefile:73: install_datafiles] Error 1
enableParallelInstalling = false;
meta = with lib; {
description = "A software package for econometric analysis";

View File

@ -100,6 +100,10 @@ let
inherit perlBindings pythonBindings;
enableParallelBuilding = true;
# Missing install dependencies:
# libtool: error: error: relink 'libsvn_ra_serf-1.la' with the above command before installing it
# make: *** [build-outputs.mk:1316: install-serf-lib] Error 1
enableParallelInstalling = false;
nativeCheckInputs = [ python3 ];
doCheck = false; # fails 10 out of ~2300 tests

View File

@ -95,6 +95,11 @@ stdenv.mkDerivation (args // {
# make[2]: *** [Makefile:199: backup] Error 1
enableParallelBuilding = lib.versionAtLeast version "4.08";
# Workaround missing dependencies for install parallelism:
# install: target '...-ocaml-4.14.0/lib/ocaml/threads': No such file or directory
# make[1]: *** [Makefile:140: installopt] Error 1
enableParallelInstalling = false;
# Workaround lack of parallelism support among top-level targets:
# we place nixpkgs-specific targets to a separate file and set
# sequential order among them as a single rule.

View File

@ -24,6 +24,9 @@ stdenv.mkDerivation rec {
buildInputs = [ ncurses ];
makeFlags = [ "CC=${stdenv.cc.targetPrefix}cc" "PREFIX=$(out)" ];
enableParallelBuilding = true;
# ...-bash-5.2-p15/bin/bash: line 1: ...-s9fes-20181205/bin/s9help: No such file or directory
# make: *** [Makefile:157: install-util] Error 1
enableParallelInstalling = false;
meta = with lib; {
description = "Scheme 9 From Empty Space, an interpreter for R4RS Scheme";

View File

@ -8,6 +8,11 @@ qmakeConfigurePhase() {
echo "qmake4Hook: enabled parallel building"
fi
if ! [[ -v enableParallelInstalling ]]; then
enableParallelInstalling=1
echo "qmake: enabled parallel installing"
fi
runHook postConfigure
}

View File

@ -38,6 +38,11 @@ qmakeConfigurePhase() {
echo "qmake: enabled parallel building"
fi
if ! [[ -v enableParallelInstalling ]]; then
enableParallelInstalling=1
echo "qmake: enabled parallel installing"
fi
runHook postConfigure
}

View File

@ -40,6 +40,11 @@ qmakeConfigurePhase() {
echo "qmake: enabled parallel building"
fi
if ! [[ -v enableParallelInstalling ]]; then
enableParallelInstalling=1
echo "qmake: enabled parallel installing"
fi
runHook postConfigure
}

View File

@ -60,6 +60,9 @@ stdenv.mkDerivation rec {
nativeBuildInputs = [ which ];
buildInputs = [ openssl readline ];
enableParallelBuilding = true;
# ln: failed to create symbolic link '...-eresi-0.83-a3-phoenix//bin/elfsh': No such file or directory
# make: *** [Makefile:108: install64] Error 1
enableParallelInstalling = false;
installTargets = lib.singleton "install"
++ lib.optional stdenv.is64bit "install64";

View File

@ -76,6 +76,7 @@ bmakeInstallPhase() {
# shellcheck disable=SC2086
local flagsArray=(
${enableParallelInstalling:+-j${NIX_BUILD_CORES}}
SHELL=$SHELL
# Old bash empty array hack
$makeFlags ${makeFlagsArray+"${makeFlagsArray[@]}"}

View File

@ -130,6 +130,11 @@ cmakeConfigurePhase() {
echo "cmake: enabled parallel building"
fi
if ! [[ -v enableParallelInstalling ]]; then
enableParallelInstalling=1
echo "cmake: enabled parallel installing"
fi
runHook postConfigure
}

View File

@ -28,6 +28,11 @@ mesonConfigurePhase() {
echo "meson: enabled parallel building"
fi
if ! [[ -v enableParallelInstalling ]]; then
enableParallelInstalling=1
echo "meson: enabled parallel installing"
fi
runHook postConfigure
}

View File

@ -53,8 +53,16 @@ ninjaCheckPhase() {
ninjaInstallPhase() {
runHook preInstall
local buildCores=1
# Parallel building is enabled by default.
if [ "${enableParallelInstalling-1}" ]; then
buildCores="$NIX_BUILD_CORES"
fi
# shellcheck disable=SC2086
local flagsArray=(
-j$buildCores
$ninjaFlags "${ninjaFlagsArray[@]}"
${installTargets:-install}
)

View File

@ -33,6 +33,7 @@ sconsInstallPhase() {
fi
local flagsArray=(
${enableParallelInstalling:+-j${NIX_BUILD_CORES}}
$sconsFlags ${sconsFlagsArray[@]}
$installFlags ${installFlagsArray[@]}
${installTargets:-install}

View File

@ -30,6 +30,11 @@ wafConfigurePhase() {
echo "waf: enabled parallel building"
fi
if ! [[ -v enableParallelInstalling ]]; then
enableParallelInstalling=1
echo "waf: enabled parallel installing"
fi
runHook postConfigure
}
@ -68,6 +73,7 @@ wafInstallPhase() {
fi
local flagsArray=(
${enableParallelInstalling:+-j ${NIX_BUILD_CORES}}
$wafFlags ${wafFlagsArray[@]}
$installFlags ${installFlagsArray[@]}
${installTargets:-install}

View File

@ -54,6 +54,9 @@ stdenv.mkDerivation rec {
'';
enableParallelBuilding = true;
# Disable parallel install due to missing depends:
# libtool: error: error: relink '_py3sss.la' with the above command before installing i
enableParallelInstalling = false;
nativeBuildInputs = [ autoreconfHook makeWrapper pkg-config doxygen ];
buildInputs = [ augeas dnsutils c-ares curl cyrus_sasl ding-libs libnl libunistring nss
samba nfs-utils p11-kit python3 popt

View File

@ -57,6 +57,11 @@ stdenv.mkDerivation rec {
doCheck = !stdenv.isDarwin;
enableParallelBuilding = true;
# Missing install depends:
# ...-binutils-2.40/bin/ld: cannot find ./.libs/libircd.so: No such file or directory
# collect2: error: ld returned 1 exit status
# make[4]: *** [Makefile:634: solanum] Error 1
enableParallelInstalling = false;
meta = with lib; {
description = "An IRCd for unified networks";

View File

@ -49,6 +49,9 @@ in stdenv.mkDerivation rec {
++ lib.optional withPerlTools perlWithPkgs;
enableParallelBuilding = true;
# Missing dependencies during relinking:
# ./.libs/libnetsnmpagent.so: file not recognized: file format not recognized
enableParallelInstalling = false;
doCheck = false; # tries to use networking
postInstall = ''

View File

@ -37,5 +37,6 @@ fi
enableParallelBuilding=1
enableParallelInstalling=1
genericBuild

View File

@ -441,6 +441,7 @@ else let
} // lib.optionalAttrs (enableParallelBuilding) {
inherit enableParallelBuilding;
enableParallelChecking = attrs.enableParallelChecking or true;
enableParallelInstalling = attrs.enableParallelInstalling or true;
} // lib.optionalAttrs (hardeningDisable != [] || hardeningEnable != [] || stdenv.hostPlatform.isMusl) {
NIX_HARDENING_ENABLE = enabledHardeningOptions;
} // lib.optionalAttrs (stdenv.hostPlatform.isx86_64 && stdenv.hostPlatform ? gcc.arch) {

View File

@ -1376,6 +1376,7 @@ installPhase() {
# shellcheck disable=SC2086
local flagsArray=(
${enableParallelInstalling:+-j${NIX_BUILD_CORES}}
SHELL=$SHELL
)
_accumFlagsArray makeFlags makeFlagsArray installFlags installFlagsArray

View File

@ -23,6 +23,9 @@ stdenv.mkDerivation rec {
propagatedBuildInputs = [ libuuid ]; # Dev headers include <uuid/uuid.h>
enableParallelBuilding = true;
# Install fails as:
# make[1]: *** No rule to make target '\', needed by 'kmem.lo'. Stop.
enableParallelInstalling = false;
# @sbindir@ is replaced with /run/current-system/sw/bin to fix dependency cycles
preConfigure = ''

View File

@ -67,6 +67,10 @@ stdenv.mkDerivation rec {
'';
enableParallelBuilding = true;
# Missing install depends:
# ...-coreutils-9.1/bin/install: cannot stat 'asy-keywords.el': No such file or directory
# make: *** [Makefile:272: install-asy] Error 1
enableParallelInstalling = false;
meta = with lib; {
description = "A tool for programming graphics intended to replace Metapost";

View File

@ -32,6 +32,10 @@ stdenv.mkDerivation {
'';
enableParallelBuilding = true;
# Missing install depends:
# install: target '...-vpnc-unstable-2021-11-04/share/doc/vpnc': No such file or directory
# make: *** [Makefile:149: install-doc] Error 1
enableParallelInstalling = false;
meta = with lib; {
homepage = "https://davidepucci.it/doc/vpnc/";