2011-11-18 17:41:21 +00:00
|
|
|
{ system, allPackages ? import ../../.. }:
|
2004-03-08 16:02:46 +00:00
|
|
|
|
2009-02-02 15:03:38 +00:00
|
|
|
rec {
|
2004-03-08 16:02:46 +00:00
|
|
|
|
2011-11-18 17:41:21 +00:00
|
|
|
shell =
|
2011-11-21 14:11:04 +00:00
|
|
|
if system == "i686-freebsd" || system == "x86_64-freebsd" then "/usr/local/bin/bash"
|
2011-11-18 17:41:21 +00:00
|
|
|
else "/bin/bash";
|
2008-06-18 16:09:13 +01:00
|
|
|
|
2011-11-18 17:41:21 +00:00
|
|
|
path =
|
2011-11-21 14:11:04 +00:00
|
|
|
(if system == "i686-solaris" then [ "/usr/gnu" ] else []) ++
|
2009-10-16 11:03:27 +01:00
|
|
|
(if system == "i686-netbsd" then [ "/usr/pkg" ] else []) ++
|
2009-09-30 16:19:25 +01:00
|
|
|
["/" "/usr" "/usr/local"];
|
2008-06-18 16:09:13 +01:00
|
|
|
|
|
|
|
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}
|
|
|
|
|
2010-02-10 11:54:49 +00:00
|
|
|
alias make=gmake
|
|
|
|
alias tar=gtar
|
|
|
|
alias sed=gsed
|
2008-06-18 16:09:13 +01:00
|
|
|
export MAKE=gmake
|
|
|
|
shopt -s expand_aliases
|
|
|
|
|
|
|
|
# Filter out stupid GCC warnings (in gcc-wrapper).
|
|
|
|
export NIX_GCC_NEEDS_GREP=1
|
|
|
|
'';
|
|
|
|
|
2009-09-23 14:30:04 +01:00
|
|
|
prehookOpenBSD = builtins.toFile "prehook-openbsd.sh" ''
|
|
|
|
source ${prehookBase}
|
|
|
|
|
2010-02-08 12:41:15 +00:00
|
|
|
alias make=gmake
|
|
|
|
alias grep=ggrep
|
|
|
|
alias mv=gmv
|
|
|
|
alias ln=gln
|
|
|
|
alias sed=gsed
|
|
|
|
alias tar=gtar
|
2009-10-16 11:21:27 +01:00
|
|
|
|
2009-09-23 14:30:04 +01:00
|
|
|
export MAKE=gmake
|
|
|
|
shopt -s expand_aliases
|
|
|
|
|
|
|
|
# Filter out stupid GCC warnings (in gcc-wrapper).
|
|
|
|
export NIX_GCC_NEEDS_GREP=1
|
|
|
|
'';
|
|
|
|
|
2009-10-16 11:03:27 +01:00
|
|
|
prehookNetBSD = builtins.toFile "prehook-netbsd.sh" ''
|
|
|
|
source ${prehookBase}
|
|
|
|
|
|
|
|
alias make=gmake
|
|
|
|
alias sed=gsed
|
2009-10-16 11:09:33 +01:00
|
|
|
alias tar=gtar
|
2009-10-16 11:03:27 +01:00
|
|
|
export MAKE=gmake
|
|
|
|
shopt -s expand_aliases
|
|
|
|
|
|
|
|
# Filter out stupid GCC warnings (in gcc-wrapper).
|
|
|
|
export NIX_GCC_NEEDS_GREP=1
|
|
|
|
'';
|
|
|
|
|
2008-06-18 16:09:13 +01:00
|
|
|
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.).
|
2009-02-02 15:03:38 +00:00
|
|
|
makeStdenv =
|
|
|
|
{gcc, fetchurl, extraPath ? []}:
|
|
|
|
|
|
|
|
import ../generic {
|
|
|
|
name = "stdenv-native";
|
2008-06-18 16:09:13 +01:00
|
|
|
|
2009-02-02 15:03:38 +00:00
|
|
|
preHook =
|
2009-11-26 15:45:31 +00:00
|
|
|
if system == "i686-darwin" || system == "powerpc-darwin" || system == "x86_64-darwin" then prehookDarwin else
|
2009-02-02 15:03:38 +00:00
|
|
|
if system == "i686-freebsd" then prehookFreeBSD else
|
2011-11-18 17:41:21 +00:00
|
|
|
if system == "x86_64-freebsd" then prehookFreeBSD else
|
2009-09-23 14:30:04 +01:00
|
|
|
if system == "i686-openbsd" then prehookOpenBSD else
|
2009-10-16 11:03:27 +01:00
|
|
|
if system == "i686-netbsd" then prehookNetBSD else
|
2009-02-02 15:03:38 +00:00
|
|
|
prehookBase;
|
2008-06-18 16:09:13 +01:00
|
|
|
|
2009-02-02 15:03:38 +00:00
|
|
|
initialPath = extraPath ++ path;
|
2008-06-18 16:09:13 +01:00
|
|
|
|
2009-02-02 15:03:38 +00:00
|
|
|
fetchurlBoot = fetchurl;
|
2008-06-18 16:09:13 +01:00
|
|
|
|
2009-02-02 15:03:38 +00:00
|
|
|
inherit system shell gcc;
|
2008-06-18 16:09:13 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2009-02-02 15:03:38 +00:00
|
|
|
stdenvBoot0 = makeStdenv {
|
|
|
|
gcc = "/no-such-path";
|
|
|
|
fetchurl = null;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
gcc = import ../../build-support/gcc-wrapper {
|
|
|
|
name = "gcc-native";
|
|
|
|
nativeTools = true;
|
|
|
|
nativeLibc = true;
|
2011-11-21 14:11:04 +00:00
|
|
|
nativePrefix = if system == "i686-solaris" then "/usr/gnu" else "/usr";
|
2009-02-02 15:03:38 +00:00
|
|
|
stdenv = stdenvBoot0;
|
2004-03-08 16:02:46 +00:00
|
|
|
};
|
2004-03-29 18:23:01 +01:00
|
|
|
|
2009-02-02 15:03:38 +00:00
|
|
|
|
|
|
|
fetchurl = import ../../build-support/fetchurl {
|
|
|
|
stdenv = stdenvBoot0;
|
|
|
|
# Curl should be in /usr/bin or so.
|
|
|
|
curl = null;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2008-06-18 16:09:13 +01:00
|
|
|
# First build a stdenv based only on tools outside the store.
|
|
|
|
stdenvBoot1 = makeStdenv {
|
2009-02-02 15:03:38 +00:00
|
|
|
inherit gcc fetchurl;
|
|
|
|
} // {inherit fetchurl;};
|
2008-06-18 16:09:13 +01:00
|
|
|
|
2009-02-02 15:03:38 +00:00
|
|
|
stdenvBoot1Pkgs = allPackages {
|
2008-06-18 16:09:13 +01:00
|
|
|
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 {
|
2009-02-02 15:03:38 +00:00
|
|
|
inherit gcc fetchurl;
|
2008-06-18 16:09:13 +01:00
|
|
|
extraPath = [stdenvBoot1Pkgs.replace];
|
|
|
|
};
|
|
|
|
|
2009-02-02 15:03:38 +00:00
|
|
|
|
|
|
|
stdenv = stdenvBoot2;
|
|
|
|
}
|