···2424 ++ lib.optional stdenv.isSunOS ./ld-shared.patch
2525 ++ lib.optional stdenv.isDarwin [ ./cpp-precomp.patch ./no-libutil.patch ] ;
26262727+ # There's an annoying bug on sandboxed Darwin in Perl's Cwd.pm where it looks for pwd
2828+ # in /bin/pwd and /usr/bin/pwd and then falls back on just "pwd" if it can't get them
2929+ # while at the same time erasing the PATH environment variable so it unconditionally
3030+ # fails. The code in question is guarded by a check for Mac OS, but the patch below
3131+ # doesn't have any runtime effect on other platforms.
3232+ postPatch = ''
3333+ pwd="$(type -P pwd)"
3434+ substituteInPlace dist/Cwd/Cwd.pm \
3535+ --replace "pwd_cmd = 'pwd'" "pwd_cmd = '$pwd'"
3636+ '';
3737+2738 # Build a thread-safe Perl with a dynamic libperls.o. We need the
2839 # "installstyle" option to ensure that modules are put under
2940 # $out/lib/perl5 - this is the general default, but because $out
···3535 ++ optional stdenv.isSunOS ./ld-shared.patch
3636 ++ stdenv.lib.optional stdenv.isDarwin [ ./cpp-precomp.patch ./no-libutil.patch ] ;
37373838+ # There's an annoying bug on sandboxed Darwin in Perl's Cwd.pm where it looks for pwd
3939+ # in /bin/pwd and /usr/bin/pwd and then falls back on just "pwd" if it can't get them
4040+ # while at the same time erasing the PATH environment variable so it unconditionally
4141+ # fails. The code in question is guarded by a check for Mac OS, but the patch below
4242+ # doesn't have any runtime effect on other platforms.
4343+ postPatch = ''
4444+ pwd="$(type -P pwd)"
4545+ substituteInPlace dist/PathTools/Cwd.pm \
4646+ --replace "pwd_cmd = 'pwd'" "pwd_cmd = '$pwd'"
4747+ '';
4848+3849 # Build a thread-safe Perl with a dynamic libperls.o. We need the
3950 # "installstyle" option to ensure that modules are put under
4051 # $out/lib/perl5 - this is the general default, but because $out
···6262 for i in Lib/plat-*/regen; do
6363 substituteInPlace $i --replace /usr/include/ ${stdenv.cc.libc}/include/
6464 done
6565+ '' + optionalString stdenv.isDarwin ''
6666+ substituteInPlace configure --replace '`/usr/bin/arch`' '"i386"'
6567 '';
66686769 configureFlags = [
···7274 "--with-system-ffi"
7375 "--with-system-expat"
7476 "ac_cv_func_bind_textdomain_codeset=yes"
7777+ ] ++ optionals stdenv.isDarwin [
7878+ "--disable-toolbox-glue"
7579 ];
76807781 postConfigure = if stdenv.isCygwin then ''
+6-1
pkgs/development/libraries/gettext/default.nix
···1919 "--with-included-gettext"
2020 "--with-included-glib"
2121 "--with-included-libcroco"
2222- ]);
2222+ ])
2323+ # avoid retaining reference to CF during stdenv bootstrap
2424+ ++ (stdenv.lib.optionals stdenv.isDarwin [
2525+ "gt_cv_func_CFPreferencesCopyAppValue=no"
2626+ "gt_cv_func_CFLocaleCopyCurrent=no"
2727+ ]);
23282429 # On cross building, gettext supposes that the wchar.h from libc
2530 # does not fulfill gettext needs, so it tries to work with its
+5
pkgs/development/libraries/icu/default.nix
···3232 configureFlags = "--disable-debug" +
3333 stdenv.lib.optionalString stdenv.isDarwin " --enable-rpath";
34343535+ # remove dependency on bootstrap-tools in early stdenv build
3636+ postInstall = stdenv.lib.optionalString stdenv.isDarwin ''
3737+ sed -i 's/INSTALL_CMD=.*install/INSTALL_CMD=install/' $out/lib/icu/${version}/pkgdata.inc
3838+ '';
3939+3540 enableParallelBuilding = true;
36413742 meta = with stdenv.lib; {
···11+{ stdenv, binutils-raw, cctools }:
22+33+stdenv.mkDerivation {
44+ name = "cctools-binutils-darwin";
55+ buildCommand = ''
66+ mkdir -p $out/bin $out/include
77+88+ ln -s ${binutils-raw}/bin/c++filt $out/bin/c++filt
99+1010+ # We specifically need:
1111+ # - ld: binutils doesn't provide it on darwin
1212+ # - as: as above
1313+ # - ar: the binutils one prodices .a files that the cctools ld doesn't like
1414+ # - ranlib: for compatibility with ar
1515+ # - dsymutil: soon going away once it goes into LLVM (this one is fake anyway)
1616+ # - otool: we use it for some of our name mangling
1717+ # - install_name_tool: we use it to rewrite stuff in our bootstrap tools
1818+ # - strip: the binutils one seems to break mach-o files
1919+ # - lipo: gcc build assumes it exists
2020+ # - nm: the gnu one doesn't understand many new load commands
2121+ for i in ar ranlib as dsymutil install_name_tool ld strip otool lipo nm strings size; do
2222+ ln -sf "${cctools}/bin/$i" "$out/bin/$i"
2323+ done
2424+2525+ for i in ${binutils-raw}/include/*.h; do
2626+ ln -s "$i" "$out/include/$(basename $i)"
2727+ done
2828+2929+ for i in ${cctools}/include/*; do
3030+ ln -s "$i" "$out/include/$(basename $i)"
3131+ done
3232+3333+ # FIXME: this will give us incorrect man pages for bits of cctools
3434+ ln -s ${binutils-raw}/share $out/share
3535+ ln -s ${binutils-raw}/lib $out/lib
3636+3737+ ln -s ${cctools}/libexec $out/libexec
3838+ '';
3939+}
···3737 stdenvLinux = (import ./linux { inherit system allPackages platform config lib; }).stdenvLinux;
38383939 # Darwin standard environment.
4040- stdenvDarwin = (import ./darwin { inherit system allPackages platform config;}).stdenvDarwin;
4040+ stdenvDarwin = (import ./darwin { inherit system allPackages platform config;}).stage5;
41414242 # Select the appropriate stdenv for the platform `system'.
4343 stdenv =
+25-2
pkgs/stdenv/generic/default.nix
···1010, setupScript ? ./setup.sh
11111212, extraBuildInputs ? []
1313+, __stdenvImpureHostDeps ? []
1414+, __extraImpureHostDeps ? []
1315}:
14161517let
···131133132134 lib.addPassthru (derivation (
133135 (removeAttrs attrs ["meta" "passthru" "crossAttrs" "pos"])
134134- //
136136+ // (let
137137+ buildInputs = attrs.buildInputs or [];
138138+ nativeBuildInputs = attrs.nativeBuildInputs or [];
139139+ propagatedBuildInputs = attrs.propagatedBuildInputs or [];
140140+ propagatedNativeBuildInputs = attrs.propagatedNativeBuildInputs or [];
141141+ crossConfig = attrs.crossConfig or null;
142142+143143+ __impureHostDeps = attrs.__impureHostDeps or [];
144144+ __propagatedImpureHostDeps = attrs.__propagatedImpureHostDeps or [];
145145+146146+ computedImpureHostDeps = lib.concatMap (input: input.__propagatedImpureHostDeps or []) (extraBuildInputs ++ buildInputs ++ nativeBuildInputs);
147147+ computedPropagatedImpureHostDeps = lib.concatMap (input: input.__propagatedImpureHostDeps or []) (propagatedBuildInputs ++ propagatedNativeBuildInputs);
148148+ in
135149 {
136150 builder = attrs.realBuilder or shell;
137151 args = attrs.args or ["-e" (attrs.builder or ./default-builder.sh)];
···147161 nativeBuildInputs = nativeBuildInputs ++ (if crossConfig == null then buildInputs else []);
148162 propagatedNativeBuildInputs = propagatedNativeBuildInputs ++
149163 (if crossConfig == null then propagatedBuildInputs else []);
150150- })) (
164164+165165+ __impureHostDeps = lib.unique (lib.sort (x: y: x < y) (computedImpureHostDeps ++ computedPropagatedImpureHostDeps ++ __propagatedImpureHostDeps ++ __impureHostDeps ++ __extraImpureHostDeps ++ [
166166+ "/dev/zero"
167167+ "/dev/random"
168168+ "/dev/urandom"
169169+ "/bin/sh"
170170+ ]));
171171+ __propagatedImpureHostDeps = lib.unique (lib.sort (x: y: x < y) (computedPropagatedImpureHostDeps ++ __propagatedImpureHostDeps));
172172+ }))) (
151173 {
152174 # The meta attribute is passed in the resulting attribute set,
153175 # but it's not part of the actual derivation, i.e., it's not
···171193 (if isNull allowedRequisites then {} else { allowedRequisites = allowedRequisites ++ defaultNativeBuildInputs; }) //
172194 {
173195 inherit system name;
196196+ __impureHostDeps = __stdenvImpureHostDeps;
174197175198 builder = shell;
176199
+6
pkgs/tools/archivers/gnutar/default.nix
···11111212 patches = stdenv.lib.optional stdenv.isDarwin ./gnutar-1.28-darwin.patch;
13131414+ # avoid retaining reference to CF during stdenv bootstrap
1515+ configureFlags = stdenv.lib.optionals stdenv.isDarwin [
1616+ "gt_cv_func_CFPreferencesCopyAppValue=no"
1717+ "gt_cv_func_CFLocaleCopyCurrent=no"
1818+ ];
1919+1420 # gnutar tries to call into gettext between `fork` and `exec`,
1521 # which is not safe on darwin.
1622 # see http://article.gmane.org/gmane.os.macosx.fink.devel/21882
+1-1
pkgs/tools/archivers/sharutils/default.nix
···1212 ''
1313 # Fix for building on Glibc 2.16. Won't be needed once the
1414 # gnulib in sharutils is updated.
1515- sed -i ${stdenv.lib.optionalString ((stdenv.isFreeBSD || stdenv.isOpenBSD || stdenv.isDarwin) && stdenv.cc.nativeTools) "''"} '/gets is a security hole/d' lib/stdio.in.h
1515+ sed -i ${stdenv.lib.optionalString ((stdenv.isFreeBSD || stdenv.isOpenBSD) && stdenv.cc.nativeTools) "''"} '/gets is a security hole/d' lib/stdio.in.h
1616 '';
17171818 # GNU Gettext is needed on non-GNU platforms.