tangled
alpha
login
or
join now
pyrox.dev
/
nixpkgs
lol
0
fork
atom
overview
issues
pulls
pipelines
new darwin stdenv
Eric Seidel
11 years ago
92188d9d
6f7632a7
+198
-53
3 changed files
expand all
collapse all
unified
split
pkgs
stdenv
darwin
default.nix
trivialBootstrap.sh
default.nix
+130
-32
pkgs/stdenv/darwin/default.nix
···
1
-
{ stdenv, pkgs, config
2
-
, haveLibCxx ? true
3
-
, useClang33 ? true }:
0
0
0
0
0
4
5
-
import ../generic rec {
6
-
inherit config;
7
8
-
preHook =
9
-
''
10
-
export NIX_ENFORCE_PURITY=
11
-
export NIX_IGNORE_LD_THROUGH_GCC=1
12
-
export NIX_DONT_SET_RPATH=1
13
-
export NIX_NO_SELF_RPATH=1
14
-
${import ./prehook.nix}
15
-
'';
16
17
-
initialPath = (import ../common-path.nix) {pkgs = pkgs;};
0
0
18
19
-
system = stdenv.system;
0
0
0
0
0
20
21
-
cc = import ../../build-support/cc-wrapper {
22
-
nativeTools = false;
23
-
nativeLibc = true;
24
-
inherit stdenv;
25
-
extraPackages = stdenv.lib.optional haveLibCxx pkgs.libcxx;
26
-
binutils = import ../../build-support/native-darwin-cctools-wrapper {inherit stdenv;};
27
-
cc = if useClang33 then pkgs.clang_33.cc else pkgs.clang.cc;
28
-
coreutils = pkgs.coreutils;
29
-
shell = pkgs.bash + "/bin/sh";
30
};
31
32
-
shell = pkgs.bash + "/bin/sh";
0
0
0
0
0
33
34
-
fetchurlBoot = stdenv.fetchurlBoot;
0
0
0
0
0
0
0
0
0
0
0
0
0
35
36
-
overrides = pkgs_: {
37
-
inherit cc;
38
-
inherit (cc) binutils;
39
-
inherit (pkgs)
40
-
gzip bzip2 xz bash coreutils diffutils findutils gawk
41
-
gnumake gnused gnutar gnugrep gnupatch perl libcxx libcxxabi;
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
42
};
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
43
}
···
1
+
{ system ? builtins.currentSystem
2
+
, allPackages ? import ../../top-level/all-packages.nix
3
+
, platform ? null
4
+
, config ? {}
5
+
}:
6
+
7
+
rec {
8
+
allPackages = import ../../top-level/all-packages.nix;
9
10
+
bootstrapTools = derivation {
11
+
inherit system;
12
13
+
name = "trivial-bootstrap-tools";
14
+
builder = "/bin/sh";
15
+
args = [ ./trivialBootstrap.sh ];
0
0
0
0
0
16
17
+
mkdir = "/bin/mkdir";
18
+
ln = "/bin/ln";
19
+
};
20
21
+
# The simplest stdenv possible to run fetchadc and get the Apple command-line tools
22
+
stage0 = rec {
23
+
fetchurl = import ../../build-support/fetchurl {
24
+
inherit stdenv;
25
+
curl = bootstrapTools;
26
+
};
27
28
+
stdenv = import ../generic {
29
+
inherit system config;
30
+
name = "stdenv-darwin-boot-0";
31
+
shell = "/bin/bash";
32
+
initialPath = [ bootstrapTools ];
33
+
fetchurlBoot = fetchurl;
34
+
cc = "/no-such-path";
35
+
};
0
36
};
37
38
+
buildTools = import ../../os-specific/darwin/command-line-tools {
39
+
inherit (stage0) stdenv fetchurl;
40
+
xar = bootstrapTools;
41
+
gzip = bootstrapTools;
42
+
cpio = bootstrapTools;
43
+
};
44
45
+
preHook = ''
46
+
export NIX_IGNORE_LD_THROUGH_GCC=1
47
+
export NIX_DONT_SET_RPATH=1
48
+
export NIX_NO_SELF_RPATH=1
49
+
dontFixLibtool=1
50
+
stripAllFlags=" " # the Darwin "strip" command doesn't know "-s"
51
+
xargsFlags=" "
52
+
export MACOSX_DEPLOYMENT_TARGET=10.7
53
+
export SDKROOT=
54
+
export SDKROOT_X=/ # FIXME: impure!
55
+
export NIX_CFLAGS_COMPILE+=" --sysroot=/var/empty -idirafter $SDKROOT_X/usr/include -F$SDKROOT_X/System/Library/Frameworks -Wno-multichar -Wno-deprecated-declarations"
56
+
export NIX_LDFLAGS_AFTER+=" -L$SDKROOT_X/usr/lib"
57
+
export CMAKE_OSX_ARCHITECTURES=x86_64
58
+
'';
59
60
+
# A stdenv that wraps the Apple command-line tools and our other trivial symlinked bootstrap tools
61
+
stage1 = rec {
62
+
nativePrefix = "${buildTools.tools}/Library/Developer/CommandLineTools/usr";
63
+
64
+
stdenv = import ../generic {
65
+
name = "stdenv-darwin-boot-1";
66
+
67
+
inherit system config;
68
+
inherit (stage0.stdenv) shell initialPath fetchurlBoot;
69
+
70
+
preHook = preHook + "\n" + ''
71
+
export NIX_LDFLAGS_AFTER+=" -L/usr/lib"
72
+
export NIX_ENFORCE_PURITY=
73
+
export NIX_CFLAGS_COMPILE+=" -isystem ${nativePrefix}/include/c++/v1 -stdlib=libc++"
74
+
export NIX_CFLAGS_LINK+=" -stdlib=libc++ -Wl,-rpath,${nativePrefix}/lib"
75
+
'';
76
+
77
+
cc = import ../../build-support/cc-wrapper {
78
+
nativeTools = true;
79
+
nativePrefix = nativePrefix;
80
+
nativeLibc = true;
81
+
stdenv = stage0.stdenv;
82
+
shell = "/bin/bash";
83
+
cc = {
84
+
name = "clang-9.9.9";
85
+
cc = "/usr";
86
+
outPath = "${buildTools.tools}/Library/Developer/CommandLineTools/usr";
87
+
};
88
+
};
89
+
};
90
+
pkgs = allPackages {
91
+
inherit system platform;
92
+
bootStdenv = stdenv;
93
+
};
94
+
};
95
+
96
+
stage2 = rec {
97
+
stdenv = import ../generic {
98
+
name = "stdenv-darwin-boot-2";
99
+
100
+
inherit system config;
101
+
inherit (stage1.stdenv) shell fetchurlBoot preHook cc;
102
+
103
+
initialPath = [ stage1.pkgs.xz ] ++ stage1.stdenv.initialPath;
104
+
};
105
+
pkgs = allPackages {
106
+
inherit system platform;
107
+
bootStdenv = stdenv;
108
+
};
109
};
110
+
111
+
# Use stage1 to build a whole set of actual tools so we don't have to rely on the Apple prebuilt ones or
112
+
# the ugly symlinked bootstrap tools anymore.
113
+
stage3 = with stage2; import ../generic {
114
+
name = "stdenv-darwin-boot-3";
115
+
116
+
inherit system config;
117
+
inherit (stdenv) fetchurlBoot;
118
+
119
+
initialPath = (import ../common-path.nix) { inherit pkgs; };
120
+
121
+
preHook = preHook + "\n" + ''
122
+
export NIX_ENFORCE_PURITY=1
123
+
'';
124
+
125
+
cc = import ../../build-support/cc-wrapper {
126
+
inherit stdenv;
127
+
nativeTools = false;
128
+
nativeLibc = true;
129
+
binutils = pkgs.darwin.cctools_native;
130
+
cc = pkgs.llvmPackages.clang;
131
+
coreutils = pkgs.coreutils;
132
+
shell = "${pkgs.bash}/bin/bash";
133
+
};
134
+
135
+
extraBuildInputs = [ pkgs.libcxx ];
136
+
137
+
shell = "${pkgs.bash}/bin/bash";
138
+
};
139
+
140
+
stdenvDarwin = stage3;
141
}
+66
pkgs/stdenv/darwin/trivialBootstrap.sh
···
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
···
1
+
2
+
# Building bootstrap tools
3
+
echo Building the trivial bootstrap environment...
4
+
$mkdir -p $out/bin
5
+
6
+
$ln -s $ln $out/bin/ln
7
+
8
+
PATH=$out/bin/
9
+
10
+
cd $out/bin
11
+
12
+
ln -s $mkdir
13
+
ln -s /bin/sh
14
+
ln -s /bin/cp
15
+
ln -s /bin/mv
16
+
ln -s /bin/rm
17
+
ln -s /bin/ls
18
+
ln -s /bin/ps
19
+
ln -s /bin/cat
20
+
ln -s /bin/bash
21
+
ln -s /bin/echo
22
+
ln -s /bin/expr
23
+
ln -s /bin/test
24
+
ln -s /bin/date
25
+
ln -s /bin/chmod
26
+
ln -s /bin/rmdir
27
+
ln -s /bin/sleep
28
+
ln -s /bin/hostname
29
+
30
+
ln -s /usr/bin/id
31
+
ln -s /usr/bin/od
32
+
ln -s /usr/bin/tr
33
+
ln -s /usr/bin/wc
34
+
ln -s /usr/bin/cut
35
+
ln -s /usr/bin/cmp
36
+
ln -s /usr/bin/sed
37
+
ln -s /usr/bin/tar
38
+
ln -s /usr/bin/xar
39
+
ln -s /usr/bin/awk
40
+
ln -s /usr/bin/env
41
+
ln -s /usr/bin/tee
42
+
ln -s /usr/bin/comm
43
+
ln -s /usr/bin/cpio
44
+
ln -s /usr/bin/curl
45
+
ln -s /usr/bin/find
46
+
ln -s /usr/bin/grep
47
+
ln -s /usr/bin/gzip
48
+
ln -s /usr/bin/head
49
+
ln -s /usr/bin/tail
50
+
ln -s /usr/bin/sort
51
+
ln -s /usr/bin/uniq
52
+
ln -s /usr/bin/less
53
+
ln -s /usr/bin/true
54
+
ln -s /usr/bin/diff
55
+
ln -s /usr/bin/egrep
56
+
ln -s /usr/bin/fgrep
57
+
ln -s /usr/bin/patch
58
+
ln -s /usr/bin/uname
59
+
ln -s /usr/bin/touch
60
+
ln -s /usr/bin/split
61
+
ln -s /usr/bin/xargs
62
+
ln -s /usr/bin/which
63
+
ln -s /usr/bin/install
64
+
ln -s /usr/bin/basename
65
+
ln -s /usr/bin/dirname
66
+
ln -s /usr/bin/readlink
+2
-21
pkgs/stdenv/default.nix
···
33
pkgs = stdenvNativePkgs;
34
};
35
36
-
stdenvDarwin = import ./darwin {
37
-
inherit config;
38
-
stdenv = stdenvNative;
39
-
pkgs = stdenvNativePkgs;
40
-
};
41
-
42
-
stdenvDarwinNaked = import ./darwin {
43
-
inherit config;
44
-
stdenv = stdenvNative;
45
-
pkgs = stdenvNativePkgs;
46
-
haveLibCxx = false;
47
-
};
48
-
49
-
stdenvDarwin33 = import ./darwin {
50
-
inherit config;
51
-
stdenv = stdenvNative;
52
-
pkgs = stdenvNativePkgs;
53
-
useClang33 = true;
54
-
};
55
-
56
-
57
# Linux standard environment.
58
stdenvLinux = (import ./linux { inherit system allPackages platform config lib; }).stdenvLinux;
59
0
0
60
61
# Select the appropriate stdenv for the platform `system'.
62
stdenv =
···
33
pkgs = stdenvNativePkgs;
34
};
35
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
36
# Linux standard environment.
37
stdenvLinux = (import ./linux { inherit system allPackages platform config lib; }).stdenvLinux;
38
39
+
# Darwin standard environment.
40
+
stdenvDarwin = (import ./darwin { inherit system allPackages platform config;}).stdenvDarwin;
41
42
# Select the appropriate stdenv for the platform `system'.
43
stdenv =