···24 ++ lib.optional stdenv.isSunOS ./ld-shared.patch
25 ++ lib.optional stdenv.isDarwin [ ./cpp-precomp.patch ./no-libutil.patch ] ;
260000000000027 # Build a thread-safe Perl with a dynamic libperls.o. We need the
28 # "installstyle" option to ensure that modules are put under
29 # $out/lib/perl5 - this is the general default, but because $out
···24 ++ lib.optional stdenv.isSunOS ./ld-shared.patch
25 ++ lib.optional stdenv.isDarwin [ ./cpp-precomp.patch ./no-libutil.patch ] ;
2627+ # There's an annoying bug on sandboxed Darwin in Perl's Cwd.pm where it looks for pwd
28+ # in /bin/pwd and /usr/bin/pwd and then falls back on just "pwd" if it can't get them
29+ # while at the same time erasing the PATH environment variable so it unconditionally
30+ # fails. The code in question is guarded by a check for Mac OS, but the patch below
31+ # doesn't have any runtime effect on other platforms.
32+ postPatch = ''
33+ pwd="$(type -P pwd)"
34+ substituteInPlace dist/Cwd/Cwd.pm \
35+ --replace "pwd_cmd = 'pwd'" "pwd_cmd = '$pwd'"
36+ '';
37+38 # Build a thread-safe Perl with a dynamic libperls.o. We need the
39 # "installstyle" option to ensure that modules are put under
40 # $out/lib/perl5 - this is the general default, but because $out
···35 ++ optional stdenv.isSunOS ./ld-shared.patch
36 ++ stdenv.lib.optional stdenv.isDarwin [ ./cpp-precomp.patch ./no-libutil.patch ] ;
370000000000038 # Build a thread-safe Perl with a dynamic libperls.o. We need the
39 # "installstyle" option to ensure that modules are put under
40 # $out/lib/perl5 - this is the general default, but because $out
···35 ++ optional stdenv.isSunOS ./ld-shared.patch
36 ++ stdenv.lib.optional stdenv.isDarwin [ ./cpp-precomp.patch ./no-libutil.patch ] ;
3738+ # There's an annoying bug on sandboxed Darwin in Perl's Cwd.pm where it looks for pwd
39+ # in /bin/pwd and /usr/bin/pwd and then falls back on just "pwd" if it can't get them
40+ # while at the same time erasing the PATH environment variable so it unconditionally
41+ # fails. The code in question is guarded by a check for Mac OS, but the patch below
42+ # doesn't have any runtime effect on other platforms.
43+ postPatch = ''
44+ pwd="$(type -P pwd)"
45+ substituteInPlace dist/PathTools/Cwd.pm \
46+ --replace "pwd_cmd = 'pwd'" "pwd_cmd = '$pwd'"
47+ '';
48+49 # Build a thread-safe Perl with a dynamic libperls.o. We need the
50 # "installstyle" option to ensure that modules are put under
51 # $out/lib/perl5 - this is the general default, but because $out
···62 for i in Lib/plat-*/regen; do
63 substituteInPlace $i --replace /usr/include/ ${stdenv.cc.libc}/include/
64 done
0065 '';
6667 configureFlags = [
···72 "--with-system-ffi"
73 "--with-system-expat"
74 "ac_cv_func_bind_textdomain_codeset=yes"
0075 ];
7677 postConfigure = if stdenv.isCygwin then ''
···62 for i in Lib/plat-*/regen; do
63 substituteInPlace $i --replace /usr/include/ ${stdenv.cc.libc}/include/
64 done
65+ '' + optionalString stdenv.isDarwin ''
66+ substituteInPlace configure --replace '`/usr/bin/arch`' '"i386"'
67 '';
6869 configureFlags = [
···74 "--with-system-ffi"
75 "--with-system-expat"
76 "ac_cv_func_bind_textdomain_codeset=yes"
77+ ] ++ optionals stdenv.isDarwin [
78+ "--disable-toolbox-glue"
79 ];
8081 postConfigure = if stdenv.isCygwin then ''
+6-1
pkgs/development/libraries/gettext/default.nix
···19 "--with-included-gettext"
20 "--with-included-glib"
21 "--with-included-libcroco"
22- ]);
000002324 # On cross building, gettext supposes that the wchar.h from libc
25 # does not fulfill gettext needs, so it tries to work with its
···19 "--with-included-gettext"
20 "--with-included-glib"
21 "--with-included-libcroco"
22+ ])
23+ # avoid retaining reference to CF during stdenv bootstrap
24+ ++ (stdenv.lib.optionals stdenv.isDarwin [
25+ "gt_cv_func_CFPreferencesCopyAppValue=no"
26+ "gt_cv_func_CFLocaleCopyCurrent=no"
27+ ]);
2829 # On cross building, gettext supposes that the wchar.h from libc
30 # does not fulfill gettext needs, so it tries to work with its
+5
pkgs/development/libraries/icu/default.nix
···32 configureFlags = "--disable-debug" +
33 stdenv.lib.optionalString stdenv.isDarwin " --enable-rpath";
340000035 enableParallelBuilding = true;
3637 meta = with stdenv.lib; {
···32 configureFlags = "--disable-debug" +
33 stdenv.lib.optionalString stdenv.isDarwin " --enable-rpath";
3435+ # remove dependency on bootstrap-tools in early stdenv build
36+ postInstall = stdenv.lib.optionalString stdenv.isDarwin ''
37+ sed -i 's/INSTALL_CMD=.*install/INSTALL_CMD=install/' $out/lib/icu/${version}/pkgdata.inc
38+ '';
39+40 enableParallelBuilding = true;
4142 meta = with stdenv.lib; {
···1+{ stdenv, binutils-raw, cctools }:
2+3+stdenv.mkDerivation {
4+ name = "cctools-binutils-darwin";
5+ buildCommand = ''
6+ mkdir -p $out/bin $out/include
7+8+ ln -s ${binutils-raw}/bin/c++filt $out/bin/c++filt
9+10+ # We specifically need:
11+ # - ld: binutils doesn't provide it on darwin
12+ # - as: as above
13+ # - ar: the binutils one prodices .a files that the cctools ld doesn't like
14+ # - ranlib: for compatibility with ar
15+ # - dsymutil: soon going away once it goes into LLVM (this one is fake anyway)
16+ # - otool: we use it for some of our name mangling
17+ # - install_name_tool: we use it to rewrite stuff in our bootstrap tools
18+ # - strip: the binutils one seems to break mach-o files
19+ # - lipo: gcc build assumes it exists
20+ # - nm: the gnu one doesn't understand many new load commands
21+ for i in ar ranlib as dsymutil install_name_tool ld strip otool lipo nm strings size; do
22+ ln -sf "${cctools}/bin/$i" "$out/bin/$i"
23+ done
24+25+ for i in ${binutils-raw}/include/*.h; do
26+ ln -s "$i" "$out/include/$(basename $i)"
27+ done
28+29+ for i in ${cctools}/include/*; do
30+ ln -s "$i" "$out/include/$(basename $i)"
31+ done
32+33+ # FIXME: this will give us incorrect man pages for bits of cctools
34+ ln -s ${binutils-raw}/share $out/share
35+ ln -s ${binutils-raw}/lib $out/lib
36+37+ ln -s ${cctools}/libexec $out/libexec
38+ '';
39+}
+252-102
pkgs/stdenv/darwin/default.nix
···4, config ? {}
5}:
67-rec {
000000000000008 allPackages = import ../../top-level/all-packages.nix;
910- bootstrapTools = derivation {
11- inherit system;
000000000000000000000000000001213- name = "trivial-bootstrap-tools";
14- builder = "/bin/sh";
15- args = [ ./trivial-bootstrap.sh ];
1617- mkdir = "/bin/mkdir";
18- ln = "/bin/ln";
19 };
2021- # 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;
0000000000000000000000000000000000000000000000000000000000000000000000000000000026 };
2728- 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";
00000000000000000035 };
36 };
3738- buildTools = import ../../os-specific/darwin/command-line-tools {
39- inherit (stage0) stdenv fetchurl;
40- xar = bootstrapTools;
41- gzip = bootstrapTools;
42- cpio = bootstrapTools;
0043 };
4445- 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- # Use the 10.9 SDK if we're running on 10.9, and 10.10 if we're
54- # running on 10.10. We need to use the 10.10 headers for functions
55- # like readlinkat() that are dynamically detected by configure
56- # scripts. Very impure, obviously.
57- export SDKROOT=$(/usr/bin/xcrun --sdk macosx"$(/usr/bin/sw_vers -productVersion | /usr/bin/cut -d. -f1,2)" --show-sdk-path 2> /dev/null || echo /)
58- export NIX_CFLAGS_COMPILE+=" --sysroot=/var/empty -idirafter $SDKROOT/usr/include -F$SDKROOT/System/Library/Frameworks -Wno-multichar -Wno-deprecated-declarations"
59- export NIX_LDFLAGS_AFTER+=" -L$SDKROOT/usr/lib"
60- export CMAKE_OSX_ARCHITECTURES=x86_64
61- '';
6263- # A stdenv that wraps the Apple command-line tools and our other trivial symlinked bootstrap tools
64- stage1 = rec {
65- nativePrefix = "${buildTools.tools}/Library/Developer/CommandLineTools/usr";
6667- stdenv = import ../generic {
68- name = "stdenv-darwin-boot-1";
0006970- inherit system config;
71- inherit (stage0.stdenv) shell fetchurlBoot;
007273- initialPath = stage0.stdenv.initialPath ++ [ nativePrefix ];
07475- preHook = preHook + "\n" + ''
76- export NIX_LDFLAGS_AFTER+=" -L/usr/lib"
77- export NIX_ENFORCE_PURITY=
78- export NIX_CFLAGS_COMPILE+=" -isystem ${nativePrefix}/include/c++/v1 -stdlib=libc++"
79- export NIX_CFLAGS_LINK+=" -stdlib=libc++ -Wl,-rpath,${nativePrefix}/lib"
80- '';
8182- cc = import ../../build-support/cc-wrapper {
83- nativeTools = true;
84- nativePrefix = nativePrefix;
85- nativeLibc = true;
86- stdenv = stage0.stdenv;
87- shell = "/bin/bash";
88- cc = {
89- name = "clang-9.9.9";
90- cc = "/usr";
91- outPath = nativePrefix;
92- };
93- isClang = true;
94- };
95 };
96- pkgs = allPackages {
97- inherit system platform;
98- bootStdenv = stdenv;
99 };
100 };
101102- stage2 = rec {
103- stdenv = import ../generic {
104- name = "stdenv-darwin-boot-2";
00105106- inherit system config;
107- inherit (stage1.stdenv) shell fetchurlBoot preHook cc;
000108109- initialPath = [ stage1.pkgs.xz ] ++ stage1.stdenv.initialPath;
0110 };
111- pkgs = allPackages {
112- inherit system platform;
113- bootStdenv = stdenv;
114 };
115 };
116117- # Use stage1 to build a whole set of actual tools so we don't have to rely on the Apple prebuilt ones or
118- # the ugly symlinked bootstrap tools anymore.
119- stage3 = with stage2; import ../generic {
120- name = "stdenv-darwin-boot-3";
121-122 inherit system config;
123 inherit (stdenv) fetchurlBoot;
124125- initialPath = (import ../common-path.nix) { inherit pkgs; };
126127- preHook = preHook + "\n" + ''
128- export NIX_ENFORCE_PURITY=1
129- '';
0000130131 cc = import ../../build-support/cc-wrapper {
132- inherit stdenv;
133- nativeTools = false;
134- nativeLibc = true;
135- binutils = pkgs.darwin.cctools;
136- cc = pkgs.llvmPackages.clang-unwrapped;
137- coreutils = pkgs.coreutils;
138- shell = "${pkgs.bash}/bin/bash";
139- extraPackages = [ pkgs.libcxx ];
140- isClang = true;
141 };
142143- shell = "${pkgs.bash}/bin/bash";
144- };
00000145146- stdenvDarwin = stage3;
000000000000147}
···37 stdenvLinux = (import ./linux { inherit system allPackages platform config lib; }).stdenvLinux;
3839 # Darwin standard environment.
40- stdenvDarwin = (import ./darwin { inherit system allPackages platform config;}).stdenvDarwin;
4142 # Select the appropriate stdenv for the platform `system'.
43 stdenv =
···37 stdenvLinux = (import ./linux { inherit system allPackages platform config lib; }).stdenvLinux;
3839 # Darwin standard environment.
40+ stdenvDarwin = (import ./darwin { inherit system allPackages platform config;}).stage5;
4142 # Select the appropriate stdenv for the platform `system'.
43 stdenv =
+25-2
pkgs/stdenv/generic/default.nix
···10, setupScript ? ./setup.sh
1112, extraBuildInputs ? []
0013}:
1415let
···131132 lib.addPassthru (derivation (
133 (removeAttrs attrs ["meta" "passthru" "crossAttrs" "pos"])
134- //
000000000000135 {
136 builder = attrs.realBuilder or shell;
137 args = attrs.args or ["-e" (attrs.builder or ./default-builder.sh)];
···147 nativeBuildInputs = nativeBuildInputs ++ (if crossConfig == null then buildInputs else []);
148 propagatedNativeBuildInputs = propagatedNativeBuildInputs ++
149 (if crossConfig == null then propagatedBuildInputs else []);
150- })) (
00000000151 {
152 # The meta attribute is passed in the resulting attribute set,
153 # but it's not part of the actual derivation, i.e., it's not
···171 (if isNull allowedRequisites then {} else { allowedRequisites = allowedRequisites ++ defaultNativeBuildInputs; }) //
172 {
173 inherit system name;
0174175 builder = shell;
176
···10, setupScript ? ./setup.sh
1112, extraBuildInputs ? []
13+, __stdenvImpureHostDeps ? []
14+, __extraImpureHostDeps ? []
15}:
1617let
···133134 lib.addPassthru (derivation (
135 (removeAttrs attrs ["meta" "passthru" "crossAttrs" "pos"])
136+ // (let
137+ buildInputs = attrs.buildInputs or [];
138+ nativeBuildInputs = attrs.nativeBuildInputs or [];
139+ propagatedBuildInputs = attrs.propagatedBuildInputs or [];
140+ propagatedNativeBuildInputs = attrs.propagatedNativeBuildInputs or [];
141+ crossConfig = attrs.crossConfig or null;
142+143+ __impureHostDeps = attrs.__impureHostDeps or [];
144+ __propagatedImpureHostDeps = attrs.__propagatedImpureHostDeps or [];
145+146+ computedImpureHostDeps = lib.concatMap (input: input.__propagatedImpureHostDeps or []) (extraBuildInputs ++ buildInputs ++ nativeBuildInputs);
147+ computedPropagatedImpureHostDeps = lib.concatMap (input: input.__propagatedImpureHostDeps or []) (propagatedBuildInputs ++ propagatedNativeBuildInputs);
148+ in
149 {
150 builder = attrs.realBuilder or shell;
151 args = attrs.args or ["-e" (attrs.builder or ./default-builder.sh)];
···161 nativeBuildInputs = nativeBuildInputs ++ (if crossConfig == null then buildInputs else []);
162 propagatedNativeBuildInputs = propagatedNativeBuildInputs ++
163 (if crossConfig == null then propagatedBuildInputs else []);
164+165+ __impureHostDeps = lib.unique (lib.sort (x: y: x < y) (computedImpureHostDeps ++ computedPropagatedImpureHostDeps ++ __propagatedImpureHostDeps ++ __impureHostDeps ++ __extraImpureHostDeps ++ [
166+ "/dev/zero"
167+ "/dev/random"
168+ "/dev/urandom"
169+ "/bin/sh"
170+ ]));
171+ __propagatedImpureHostDeps = lib.unique (lib.sort (x: y: x < y) (computedPropagatedImpureHostDeps ++ __propagatedImpureHostDeps));
172+ }))) (
173 {
174 # The meta attribute is passed in the resulting attribute set,
175 # but it's not part of the actual derivation, i.e., it's not
···193 (if isNull allowedRequisites then {} else { allowedRequisites = allowedRequisites ++ defaultNativeBuildInputs; }) //
194 {
195 inherit system name;
196+ __impureHostDeps = __stdenvImpureHostDeps;
197198 builder = shell;
199
+6
pkgs/tools/archivers/gnutar/default.nix
···1112 patches = stdenv.lib.optional stdenv.isDarwin ./gnutar-1.28-darwin.patch;
1300000014 # gnutar tries to call into gettext between `fork` and `exec`,
15 # which is not safe on darwin.
16 # see http://article.gmane.org/gmane.os.macosx.fink.devel/21882
···1112 patches = stdenv.lib.optional stdenv.isDarwin ./gnutar-1.28-darwin.patch;
1314+ # avoid retaining reference to CF during stdenv bootstrap
15+ configureFlags = stdenv.lib.optionals stdenv.isDarwin [
16+ "gt_cv_func_CFPreferencesCopyAppValue=no"
17+ "gt_cv_func_CFLocaleCopyCurrent=no"
18+ ];
19+20 # gnutar tries to call into gettext between `fork` and `exec`,
21 # which is not safe on darwin.
22 # see http://article.gmane.org/gmane.os.macosx.fink.devel/21882
+1-1
pkgs/tools/archivers/sharutils/default.nix
···12 ''
13 # Fix for building on Glibc 2.16. Won't be needed once the
14 # gnulib in sharutils is updated.
15- sed -i ${stdenv.lib.optionalString ((stdenv.isFreeBSD || stdenv.isOpenBSD || stdenv.isDarwin) && stdenv.cc.nativeTools) "''"} '/gets is a security hole/d' lib/stdio.in.h
16 '';
1718 # GNU Gettext is needed on non-GNU platforms.
···12 ''
13 # Fix for building on Glibc 2.16. Won't be needed once the
14 # gnulib in sharutils is updated.
15+ sed -i ${stdenv.lib.optionalString ((stdenv.isFreeBSD || stdenv.isOpenBSD) && stdenv.cc.nativeTools) "''"} '/gets is a security hole/d' lib/stdio.in.h
16 '';
1718 # GNU Gettext is needed on non-GNU platforms.