Merge branch 'stdenv-updates' into pi-stdenv-updates

Conflicts:
	pkgs/development/compilers/gcc/4.6/default.nix
	pkgs/development/compilers/gcc/4.7/default.nix

The 4.7 had some weird parameters added in crossAttrs; I've removed
them, but I don't understand where they come from.
This commit is contained in:
Lluís Batlle i Rossell
2012-12-28 20:14:01 +00:00
417 changed files with 838 additions and 853 deletions
+40 -53
View File
@@ -20,7 +20,7 @@ rec {
# for other dependencies.
overrideInStdenv = stdenv: pkgs: stdenv //
{ mkDerivation = args: stdenv.mkDerivation (args //
{ buildInputs = (if args ? buildInputs then args.buildInputs else []) ++ pkgs; }
{ buildInputs = args.buildInputs or [] ++ pkgs; }
);
};
@@ -48,11 +48,11 @@ rec {
# These are added *after* the command-line flags, so we'll
# always optimise for size.
NIX_CFLAGS_COMPILE =
(if args ? NIX_CFLAGS_COMPILE then args.NIX_CFLAGS_COMPILE else "")
args.NIX_CFLAGS_COMPILE or ""
+ " -Os -s -D_BSD_SOURCE=1";
configureFlags =
(if args ? configureFlags then args.configureFlags else "")
args.configureFlags or ""
+ " --disable-shared"; # brrr...
NIX_GCC = import ../build-support/gcc-wrapper {
@@ -75,12 +75,10 @@ rec {
# These are added *after* the command-line flags, so we'll
# always optimise for size.
NIX_CFLAGS_COMPILE =
(if args ? NIX_CFLAGS_COMPILE then args.NIX_CFLAGS_COMPILE else "")
+ " -Os -s";
args.NIX_CFLAGS_COMPILE or "" + " -Os -s";
configureFlags =
(if args ? configureFlags then args.configureFlags else "")
+ " --disable-shared"; # brrr...
args.configureFlags or "" + " --disable-shared"; # brrr...
NIX_GCC = runCommand "klibc-wrapper" {} ''
mkdir -p $out/bin
@@ -100,9 +98,8 @@ rec {
makeStaticBinaries = stdenv: stdenv //
{ mkDerivation = args: stdenv.mkDerivation (args // {
NIX_CFLAGS_LINK = "-static";
configureFlags =
(if args ? configureFlags then toString args.configureFlags else "")
toString args.configureFlags or ""
+ " --disable-shared"; # brrr...
});
isStatic = true;
@@ -115,7 +112,7 @@ rec {
{ mkDerivation = args: stdenv.mkDerivation (args // {
dontDisableStatic = true;
configureFlags =
(if args ? configureFlags then toString args.configureFlags else "")
toString args.configureFlags or ""
+ " --enable-static --disable-shared";
});
} // {inherit fetchurl;};
@@ -124,62 +121,60 @@ rec {
# Return a modified stdenv that adds a cross compiler to the
# builds.
makeStdenvCross = stdenv: cross: binutilsCross: gccCross: stdenv //
{ mkDerivation = {name ? "", buildInputs ? [], buildNativeInputs ? [],
propagatedBuildInputs ? [], propagatedBuildNativeInputs ? [],
selfBuildNativeInput ? false, ...}@args: let
{ mkDerivation = {name ? "", buildInputs ? [], nativeBuildInputs ? [],
propagatedBuildInputs ? [], propagatedNativeBuildInputs ? [],
selfNativeBuildInput ? false, ...}@args: let
# *BuildInputs exists temporarily as another name for
# *HostInputs.
# In nixpkgs, sometimes 'null' gets in as a buildInputs element,
# and we handle that through isAttrs.
getBuildDrv = drv : if (builtins.isAttrs drv && drv ? buildDrv) then drv.buildDrv else drv;
getHostDrv = drv : if (builtins.isAttrs drv && drv ? hostDrv) then drv.hostDrv else drv;
buildNativeInputsDrvs = map (getBuildDrv) buildNativeInputs;
buildInputsDrvs = map (getHostDrv) buildInputs;
buildInputsDrvsAsBuildInputs = map (getBuildDrv) buildInputs;
propagatedBuildInputsDrvs = map (getHostDrv) (propagatedBuildInputs);
propagatedBuildNativeInputsDrvs = map (getBuildDrv)
(propagatedBuildNativeInputs);
getNativeDrv = drv: drv.nativeDrv or drv;
getCrossDrv = drv: drv.crossDrv or drv;
nativeBuildInputsDrvs = map getNativeDrv nativeBuildInputs;
buildInputsDrvs = map getCrossDrv buildInputs;
buildInputsDrvsAsBuildInputs = map getNativeDrv buildInputs;
propagatedBuildInputsDrvs = map getCrossDrv propagatedBuildInputs;
propagatedNativeBuildInputsDrvs = map getNativeDrv propagatedNativeBuildInputs;
# The base stdenv already knows that buildNativeInputs and
# The base stdenv already knows that nativeBuildInputs and
# buildInputs should be built with the usual gcc-wrapper
# And the same for propagatedBuildInputs.
buildDrv = stdenv.mkDerivation args;
nativeDrv = stdenv.mkDerivation args;
# Temporary expression until the cross_renaming, to handle the
# case of pkgconfig given as buildInput, but to be used as
# buildNativeInput.
hostAsBuildDrv = drv: builtins.unsafeDiscardStringContext
drv.buildDrv.drvPath == builtins.unsafeDiscardStringContext
drv.hostDrv.drvPath;
# nativeBuildInput.
hostAsNativeDrv = drv:
builtins.unsafeDiscardStringContext drv.nativeDrv.drvPath
== builtins.unsafeDiscardStringContext drv.crossDrv.drvPath;
buildInputsNotNull = stdenv.lib.filter
(drv: builtins.isAttrs drv && drv ? buildDrv) buildInputs;
nativeInputsFromBuildInputs = stdenv.lib.filter (hostAsBuildDrv) buildInputsNotNull;
(drv: builtins.isAttrs drv && drv ? nativeDrv) buildInputs;
nativeInputsFromBuildInputs = stdenv.lib.filter hostAsNativeDrv buildInputsNotNull;
# We should overwrite the input attributes in hostDrv, to overwrite
# We should overwrite the input attributes in crossDrv, to overwrite
# the defaults for only-native builds in the base stdenv
hostDrv = if (cross == null) then buildDrv else
crossDrv = if cross == null then nativeDrv else
stdenv.mkDerivation (args // {
name = name + "-" + cross.config;
buildNativeInputs = buildNativeInputsDrvs
nativeBuildInputs = nativeBuildInputsDrvs
++ nativeInputsFromBuildInputs
++ [ gccCross binutilsCross ] ++
stdenv.lib.optional selfBuildNativeInput buildDrv;
stdenv.lib.optional selfNativeBuildInput nativeDrv;
# Cross-linking dynamic libraries, every buildInput should
# be propagated because ld needs the -rpath-link to find
# any library needed to link the program dynamically at
# loader time. ld(1) explains it.
buildInputs = [];
propagatedBuildInputs = propagatedBuildInputsDrvs ++
buildInputsDrvs;
propagatedBuildNativeInputs = propagatedBuildNativeInputsDrvs;
propagatedBuildInputs = propagatedBuildInputsDrvs ++ buildInputsDrvs;
propagatedNativeBuildInputs = propagatedNativeBuildInputsDrvs;
crossConfig = cross.config;
} // (if args ? crossAttrs then args.crossAttrs else {}));
in buildDrv // {
inherit hostDrv buildDrv;
} // args.crossAttrs or {});
in nativeDrv // {
inherit crossDrv nativeDrv;
};
} // {
inherit cross gccCross binutilsCross;
@@ -297,14 +292,9 @@ rec {
pkg = stdenv.mkDerivation args;
printDrvPath = val: let
drvPath = builtins.unsafeDiscardStringContext pkg.drvPath;
license =
if pkg ? meta && pkg.meta ? license then
pkg.meta.license
else
null;
license = pkg.meta.license or null;
in
builtins.trace "@:drv:${toString drvPath}:${builtins.toString license}:@"
val;
builtins.trace "@:drv:${toString drvPath}:${builtins.toString license}:@" val;
in pkg // {
outPath = printDrvPath pkg.outPath;
drvPath = printDrvPath pkg.drvPath;
@@ -333,15 +323,12 @@ rec {
pkg = stdenv.mkDerivation args;
drv = builtins.unsafeDiscardStringContext pkg.drvPath;
license =
if pkg ? meta && pkg.meta ? license then
pkg.meta.license
else if pkg ? outputHash then
pkg.meta.license or
# Fixed-output derivations such as source tarballs usually
# don't have licensing information, but that's OK.
null
else
builtins.trace
"warning: ${drv} lacks licensing information" null;
(pkg.outputHash or
(builtins.trace
"warning: ${drv} lacks licensing information" null));
validate = arg:
if licensePred license then arg
+4 -3
View File
@@ -10,7 +10,7 @@
# system, e.g., cygwin and mingw builds on i686-cygwin. Most people
# can ignore it.
{system, stdenvType ? system, allPackages ? import ../.., platform}:
{ system, stdenvType ? system, allPackages ? import ../.., platform, config }:
assert system != "i686-cygwin" -> system == stdenvType;
@@ -24,7 +24,7 @@ rec {
# be used with care, since many Nix packages will not build properly
# with it (e.g., because they require GNU Make).
stdenvNative = (import ./native {
inherit system allPackages;
inherit system allPackages config;
}).stdenv;
stdenvNativePkgs = allPackages {
@@ -35,13 +35,14 @@ rec {
# The Nix build environment.
stdenvNix = import ./nix {
inherit config;
stdenv = stdenvNative;
pkgs = stdenvNativePkgs;
};
# Linux standard environment.
stdenvLinux = (import ./linux {inherit system allPackages platform;}).stdenvLinux;
stdenvLinux = (import ./linux { inherit system allPackages platform config;}).stdenvLinux;
# MinGW/MSYS standard environment.
-6
View File
@@ -9,15 +9,9 @@ mkdir $out
echo "$preHook" > $out/setup
cat "$setup" >> $out/setup
if [ "$withNixImpure" == 1 ]; then
# sed wants \&\& for a &&
niximpure='test -f /niximpure/impure.sh \&\& . /niximpure/impure.sh'
fi
sed -e "s^@initialPath@^$initialPath^g" \
-e "s^@gcc@^$gcc^g" \
-e "s^@shell@^$shell^g" \
-e "s^@niximpure@^$niximpure^g" \
< $out/setup > $out/setup.tmp
mv $out/setup.tmp $out/setup
+7 -7
View File
@@ -1,6 +1,5 @@
{ system, name ? "stdenv", preHook ? "", initialPath, gcc, shell
, extraAttrs ? {}, overrides ? (pkgs: {})
, withNixImpure ? false
, extraAttrs ? {}, overrides ? (pkgs: {}), config
, # The `fetchurl' to use for downloading curl and its dependencies
# (see all-packages.nix).
@@ -27,7 +26,7 @@ let
setup = setupScript;
inherit preHook initialPath gcc shell withNixImpure;
inherit preHook initialPath gcc shell;
propagatedUserEnvPkgs = [gcc] ++
lib.filter lib.isDerivation initialPath;
@@ -49,9 +48,9 @@ let
(removeAttrs attrs ["meta" "passthru" "crossAttrs"])
// (let
buildInputs = attrs.buildInputs or [];
buildNativeInputs = attrs.buildNativeInputs or [];
nativeBuildInputs = attrs.nativeBuildInputs or [];
propagatedBuildInputs = attrs.propagatedBuildInputs or [];
propagatedBuildNativeInputs = attrs.propagatedBuildNativeInputs or [];
propagatedNativeBuildInputs = attrs.propagatedNativeBuildInputs or [];
crossConfig = attrs.crossConfig or null;
in
{
@@ -59,15 +58,16 @@ let
args = attrs.args or ["-e" (attrs.builder or ./default-builder.sh)];
stdenv = result;
system = result.system;
userHook = config.stdenv.userHook or null;
# Inputs built by the cross compiler.
buildInputs = lib.optionals (crossConfig != null) buildInputs;
propagatedBuildInputs = lib.optionals (crossConfig != null)
propagatedBuildInputs;
# Inputs built by the usual native compiler.
buildNativeInputs = buildNativeInputs ++ lib.optionals
nativeBuildInputs = nativeBuildInputs ++ lib.optionals
(crossConfig == null) buildInputs;
propagatedBuildNativeInputs = propagatedBuildNativeInputs ++
propagatedNativeBuildInputs = propagatedNativeBuildInputs ++
lib.optionals (crossConfig == null) propagatedBuildInputs;
}))
)
+23 -18
View File
@@ -1,7 +1,7 @@
# Run the named hook, either by calling the function with that name or
# by evaluating the variable with that name. This allows convenient
# setting of hooks both from Nix expressions (as attributes /
# environment variables) and from shell scripts (as functions).
# environment variables) and from shell scripts (as functions).
runHook() {
local hookName="$1"
case "$(type -t $hookName)" in
@@ -29,10 +29,10 @@ exitHandler() {
# - system time for all child processes
echo "build time elapsed: " ${times[*]}
fi
if [ $exitCode != 0 ]; then
runHook failureHook
# If the builder had a non-zero exit code and
# $succeedOnFailure is set, create the file
# `$out/nix-support/failed' to signal failure, and exit
@@ -43,11 +43,11 @@ exitHandler() {
echo -n $exitCode > "$out/nix-support/failed"
exit 0
fi
else
runHook exitHook
fi
exit $exitCode
}
@@ -169,8 +169,8 @@ for i in $buildInputs $propagatedBuildInputs; do
done
nativePkgs=""
for i in $buildNativeInputs $propagatedBuildNativeInputs; do
findInputs $i nativePkgs propagated-build-native-inputs
for i in $nativeBuildInputs $propagatedNativeBuildInputs; do
findInputs $i nativePkgs propagated-native-build-inputs
done
@@ -197,7 +197,7 @@ addToCrossEnv() {
local pkg=$1
# Some programs put important build scripts (freetype-config and similar)
# into their hostDrv bin path. Intentionally these should go after
# into their crossDrv bin path. Intentionally these should go after
# the nativePkgs in PATH.
if [ -d $1/bin ]; then
addToSearchPath _PATH $1/bin
@@ -270,7 +270,6 @@ elif [ "$NIX_BUILD_CORES" -le 0 ]; then
fi
export NIX_BUILD_CORES
@niximpure@
######################################################################
# Misc. helper functions.
@@ -463,7 +462,7 @@ unpackFile() {
unpackPhase() {
runHook preUnpack
if [ -z "$srcs" ]; then
if [ -z "$src" ]; then
echo 'variable $src or $srcs should point to the source'
@@ -530,9 +529,9 @@ unpackPhase() {
patchPhase() {
runHook prePatch
if [ -z "$patchPhase" -a -z "$patches" ]; then return; fi
for i in $patches; do
header "applying patch $i" 3
local uncompress=cat
@@ -725,11 +724,11 @@ fixupPhase() {
# TODO: strip _only_ ELF executables, and return || fail here...
if [ -z "$dontStrip" ]; then
stripDebugList=${stripDebugList:-lib lib64 libexec bin sbin}
stripDebugList=${stripDebugList:-lib lib32 lib64 libexec bin sbin}
if [ -n "$stripDebugList" ]; then
stripDirs "$stripDebugList" "${stripDebugFlags:--S}"
fi
stripAllList=${stripAllList:-}
if [ -n "$stripAllList" ]; then
stripDirs "$stripAllList" "${stripAllFlags:--s}"
@@ -749,9 +748,9 @@ fixupPhase() {
echo "$propagatedBuildInputs" > "$out/nix-support/propagated-build-inputs"
fi
if [ -n "$propagatedBuildNativeInputs" ]; then
if [ -n "$propagatedNativeBuildInputs" ]; then
mkdir -p "$out/nix-support"
echo "$propagatedBuildNativeInputs" > "$out/nix-support/propagated-build-native-inputs"
echo "$propagatedNativeBuildInputs" > "$out/nix-support/propagated-native-build-inputs"
fi
if [ -n "$propagatedUserEnvPkgs" ]; then
@@ -845,7 +844,7 @@ genericBuild() {
showPhaseHeader "$curPhase"
dumpVars
# Evaluate the variable named $curPhase if it exists, otherwise the
# function named $curPhase.
eval "${!curPhase:-$curPhase}"
@@ -853,7 +852,7 @@ genericBuild() {
if [ "$curPhase" = unpackPhase ]; then
cd "${sourceRoot:-.}"
fi
if [ -n "$tracePhases" ]; then
echo
echo "@ phase-succeeded $out $curPhase"
@@ -870,4 +869,10 @@ genericBuild() {
runHook postHook
# Execute the global user hook (defined through the Nixpkgs
# configuration option stdenv.userHook). This can be used to set
# global compiler optimisation flags, for instance.
runHook userHook
dumpVars
+26 -29
View File
@@ -7,7 +7,7 @@
# The function defaults are for easy testing.
{ system ? builtins.currentSystem
, allPackages ? import ../../top-level/all-packages.nix
, platform ? null }:
, platform ? null, config }:
rec {
@@ -33,11 +33,11 @@ rec {
# The bootstrap process proceeds in several steps.
# 1) Create a standard environment by downloading pre-built binaries
# of coreutils, GCC, etc.
# This function downloads a file.
download = {url, sha256}: derivation {
name = baseNameOf (toString url);
@@ -50,31 +50,31 @@ rec {
impureEnvVars = [ "http_proxy" "https_proxy" "ftp_proxy" "all_proxy" "no_proxy" ];
};
# Download and unpack the bootstrap tools (coreutils, GCC, Glibc, ...).
bootstrapTools = derivation {
name = "bootstrap-tools";
builder = bootstrapFiles.sh;
args =
if (system == "armv5tel-linux" || system == "armv6l-linux")
then [ ./scripts/unpack-bootstrap-tools-arm.sh ]
else [ ./scripts/unpack-bootstrap-tools.sh ];
inherit (bootstrapFiles) bzip2 mkdir curl cpio;
tarball = download {
inherit (bootstrapFiles.bootstrapTools) url sha256;
};
inherit system;
# Needed by the GCC wrapper.
langC = true;
langCC = true;
};
# This function builds the various standard environments used during
# the bootstrap.
@@ -82,7 +82,7 @@ rec {
{gcc, extraAttrs ? {}, overrides ? (pkgs: {}), extraPath ? [], fetchurl}:
import ../generic {
inherit system;
inherit system config;
name = "stdenv-linux-boot";
preHook =
''
@@ -95,7 +95,6 @@ rec {
initialPath = [bootstrapTools] ++ extraPath;
fetchurlBoot = fetchurl;
inherit gcc;
withNixImpure = if platform ? nixImpure then platform.nixImpure else false;
# Having the proper 'platform' in all the stdenvs allows getting proper
# linuxHeaders for example.
extraAttrs = extraAttrs // { inherit platform; };
@@ -111,7 +110,7 @@ rec {
fetchurl = null;
};
fetchurl = import ../../build-support/fetchurl {
stdenv = stdenvLinuxBoot0;
curl = bootstrapTools;
@@ -135,7 +134,7 @@ rec {
# A helper function to call gcc-wrapper.
wrapGCC =
{gcc ? bootstrapTools, libc, binutils, coreutils, shell ? "", name ? "bootstrap-gcc-wrapper"}:
import ../../build-support/gcc-wrapper {
nativeTools = false;
nativeLibc = false;
@@ -155,7 +154,7 @@ rec {
};
inherit fetchurl;
};
# 2) These are the packages that we can build with the first
# stdenv. We only need binutils, because recent Glibcs
@@ -166,7 +165,7 @@ rec {
bootStdenv = stdenvLinuxBoot1;
};
# 3) 2nd stdenv that we will use to build only the glibc.
stdenvLinuxBoot2 = stdenvBootFun {
gcc = wrapGCC {
@@ -188,12 +187,12 @@ rec {
bootStdenv = stdenvLinuxBoot2;
};
# 5) Build Glibc with the bootstrap tools. The result is the full,
# dynamically linked, final Glibc.
stdenvLinuxGlibc = stdenvLinuxBoot2Pkgs.glibc;
# 6) Construct a third stdenv identical to the 2nd, except that
# this one uses the Glibc built in step 3. It still uses
# the recent binutils and rest of the bootstrap tools, including GCC.
@@ -219,14 +218,14 @@ rec {
inherit fetchurl;
};
# 7) The packages that can be built using the third stdenv.
stdenvLinuxBoot3Pkgs = allPackages {
inherit system platform;
bootStdenv = stdenvLinuxBoot3;
};
# 8) Construct a fourth stdenv identical to the second, except that
# this one uses the dynamically linked GCC and Binutils from step
# 5. The other tools (e.g. coreutils) are still from the
@@ -247,14 +246,14 @@ rec {
inherit fetchurl;
};
# 9) The packages that can be built using the fourth stdenv.
stdenvLinuxBoot4Pkgs = allPackages {
inherit system platform;
bootStdenv = stdenvLinuxBoot4;
};
# 10) Construct the final stdenv. It uses the Glibc, GCC and
# Binutils built above, and adds in dynamically linked versions
# of all other tools.
@@ -263,11 +262,11 @@ rec {
# dependency (`nix-store -qR') on bootstrapTools or the
# first binutils built.
stdenvLinux = import ../generic rec {
inherit system;
inherit system config;
preHook = commonPreHook;
initialPath =
initialPath =
((import ../common-path.nix) {pkgs = stdenvLinuxBoot4Pkgs;})
++ [stdenvLinuxBoot4Pkgs.patchelf];
@@ -281,11 +280,9 @@ rec {
};
shell = stdenvLinuxBoot4Pkgs.bash + "/bin/bash";
fetchurlBoot = fetchurl;
withNixImpure = if platform ? nixImpure then platform.nixImpure else false;
extraAttrs = {
inherit (stdenvLinuxBoot3Pkgs) glibc;
inherit platform;
+2 -2
View File
@@ -1,4 +1,4 @@
{ system, allPackages ? import ../../.. }:
{ system, allPackages ? import ../../.., config }:
rec {
@@ -98,7 +98,7 @@ rec {
fetchurlBoot = fetchurl;
inherit system shell gcc overrides;
inherit system shell gcc overrides config;
};
+6 -4
View File
@@ -1,6 +1,8 @@
{ stdenv, pkgs }:
{ stdenv, pkgs, config }:
import ../generic rec {
inherit config;
preHook =
''
export NIX_ENFORCE_PURITY=1
@@ -10,7 +12,7 @@ import ../generic rec {
export NIX_DONT_SET_RPATH=1
export NIX_NO_SELF_RPATH=1
dontFixLibtool=1
stripAllFlags=" " # the Darwin "strip" command doesn't know "-s"
stripAllFlags=" " # the Darwin "strip" command doesn't know "-s"
xargsFlags=" "
fi
'';
@@ -23,7 +25,7 @@ import ../generic rec {
nativeTools = false;
nativeLibc = true;
inherit stdenv;
binutils =
binutils =
if stdenv.isDarwin then
import ../../build-support/native-darwin-cctools-wrapper {inherit stdenv;}
else
@@ -40,7 +42,7 @@ import ../generic rec {
overrides = pkgs_: {
inherit gcc;
inherit (gcc) binutils;
inherit (pkgs)
inherit (pkgs)
gzip bzip2 xz bash coreutils diffutils findutils gawk
gnumake gnused gnutar gnugrep gnupatch perl;
};