Skip to content

Commit

Permalink
Merge pull request #217568 from trofi/stdenv-parallel-install
Browse files Browse the repository at this point in the history
stdenv/generic/setup.sh: enable parallel installs for parallel builds
  • Loading branch information
mweinelt authored Mar 15, 2023
2 parents 578fb7f + 91e20f1 commit 19680e9
Show file tree
Hide file tree
Showing 24 changed files with 89 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pkgs/applications/audio/qsynth/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
4 changes: 4 additions & 0 deletions pkgs/applications/science/math/gretl/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
4 changes: 4 additions & 0 deletions pkgs/applications/version-management/subversion/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 5 additions & 0 deletions pkgs/development/compilers/ocaml/generic.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
3 changes: 3 additions & 0 deletions pkgs/development/interpreters/s9fes/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
5 changes: 5 additions & 0 deletions pkgs/development/libraries/qt-4.x/4.8/qmake-hook.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
5 changes: 5 additions & 0 deletions pkgs/development/libraries/qt-5/hooks/qmake-hook.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
5 changes: 5 additions & 0 deletions pkgs/development/libraries/qt-6/hooks/qmake-hook.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
3 changes: 3 additions & 0 deletions pkgs/development/tools/analysis/eresi/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
1 change: 1 addition & 0 deletions pkgs/development/tools/build-managers/bmake/setup-hook.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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[@]}"}
Expand Down
5 changes: 5 additions & 0 deletions pkgs/development/tools/build-managers/cmake/setup-hook.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
5 changes: 5 additions & 0 deletions pkgs/development/tools/build-managers/meson/setup-hook.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
8 changes: 8 additions & 0 deletions pkgs/development/tools/build-managers/ninja/setup-hook.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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}
)
Expand Down
1 change: 1 addition & 0 deletions pkgs/development/tools/build-managers/scons/setup-hook.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ sconsInstallPhase() {
fi

local flagsArray=(
${enableParallelInstalling:+-j${NIX_BUILD_CORES}}
$sconsFlags ${sconsFlagsArray[@]}
$installFlags ${installFlagsArray[@]}
${installTargets:-install}
Expand Down
6 changes: 6 additions & 0 deletions pkgs/development/tools/build-managers/wafHook/setup-hook.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down Expand Up @@ -68,6 +73,7 @@ wafInstallPhase() {
fi

local flagsArray=(
${enableParallelInstalling:+-j ${NIX_BUILD_CORES}}
$wafFlags ${wafFlagsArray[@]}
$installFlags ${installFlagsArray[@]}
${installTargets:-install}
Expand Down
3 changes: 3 additions & 0 deletions pkgs/os-specific/linux/sssd/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 5 additions & 0 deletions pkgs/servers/irc/solanum/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
3 changes: 3 additions & 0 deletions pkgs/servers/monitoring/net-snmp/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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 = ''
Expand Down
1 change: 1 addition & 0 deletions pkgs/servers/x11/xorg/builder.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,6 @@ fi


enableParallelBuilding=1
enableParallelInstalling=1

genericBuild
1 change: 1 addition & 0 deletions pkgs/stdenv/generic/make-derivation.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
1 change: 1 addition & 0 deletions pkgs/stdenv/generic/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -1376,6 +1376,7 @@ installPhase() {

# shellcheck disable=SC2086
local flagsArray=(
${enableParallelInstalling:+-j${NIX_BUILD_CORES}}
SHELL=$SHELL
)
_accumFlagsArray makeFlags makeFlagsArray installFlags installFlagsArray
Expand Down
3 changes: 3 additions & 0 deletions pkgs/tools/filesystems/xfsprogs/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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 = ''
Expand Down
4 changes: 4 additions & 0 deletions pkgs/tools/graphics/asymptote/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
4 changes: 4 additions & 0 deletions pkgs/tools/networking/vpnc/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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/";
Expand Down

0 comments on commit 19680e9

Please sign in to comment.