Enable parallel building of gcc, glibc, gmp, mpfr, ncurses, coreutils, perl, python, git, and qt4.

If a build expressions has set "enableParallelBuilding = true", then the
generic builder may utilize more than one CPU core to build that particular
expression. This feature works out of the box for GNU Make. Expressions that
use other build drivers like Boost.Jam or SCons have to specify appropriate
flags such as "-j${NIX_BUILD_CORES}" themselves.

svn path=/nixpkgs/trunk/; revision=23042
This commit is contained in:
Peter Simons 2010-08-08 18:51:42 +00:00
parent 089ee5da11
commit 1a6039cb45
22 changed files with 60 additions and 5 deletions

View File

@ -74,7 +74,7 @@ stdenv.mkDerivation rec {
'') '')
+ ''# Install man pages and Info manual + ''# Install man pages and Info manual
make PERL_PATH="${perl}/bin/perl" cmd-list.made install install-info \ make -j $NIX_BUILD_CORES -l $NIX_BUILD_CORES PERL_PATH="${perl}/bin/perl" cmd-list.made install install-info \
-C Documentation '' -C Documentation ''
+ (if guiSupport then '' + (if guiSupport then ''
@ -116,6 +116,8 @@ stdenv.mkDerivation rec {
''; '';
enableParallelBuilding = true;
meta = { meta = {
license = "GPLv2"; license = "GPLv2";
homepage = http://git-scm.com/; homepage = http://git-scm.com/;

View File

@ -127,6 +127,8 @@ stdenv.mkDerivation ({
passthru = { inherit langC langCC langFortran langVhdl langTreelang passthru = { inherit langC langCC langFortran langVhdl langTreelang
enableMultilib; }; enableMultilib; };
enableParallelBuilding = true;
meta = { meta = {
homepage = "http://gcc.gnu.org/"; homepage = "http://gcc.gnu.org/";
license = "GPL/LGPL"; license = "GPL/LGPL";

View File

@ -201,6 +201,8 @@ stdenv.mkDerivation ({
passthru = { inherit langC langCC langAda langFortran langTreelang langVhdl passthru = { inherit langC langCC langAda langFortran langTreelang langVhdl
enableMultilib version; }; enableMultilib version; };
enableParallelBuilding = true;
meta = { meta = {
homepage = http://gcc.gnu.org/; homepage = http://gcc.gnu.org/;
license = "GPLv3+"; # runtime support libraries are typically LGPLv3+ license = "GPLv3+"; # runtime support libraries are typically LGPLv3+

View File

@ -289,6 +289,8 @@ stdenv.mkDerivation ({
passthru = { inherit langC langCC langAda langFortran langTreelang langVhdl passthru = { inherit langC langCC langAda langFortran langTreelang langVhdl
enableMultilib version; }; enableMultilib version; };
enableParallelBuilding = true;
meta = { meta = {
homepage = http://gcc.gnu.org/; homepage = http://gcc.gnu.org/;
license = "GPLv3+"; # runtime support libraries are typically LGPLv3+ license = "GPLv3+"; # runtime support libraries are typically LGPLv3+

View File

@ -21,6 +21,8 @@ stdenv.mkDerivation ({
sha256 = "a7d8041e50e110f5a503e188a05cb217f0c99c51f248a0a1387cc07a0b6f167f"; sha256 = "a7d8041e50e110f5a503e188a05cb217f0c99c51f248a0a1387cc07a0b6f167f";
}) ; }) ;
enableParallelBuilding = true;
sourceRoot = "gcc_42-5574/"; sourceRoot = "gcc_42-5574/";
patches = patches =
[./pass-cxxcpp.patch ./debug_list.patch] [./pass-cxxcpp.patch ./debug_list.patch]

View File

@ -21,6 +21,8 @@ stdenv.mkDerivation ({
sha256 = "1fy6j41rhxdsm19sib9wygjl5l54g8pm13c6y5x13f40mavw1mma"; sha256 = "1fy6j41rhxdsm19sib9wygjl5l54g8pm13c6y5x13f40mavw1mma";
}) ; }) ;
enableParallelBuilding = true;
libstdcxx = "libstdcxx-39"; libstdcxx = "libstdcxx-39";
sourceRoot = "gcc-5646/"; sourceRoot = "gcc-5646/";
patches = patches =

View File

@ -39,6 +39,8 @@ stdenv.mkDerivation rec {
dontAddPrefix = true; dontAddPrefix = true;
enableParallelBuilding = true;
preConfigure = preConfigure =
'' ''
configureFlags="$configureFlags -Dprefix=$out -Dman1dir=$out/share/man/man1 -Dman3dir=$out/share/man/man3" configureFlags="$configureFlags -Dprefix=$out -Dman1dir=$out/share/man/man1 -Dman3dir=$out/share/man/man3"

View File

@ -88,6 +88,8 @@ stdenv.mkDerivation ( {
libPrefix = "python${majorVersion}"; libPrefix = "python${majorVersion}";
}; };
enableParallelBuilding = true;
meta = { meta = {
platforms = stdenv.lib.platforms.all; platforms = stdenv.lib.platforms.all;
}; };

View File

@ -17,7 +17,7 @@ postConfigure() {
postInstall() { postInstall() {
if test -n "$installLocales"; then if test -n "$installLocales"; then
make localedata/install-locales make -j${NIX_BUILD_CORES:-1} -l${NIX_BUILD_CORES:-1} localedata/install-locales
fi fi
test -f $out/etc/ld.so.cache && rm $out/etc/ld.so.cache test -f $out/etc/ld.so.cache && rm $out/etc/ld.so.cache

View File

@ -20,7 +20,7 @@ postConfigure() {
postInstall() { postInstall() {
if test -n "$installLocales"; then if test -n "$installLocales"; then
make localedata/install-locales make -j${NIX_BUILD_CORES:-1} -l${NIX_BUILD_CORES:-1} localedata/install-locales
fi fi
test -f $out/etc/ld.so.cache && rm $out/etc/ld.so.cache test -f $out/etc/ld.so.cache && rm $out/etc/ld.so.cache

View File

@ -30,6 +30,8 @@ stdenv.mkDerivation ({
inherit (stdenv) is64bit; inherit (stdenv) is64bit;
enableParallelBuilding = true;
patches = patches =
stdenv.lib.optional (fetchgit == null) stdenv.lib.optional (fetchgit == null)
/* Fix for NIXPKGS-79: when doing host name lookups, when /* Fix for NIXPKGS-79: when doing host name lookups, when

View File

@ -38,7 +38,7 @@ postConfigure() {
postInstall() { postInstall() {
if test -n "$installLocales"; then if test -n "$installLocales"; then
make localedata/install-locales make -j${NIX_BUILD_CORES:-1} -l${NIX_BUILD_CORES:-1} localedata/install-locales
fi fi
rm $out/etc/ld.so.cache rm $out/etc/ld.so.cache
(cd $out/include && ln -s $kernelHeaders/include/* .) || exit 1 (cd $out/include && ln -s $kernelHeaders/include/* .) || exit 1

View File

@ -30,6 +30,8 @@ stdenv.mkDerivation {
# the symbol __i686.get_pc_thunk.dx to be mangled. # the symbol __i686.get_pc_thunk.dx to be mangled.
NIX_CFLAGS_COMPILE = "-U__i686"; NIX_CFLAGS_COMPILE = "-U__i686";
enableParallelBuilding = true;
meta = { meta = {
homepage = http://www.gnu.org/software/libc/; homepage = http://www.gnu.org/software/libc/;
description = "The GNU C Library"; description = "The GNU C Library";

View File

@ -16,6 +16,8 @@ stdenv.mkDerivation rec {
doCheck = true; doCheck = true;
enableParallelBuilding = true;
meta = { meta = {
description = "A free library for arbitrary precision arithmetic, operating on signed integers, rational numbers, and floating point numbers"; description = "A free library for arbitrary precision arithmetic, operating on signed integers, rational numbers, and floating point numbers";
homepage = http://gmplib.org/; homepage = http://gmplib.org/;

View File

@ -16,6 +16,8 @@ stdenv.mkDerivation rec {
doCheck = true; doCheck = true;
enableParallelBuilding = true;
meta = { meta = {
description = "A free library for arbitrary precision arithmetic, operating on signed integers, rational numbers, and floating point numbers"; description = "A free library for arbitrary precision arithmetic, operating on signed integers, rational numbers, and floating point numbers";
homepage = http://gmplib.org/; homepage = http://gmplib.org/;

View File

@ -12,6 +12,8 @@ stdenv.mkDerivation rec {
doCheck = true; doCheck = true;
enableParallelBuilding = true;
meta = { meta = {
homepage = http://www.mpfr.org/; homepage = http://www.mpfr.org/;
description = "GNU MPFR, a library for multiple-precision floating-point arithmetic"; description = "GNU MPFR, a library for multiple-precision floating-point arithmetic";

View File

@ -15,6 +15,8 @@ stdenv.mkDerivation ( rec {
selfBuildNativeInput = true; selfBuildNativeInput = true;
enableParallelBuilding = true;
preBuild = ''sed -e "s@\([[:space:]]\)sh @\1''${SHELL} @" -i */Makefile Makefile''; preBuild = ''sed -e "s@\([[:space:]]\)sh @\1''${SHELL} @" -i */Makefile Makefile'';
# When building a wide-character (Unicode) build, create backward # When building a wide-character (Unicode) build, create backward

View File

@ -74,6 +74,8 @@ stdenv.mkDerivation {
${if keepDocumentation == false then "rm -rf $out/doc" else ""} ${if keepDocumentation == false then "rm -rf $out/doc" else ""}
''; '';
enableParallelBuilding = true;
meta = { meta = {
homepage = http://www.qtsoftware.com/downloads/opensource/appdev/linux-x11-cpp; homepage = http://www.qtsoftware.com/downloads/opensource/appdev/linux-x11-cpp;
description = "A cross-platform application framework for C++"; description = "A cross-platform application framework for C++";

View File

@ -89,6 +89,8 @@ stdenv.mkDerivation rec {
postInstall = if useDocs then "rm -rf $out/share/doc/${name}/{html,src}" else ""; postInstall = if useDocs then "rm -rf $out/share/doc/${name}/{html,src}" else "";
enableParallelBuilding = true;
meta = { meta = {
homepage = http://qt.nokia.com/products; homepage = http://qt.nokia.com/products;
description = "A cross-platform application framework for C++"; description = "A cross-platform application framework for C++";

View File

@ -99,6 +99,8 @@ stdenv.mkDerivation rec {
postInstall = if useDocs then "rm -rf $out/share/doc/${name}/{html,src}" else ""; postInstall = if useDocs then "rm -rf $out/share/doc/${name}/{html,src}" else "";
enableParallelBuilding = true;
meta = with stdenv.lib; { meta = with stdenv.lib; {
homepage = http://qt.nokia.com/products; homepage = http://qt.nokia.com/products;
description = "A cross-platform application framework for C++"; description = "A cross-platform application framework for C++";

View File

@ -269,6 +269,23 @@ fi
export NIX_INDENT_MAKE=1 export NIX_INDENT_MAKE=1
# Normalize the NIX_BUILD_CORES variable. The value might be 0, which
# means that we're supposed to try and auto-detect the number of
# available CPU cores at run-time.
if test -z "${NIX_BUILD_CORES:-}"; then
NIX_BUILD_CORES="1"
elif test "$NIX_BUILD_CORES" -le 0; then
NIX_BUILD_CORES=$(nproc 2>/dev/null || true)
if expr >/dev/null 2>&1 "$NIX_BUILD_CORES" : "^[0-9][0-9]*$"; then
:
else
NIX_BUILD_CORES="1"
fi
fi
export NIX_BUILD_CORES
###################################################################### ######################################################################
# Misc. helper functions. # Misc. helper functions.
@ -603,6 +620,7 @@ buildPhase() {
echo "make flags: $makeFlags ${makeFlagsArray[@]} $buildFlags ${buildFlagsArray[@]}" echo "make flags: $makeFlags ${makeFlagsArray[@]} $buildFlags ${buildFlagsArray[@]}"
make ${makefile:+-f $makefile} \ make ${makefile:+-f $makefile} \
${enableParallelBuilding:+-j${NIX_BUILD_CORES} -l${NIX_BUILD_CORES}} \
$makeFlags "${makeFlagsArray[@]}" \ $makeFlags "${makeFlagsArray[@]}" \
$buildFlags "${buildFlagsArray[@]}" $buildFlags "${buildFlagsArray[@]}"
@ -615,6 +633,7 @@ checkPhase() {
echo "check flags: $makeFlags ${makeFlagsArray[@]} $checkFlags ${checkFlagsArray[@]}" echo "check flags: $makeFlags ${makeFlagsArray[@]} $checkFlags ${checkFlagsArray[@]}"
make ${makefile:+-f $makefile} \ make ${makefile:+-f $makefile} \
${enableParallelBuilding:+-j${NIX_BUILD_CORES} -l${NIX_BUILD_CORES}} \
$makeFlags "${makeFlagsArray[@]}" \ $makeFlags "${makeFlagsArray[@]}" \
$checkFlags "${checkFlagsArray[@]}" ${checkTarget:-check} $checkFlags "${checkFlagsArray[@]}" ${checkTarget:-check}

View File

@ -24,6 +24,8 @@ stdenv.mkDerivation (rec {
# and {Open,Free}BSD. # and {Open,Free}BSD.
doCheck = (stdenv ? glibc) && (cross == null); doCheck = (stdenv ? glibc) && (cross == null);
enableParallelBuilding = true;
meta = { meta = {
homepage = http://www.gnu.org/software/coreutils/; homepage = http://www.gnu.org/software/coreutils/;
description = "The basic file, shell and text manipulation utilities of the GNU operating system"; description = "The basic file, shell and text manipulation utilities of the GNU operating system";