2012-12-28 16:36:09 +01:00
|
|
|
|
{ system, allPackages ? import ../../.., config }:
|
2004-03-08 17:02:46 +01:00
|
|
|
|
|
2009-02-02 16:03:38 +01:00
|
|
|
|
rec {
|
2004-03-08 17:02:46 +01:00
|
|
|
|
|
2012-11-29 14:10:49 +01:00
|
|
|
|
shell =
|
2011-11-21 15:11:04 +01:00
|
|
|
|
if system == "i686-freebsd" || system == "x86_64-freebsd" then "/usr/local/bin/bash"
|
2011-11-18 18:41:21 +01:00
|
|
|
|
else "/bin/bash";
|
2008-06-18 17:09:13 +02:00
|
|
|
|
|
2012-11-29 14:10:49 +01:00
|
|
|
|
path =
|
2011-11-21 15:11:04 +01:00
|
|
|
|
(if system == "i686-solaris" then [ "/usr/gnu" ] else []) ++
|
2009-10-16 12:03:27 +02:00
|
|
|
|
(if system == "i686-netbsd" then [ "/usr/pkg" ] else []) ++
|
2013-02-20 10:20:07 +01:00
|
|
|
|
(if system == "x86_64-solaris" then [ "/opt/local/gnu" ] else []) ++
|
2009-09-30 17:19:25 +02:00
|
|
|
|
["/" "/usr" "/usr/local"];
|
2008-06-18 17:09:13 +02:00
|
|
|
|
|
2012-01-19 16:56:17 +01:00
|
|
|
|
prehookBase = ''
|
2008-06-18 17:09:13 +02:00
|
|
|
|
# Disable purity tests; it's allowed (even needed) to link to
|
|
|
|
|
# libraries outside the Nix store (like the C library).
|
|
|
|
|
export NIX_ENFORCE_PURITY=
|
2016-03-15 17:35:07 +01:00
|
|
|
|
export NIX_ENFORCE_NO_NATIVE="''${NIX_ENFORCE_NO_NATIVE-1}"
|
2008-06-18 17:09:13 +02:00
|
|
|
|
'';
|
|
|
|
|
|
2012-01-19 16:56:17 +01:00
|
|
|
|
prehookFreeBSD = ''
|
|
|
|
|
${prehookBase}
|
2012-11-29 14:10:49 +01:00
|
|
|
|
|
2010-02-10 12:54:49 +01:00
|
|
|
|
alias make=gmake
|
|
|
|
|
alias tar=gtar
|
|
|
|
|
alias sed=gsed
|
2008-06-18 17:09:13 +02:00
|
|
|
|
export MAKE=gmake
|
|
|
|
|
shopt -s expand_aliases
|
|
|
|
|
'';
|
|
|
|
|
|
2012-01-19 16:56:17 +01:00
|
|
|
|
prehookOpenBSD = ''
|
|
|
|
|
${prehookBase}
|
2012-11-29 14:10:49 +01:00
|
|
|
|
|
2010-02-08 13:41:15 +01:00
|
|
|
|
alias make=gmake
|
|
|
|
|
alias grep=ggrep
|
|
|
|
|
alias mv=gmv
|
|
|
|
|
alias ln=gln
|
|
|
|
|
alias sed=gsed
|
|
|
|
|
alias tar=gtar
|
2012-11-29 14:10:49 +01:00
|
|
|
|
|
2009-09-23 15:30:04 +02:00
|
|
|
|
export MAKE=gmake
|
|
|
|
|
shopt -s expand_aliases
|
|
|
|
|
'';
|
|
|
|
|
|
2012-01-19 16:56:17 +01:00
|
|
|
|
prehookNetBSD = ''
|
|
|
|
|
${prehookBase}
|
2012-11-29 14:10:49 +01:00
|
|
|
|
|
2009-10-16 12:03:27 +02:00
|
|
|
|
alias make=gmake
|
|
|
|
|
alias sed=gsed
|
2009-10-16 12:09:33 +02:00
|
|
|
|
alias tar=gtar
|
2009-10-16 12:03:27 +02:00
|
|
|
|
export MAKE=gmake
|
|
|
|
|
shopt -s expand_aliases
|
|
|
|
|
'';
|
|
|
|
|
|
2015-05-26 15:18:49 +02:00
|
|
|
|
# prevent libtool from failing to find dynamic libraries
|
2012-01-19 16:56:17 +01:00
|
|
|
|
prehookCygwin = ''
|
|
|
|
|
${prehookBase}
|
2012-11-29 14:10:49 +01:00
|
|
|
|
|
2015-05-26 15:18:49 +02:00
|
|
|
|
shopt -s expand_aliases
|
|
|
|
|
export lt_cv_deplibs_check_method=pass_all
|
2008-06-18 17:09:13 +02:00
|
|
|
|
'';
|
|
|
|
|
|
2015-05-26 15:18:49 +02:00
|
|
|
|
extraBuildInputsCygwin = [
|
|
|
|
|
../cygwin/all-buildinputs-as-runtimedep.sh
|
|
|
|
|
../cygwin/wrap-exes-to-find-dlls.sh
|
|
|
|
|
] ++ (if system == "i686-cygwin" then [
|
|
|
|
|
../cygwin/rebase-i686.sh
|
|
|
|
|
] else if system == "x86_64-cygwin" then [
|
|
|
|
|
../cygwin/rebase-x86_64.sh
|
|
|
|
|
] else []);
|
2008-06-18 17:09:13 +02:00
|
|
|
|
|
|
|
|
|
# A function that builds a "native" stdenv (one that uses tools in
|
2012-11-29 14:10:49 +01:00
|
|
|
|
# /usr etc.).
|
2009-02-02 16:03:38 +01:00
|
|
|
|
makeStdenv =
|
2014-12-27 18:02:58 +01:00
|
|
|
|
{ cc, fetchurl, extraPath ? [], overrides ? (pkgs: { }) }:
|
2009-02-02 16:03:38 +01:00
|
|
|
|
|
|
|
|
|
import ../generic {
|
|
|
|
|
preHook =
|
|
|
|
|
if system == "i686-freebsd" then prehookFreeBSD else
|
2011-11-18 18:41:21 +01:00
|
|
|
|
if system == "x86_64-freebsd" then prehookFreeBSD else
|
2009-09-23 15:30:04 +02:00
|
|
|
|
if system == "i686-openbsd" then prehookOpenBSD else
|
2012-11-29 14:10:49 +01:00
|
|
|
|
if system == "i686-netbsd" then prehookNetBSD else
|
2015-05-26 15:18:49 +02:00
|
|
|
|
if system == "i686-cygwin" then prehookCygwin else
|
|
|
|
|
if system == "x86_64-cygwin" then prehookCygwin else
|
2009-02-02 16:03:38 +01:00
|
|
|
|
prehookBase;
|
2008-06-18 17:09:13 +02:00
|
|
|
|
|
2015-05-26 15:18:49 +02:00
|
|
|
|
extraBuildInputs =
|
|
|
|
|
if system == "i686-cygwin" then extraBuildInputsCygwin else
|
|
|
|
|
if system == "x86_64-cygwin" then extraBuildInputsCygwin else
|
|
|
|
|
[];
|
|
|
|
|
|
2009-02-02 16:03:38 +01:00
|
|
|
|
initialPath = extraPath ++ path;
|
2008-06-18 17:09:13 +02:00
|
|
|
|
|
2009-02-02 16:03:38 +01:00
|
|
|
|
fetchurlBoot = fetchurl;
|
2008-06-18 17:09:13 +02:00
|
|
|
|
|
2014-12-27 18:02:58 +01:00
|
|
|
|
inherit system shell cc overrides config;
|
2008-06-18 17:09:13 +02:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
2009-02-02 16:03:38 +01:00
|
|
|
|
stdenvBoot0 = makeStdenv {
|
2015-06-15 19:26:52 +02:00
|
|
|
|
cc = null;
|
2009-02-02 16:03:38 +01:00
|
|
|
|
fetchurl = null;
|
|
|
|
|
};
|
2012-11-29 14:10:49 +01:00
|
|
|
|
|
2009-02-02 16:03:38 +01:00
|
|
|
|
|
2015-01-09 20:22:12 +01:00
|
|
|
|
cc = import ../../build-support/cc-wrapper {
|
|
|
|
|
name = "cc-native";
|
2009-02-02 16:03:38 +01:00
|
|
|
|
nativeTools = true;
|
|
|
|
|
nativeLibc = true;
|
2013-02-28 15:52:14 +01:00
|
|
|
|
nativePrefix = if system == "i686-solaris" then "/usr/gnu" else if system == "x86_64-solaris" then "/opt/local/gcc47" else "/usr";
|
2009-02-02 16:03:38 +01:00
|
|
|
|
stdenv = stdenvBoot0;
|
2004-03-08 17:02:46 +01:00
|
|
|
|
};
|
2004-03-29 19:23:01 +02:00
|
|
|
|
|
2012-11-29 14:10:49 +01:00
|
|
|
|
|
2009-02-02 16:03:38 +01:00
|
|
|
|
fetchurl = import ../../build-support/fetchurl {
|
|
|
|
|
stdenv = stdenvBoot0;
|
|
|
|
|
# Curl should be in /usr/bin or so.
|
|
|
|
|
curl = null;
|
|
|
|
|
};
|
2012-11-29 14:10:49 +01:00
|
|
|
|
|
|
|
|
|
|
2008-06-18 17:09:13 +02:00
|
|
|
|
# First build a stdenv based only on tools outside the store.
|
|
|
|
|
stdenvBoot1 = makeStdenv {
|
2014-12-27 18:02:58 +01:00
|
|
|
|
inherit cc fetchurl;
|
2009-02-02 16:03:38 +01:00
|
|
|
|
} // {inherit fetchurl;};
|
2008-06-18 17:09:13 +02:00
|
|
|
|
|
2009-02-02 16:03:38 +01:00
|
|
|
|
stdenvBoot1Pkgs = allPackages {
|
2016-11-27 21:37:45 +01:00
|
|
|
|
inherit system platform config;
|
2016-11-27 21:35:58 +01:00
|
|
|
|
allowCustomOverrides = false;
|
|
|
|
|
stdenv = stdenvBoot1;
|
2008-06-18 17:09:13 +02:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
2012-01-19 17:50:09 +01:00
|
|
|
|
# Using that, build a stdenv that adds the ‘xz’ command (which most
|
|
|
|
|
# systems don't have, so we mustn't rely on the native environment
|
|
|
|
|
# providing it).
|
2008-06-18 17:09:13 +02:00
|
|
|
|
stdenvBoot2 = makeStdenv {
|
2014-12-27 18:02:58 +01:00
|
|
|
|
inherit cc fetchurl;
|
2012-01-19 17:50:09 +01:00
|
|
|
|
extraPath = [ stdenvBoot1Pkgs.xz ];
|
|
|
|
|
overrides = pkgs: { inherit (stdenvBoot1Pkgs) xz; };
|
2008-06-18 17:09:13 +02:00
|
|
|
|
};
|
|
|
|
|
|
2009-02-02 16:03:38 +01:00
|
|
|
|
|
2016-04-27 06:18:46 +02:00
|
|
|
|
stdenvNative = stdenvBoot2;
|
2009-02-02 16:03:38 +01:00
|
|
|
|
}
|