* Folded the Cygwin, powerpc-darwin and FreeBSD stdenv into the "native"

stdenv.

svn path=/nixpkgs/trunk/; revision=12147
This commit is contained in:
Eelco Dolstra 2008-06-18 15:09:13 +00:00
parent aab9aee56e
commit 7bf0c5ba01
14 changed files with 122 additions and 173 deletions

View file

@ -21,7 +21,10 @@ stdenv.mkDerivation {
utils = ./utils.sh;
addFlags = ./add-flags;
inherit nativeTools nativeLibc nativePrefix gcc libc binutils;
inherit nativeTools nativeLibc nativePrefix gcc;
libc = if nativeLibc then null else libc;
binutils = if nativeTools then null else binutils;
name = if name == "" then gcc.name else name;
langC = if nativeTools then true else gcc.langC;
langCC = if nativeTools then true else gcc.langCC;

View file

@ -1,25 +0,0 @@
{stdenv, genericStdenv, gccWrapper}:
genericStdenv {
name = "stdenv-native";
preHook = ./prehook.sh;
initialPath = "/usr/local /usr /";
inherit stdenv;
gcc = gccWrapper {
name = "gcc-native";
nativeTools = true;
nativeLibc = true;
nativePrefix = "/usr";
inherit stdenv;
};
shell = "/bin/bash";
fetchurlBoot = import ../../build-support/fetchurl {
inherit stdenv;
# Curl should be in /usr/bin or so.
curl = null;
};
}

View file

@ -1,7 +0,0 @@
export NIX_ENFORCE_PURITY=
if test -z "$cygwinConfigureEnableShared"; then
export configureFlags="$configureFlags --disable-shared"
fi
PATH_DELIMITER=';'

View file

@ -17,12 +17,9 @@ assert system != "i686-cygwin" -> system == stdenvType;
rec {
gccWrapper = import ../build-support/gcc-wrapper;
genericStdenv = import ./generic;
# Trivial environment used for building other environments.
stdenvInitial = (import ./initial) {
stdenvInitial = import ./initial {
name = "stdenv-initial";
inherit system;
};
@ -33,9 +30,8 @@ rec {
# i.e., the stuff in /bin, /usr/bin, etc. This environment should
# be used with care, since many Nix packages will not build properly
# with it (e.g., because they require GNU Make).
stdenvNative = (import ./native) {
stdenv = stdenvInitial;
inherit genericStdenv gccWrapper;
stdenvNative = import ./native {
inherit stdenvInitial;
};
stdenvNativePkgs = allPackages {
@ -45,13 +41,9 @@ rec {
# The Nix build environment.
stdenvNix = (import ./nix) (rec {
stdenv = if system == "i686-darwin" then stdenvPowerpcDarwin else stdenvNative; # !!! hack
pkgs = allPackages {
inherit system;
bootStdenv = removeAttrs stdenv ["gcc"]; # Hack
noSysDirs = false;
};
stdenvNix = import ./nix (rec {
stdenv = stdenvNative;
pkgs = stdenvNativePkgs;
});
@ -59,32 +51,8 @@ rec {
stdenvLinux = (import ./linux {inherit system allPackages;}).stdenvLinux;
# powerpc-darwin (Mac OS X) standard environment. Very simple for now
# (essentially it's just the native environment).
stdenvPowerpcDarwin = (import ./powerpc-darwin) {
stdenv = stdenvInitial;
inherit genericStdenv gccWrapper;
};
# FreeBSD standard environment. Right now this is more or less the
# same as the native environemnt. Eventually we'll want a pure
# environment similar to stdenvLinux.
stdenvFreeBSD = (import ./freebsd) {
stdenv = stdenvInitial;
inherit genericStdenv gccWrapper;
};
# Cygwin standard environment.
stdenvCygwin = (import ./cygwin) {
stdenv = stdenvInitial;
inherit genericStdenv gccWrapper;
};
# MinGW/MSYS standard environment.
stdenvMinGW = (import ./mingw) {
stdenvMinGW = import ./mingw {
inherit system;
};
@ -94,10 +62,7 @@ rec {
if stdenvType == "i686-linux" then stdenvLinux else
if stdenvType == "x86_64-linux" then stdenvLinux else
if stdenvType == "powerpc-linux" then stdenvLinux else
if stdenvType == "i686-freebsd" then stdenvFreeBSD else
if stdenvType == "i686-cygwin" then stdenvCygwin else
if stdenvType == "i686-mingw" then stdenvMinGW else
if stdenvType == "powerpc-darwin" then stdenvPowerpcDarwin else
if stdenvType == "i686-darwin" then stdenvNix else
stdenvNative;
}

View file

@ -1,25 +0,0 @@
{stdenv, genericStdenv, gccWrapper}:
genericStdenv {
name = "stdenv-native";
preHook = ./prehook.sh;
initialPath = "/usr/local /usr /";
inherit stdenv;
gcc = gccWrapper {
name = "gcc-native";
nativeTools = true;
nativeLibc = true;
nativePrefix = "/usr";
inherit stdenv;
};
shell = "/bin/bash";
fetchurlBoot = import ../../build-support/fetchurl {
inherit stdenv;
# Curl should be in /usr/bin or so.
curl = null;
};
}

View file

@ -1,7 +0,0 @@
export NIX_ENFORCE_PURITY=
alias make=gmake
export MAKE=gmake
shopt -s expand_aliases
# Filter out stupid GCC warnings (in gcc-wrapper).
export NIX_GCC_NEEDS_GREP=1

View file

@ -1,7 +1,7 @@
{ stdenv, name, preHook ? null, postHook ? null, initialPath, gcc, shell
, param1 ? "", param2 ? "", param3 ? "", param4 ? "", param5 ? ""
, extraAttrs ? {}
, fetchurlBoot
, fetchurlBoot, forceFetchurlBoot
}:
let {
@ -80,7 +80,9 @@ let {
# "lift" packages like curl from the final stdenv for Linux to
# all-packages.nix for that platform (meaning that it has a line
# like curl = if stdenv ? curl then stdenv.curl else ...).
// extraAttrs;
// extraAttrs
// (if forceFetchurlBoot then {fetchurl = fetchurlBoot;} else {});
}.result;

View file

@ -114,7 +114,7 @@ rec {
shell = bootstrapTools.bash;
initialPath = [staticTools] ++ extraPath;
inherit fetchurlBoot;
extraAttrs = extraAttrs // {fetchurl = fetchurlBoot;};
forceFetchurlBoot = true;
inherit gcc;
};
@ -211,6 +211,7 @@ rec {
shell = stdenvLinuxBoot3Pkgs.bash + "/bin/sh";
fetchurlBoot = stdenvLinuxBoot3.fetchurlBoot;
forceFetchurlBoot = false;
extraAttrs = {
inherit (stdenvLinuxBoot2Pkgs) binutils /* gcc */ glibc;

View file

@ -1,24 +1,101 @@
{stdenv, genericStdenv, gccWrapper}:
{stdenvInitial}:
genericStdenv {
name = "stdenv-native";
preHook = ./prehook.sh;
initialPath = "/usr/local /usr /";
let
inherit stdenv;
gcc = gccWrapper {
name = "gcc-native";
nativeTools = true;
nativeLibc = true;
nativePrefix = "/usr";
inherit stdenv;
};
system = stdenvInitial.system;
shell = "/bin/bash";
extraAttrs = {
# Curl should be in /usr/bin or so.
curl = null;
prehookBase = builtins.toFile "prehook-base.sh" ''
# Disable purity tests; it's allowed (even needed) to link to
# libraries outside the Nix store (like the C library).
export NIX_ENFORCE_PURITY=
'';
prehookDarwin = builtins.toFile "prehook-darwin.sh" ''
source ${prehookBase}
export NIX_DONT_SET_RPATH=1
export NIX_NO_SELF_RPATH=1
dontFixLibtool=1
NIX_STRIP_DEBUG=0
stripAllFlags=" " # the Darwin "strip" command doesn't know "-s"
'';
prehookFreeBSD = builtins.toFile "prehook-freebsd.sh" ''
source ${prehookBase}
alias make=gmake
export MAKE=gmake
shopt -s expand_aliases
# Filter out stupid GCC warnings (in gcc-wrapper).
export NIX_GCC_NEEDS_GREP=1
'';
prehookCygwin = builtins.toFile "prehook-cygwin.sh" ''
source ${prehookBase}
if test -z "$cygwinConfigureEnableShared"; then
export configureFlags="$configureFlags --disable-shared"
fi
PATH_DELIMITER=';'
'';
# A function that builds a "native" stdenv (one that uses tools in
# /usr etc.).
makeStdenv = {stdenvBoot, extraPath, forceFetchurlBoot}: import ../generic {
name = "stdenv-native";
preHook =
if system == "i686-darwin" || system == "powerpc-darwin" then prehookDarwin else
if system == "i686-freebsd" then prehookFreeBSD else
prehookBase;
initialPath = extraPath ++ ["/" "/usr" "/usr/local"];
stdenv = stdenvBoot;
gcc = import ../../build-support/gcc-wrapper {
name = "gcc-native";
nativeTools = true;
nativeLibc = true;
nativePrefix = "/usr";
stdenv = stdenvBoot;
};
inherit shell forceFetchurlBoot;
fetchurlBoot = import ../../build-support/fetchurl {
stdenv = stdenvBoot;
# Curl should be in /usr/bin or so.
curl = null;
};
};
}
# First build a stdenv based only on tools outside the store.
stdenvBoot1 = makeStdenv {
stdenvBoot = stdenvInitial;
extraPath = [];
forceFetchurlBoot = true;
};
stdenvBoot1Pkgs = import ../../.. {
inherit system;
bootStdenv = stdenvBoot1;
};
# Using that, build a stdenv that adds the `replace' command (which
# most systems don't have, so we mustn't rely on the native
# environment providing it).
stdenvBoot2 = makeStdenv {
stdenvBoot = stdenvBoot1;
extraPath = [stdenvBoot1Pkgs.replace];
forceFetchurlBoot = false;
};
in stdenvBoot2

View file

@ -1 +0,0 @@
export NIX_ENFORCE_PURITY=

View file

@ -22,8 +22,6 @@ import ../generic {
shell = pkgs.bash + "/bin/sh";
fetchurlBoot = import ../../build-support/fetchurl {
inherit stdenv;
curl = pkgs.curl;
};
fetchurlBoot = stdenv.fetchurlBoot;
forceFetchurlBoot = false;
}

View file

@ -1,25 +0,0 @@
{stdenv, genericStdenv, gccWrapper}:
genericStdenv {
name = "stdenv-darwin";
preHook = ./prehook.sh;
initialPath = "/usr/local /usr /";
inherit stdenv;
gcc = gccWrapper {
name = "gcc-darwin";
nativeTools = true;
nativeLibc = true;
nativePrefix = "/usr";
inherit stdenv;
};
shell = "/bin/sh";
fetchurlBoot = import ../../build-support/fetchurl {
inherit stdenv;
# Curl should be in /usr/bin or so.
curl = null;
};
}

View file

@ -1,6 +0,0 @@
export NIX_ENFORCE_PURITY=
export NIX_DONT_SET_RPATH=1
export NIX_NO_SELF_RPATH=1
dontFixLibtool=1
NIX_STRIP_DEBUG=0
stripAllFlags=" " # the Darwin "strip" command doesn't know "-s"

View file

@ -247,11 +247,12 @@ let pkgs = rec {
### STANDARD ENVIRONMENT
defaultStdenv =
(import ../stdenv {
inherit system stdenvType;
allPackages = import ./all-packages.nix;
}).stdenv;
allStdenvs = import ../stdenv {
inherit system stdenvType;
allPackages = import ./all-packages.nix;
};
defaultStdenv = allStdenvs.stdenv;
stdenv =
if bootStdenv != null then bootStdenv else
@ -1713,17 +1714,15 @@ let pkgs = rec {
inherit fetchurl stdenv visualcpp windowssdk;
};
wrapGCC = baseGCC: wrapGCCWithGlibc baseGCC glibc;
wrapGCCWithGlibc = baseGCC: glibc: import ../build-support/gcc-wrapper {
wrapGCC = baseGCC: import ../build-support/gcc-wrapper {
nativeTools = stdenv ? gcc && stdenv.gcc.nativeTools;
nativeLibc = stdenv ? gcc && stdenv.gcc.nativeLibc;
nativePrefix = if stdenv ? gcc then stdenv.gcc.nativePrefix else "";
gcc = baseGCC;
libc = glibc;
inherit stdenv binutils;
};
# FIXME: This is a specific hack for GCC-UPC. Eventually, we may
# want to merge `gcc-upc-wrapper' and `gcc-wrapper'.
wrapGCCUPC = baseGCC: import ../build-support/gcc-upc-wrapper {