lol

pure darwin stdenv

+431 -128
+1 -1
pkgs/development/compilers/llvm/3.6/default.nix
··· 1 1 { pkgs, newScope, stdenv, isl, fetchurl, overrideCC, wrapCC }: 2 2 let 3 - callPackage = newScope (self // { inherit isl version fetch; }); 3 + callPackage = newScope (self // { inherit stdenv isl version fetch; }); 4 4 5 5 version = "3.6.1"; 6 6
+11
pkgs/development/interpreters/perl/5.16/default.nix
··· 24 24 ++ lib.optional stdenv.isSunOS ./ld-shared.patch 25 25 ++ lib.optional stdenv.isDarwin [ ./cpp-precomp.patch ./no-libutil.patch ] ; 26 26 27 + # 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 + 27 38 # Build a thread-safe Perl with a dynamic libperls.o. We need the 28 39 # "installstyle" option to ensure that modules are put under 29 40 # $out/lib/perl5 - this is the general default, but because $out
+11
pkgs/development/interpreters/perl/5.20/default.nix
··· 35 35 ++ optional stdenv.isSunOS ./ld-shared.patch 36 36 ++ stdenv.lib.optional stdenv.isDarwin [ ./cpp-precomp.patch ./no-libutil.patch ] ; 37 37 38 + # 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 + 38 49 # Build a thread-safe Perl with a dynamic libperls.o. We need the 39 50 # "installstyle" option to ensure that modules are put under 40 51 # $out/lib/perl5 - this is the general default, but because $out
+4
pkgs/development/interpreters/python/2.7/default.nix
··· 62 62 for i in Lib/plat-*/regen; do 63 63 substituteInPlace $i --replace /usr/include/ ${stdenv.cc.libc}/include/ 64 64 done 65 + '' + optionalString stdenv.isDarwin '' 66 + substituteInPlace configure --replace '`/usr/bin/arch`' '"i386"' 65 67 ''; 66 68 67 69 configureFlags = [ ··· 72 74 "--with-system-ffi" 73 75 "--with-system-expat" 74 76 "ac_cv_func_bind_textdomain_codeset=yes" 77 + ] ++ optionals stdenv.isDarwin [ 78 + "--disable-toolbox-glue" 75 79 ]; 76 80 77 81 postConfigure = if stdenv.isCygwin then ''
+6 -1
pkgs/development/libraries/gettext/default.nix
··· 19 19 "--with-included-gettext" 20 20 "--with-included-glib" 21 21 "--with-included-libcroco" 22 - ]); 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 + ]); 23 28 24 29 # On cross building, gettext supposes that the wchar.h from libc 25 30 # does not fulfill gettext needs, so it tries to work with its
+5
pkgs/development/libraries/icu/default.nix
··· 32 32 configureFlags = "--disable-debug" + 33 33 stdenv.lib.optionalString stdenv.isDarwin " --enable-rpath"; 34 34 35 + # 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 + 35 40 enableParallelBuilding = true; 36 41 37 42 meta = with stdenv.lib; {
+1 -1
pkgs/development/libraries/libedit/default.nix
··· 16 16 ] else null; 17 17 18 18 postInstall = '' 19 - sed -i ${stdenv.lib.optionalString (stdenv.isDarwin && stdenv.cc.nativeTools) "''"} s/-lncurses/-lncursesw/g $out/lib/pkgconfig/libedit.pc 19 + sed -i s/-lncurses/-lncursesw/g $out/lib/pkgconfig/libedit.pc 20 20 ''; 21 21 22 22 configureFlags = [ "--enable-widec" ];
+7
pkgs/development/libraries/zlib/default.nix
··· 13 13 sha256 = "039agw5rqvqny92cpkrfn243x2gd4xn13hs3xi6isk55d2vqqr9n"; 14 14 }; 15 15 16 + postPatch = stdenv.lib.optionalString stdenv.isDarwin '' 17 + substituteInPlace configure \ 18 + --replace '/usr/bin/libtool' 'ar' \ 19 + --replace 'AR="libtool"' 'AR="ar"' \ 20 + --replace 'ARFLAGS="-o"' 'ARFLAGS="-r"' 21 + ''; 22 + 16 23 configureFlags = if static then "" else "--shared"; 17 24 18 25 preConfigure = ''
+3 -3
pkgs/development/tools/misc/binutils/default.nix
··· 2 2 , cross ? null, gold ? true, bison ? null 3 3 }: 4 4 5 - assert !stdenv.isDarwin; 6 - 7 5 let basename = "binutils-2.23.1"; in 8 6 9 7 with { inherit (stdenv.lib) optional optionals optionalString; }; ··· 56 54 57 55 # As binutils takes part in the stdenv building, we don't want references 58 56 # to the bootstrap-tools libgcc (as uses to happen on arm/mips) 59 - NIX_CFLAGS_COMPILE = "-static-libgcc"; 57 + NIX_CFLAGS_COMPILE = if stdenv.isDarwin 58 + then "-Wno-string-plus-int -Wno-deprecated-declarations" 59 + else "-static-libgcc"; 60 60 61 61 configureFlags = 62 62 [ "--enable-shared" "--enable-deterministic-archives" ]
+29
pkgs/os-specific/darwin/adv_cmds/locale.nix
··· 1 + { stdenv, fetchurl }: 2 + 3 + stdenv.mkDerivation rec { 4 + name = "locale-${version}"; 5 + version = "153"; 6 + 7 + src = fetchurl { 8 + url = "http://opensource.apple.com/tarballs/adv_cmds/adv_cmds-${version}.tar.gz"; 9 + sha256 = "174v6a4zkcm2pafzgdm6kvs48z5f911zl7k49hv7kjq6gm58w99v"; 10 + }; 11 + 12 + buildPhase = '' 13 + cd locale 14 + c++ -Os -Wall -o locale locale.cc 15 + ''; 16 + 17 + installPhase = '' 18 + mkdir -p $out/bin $out/share/man/man1 19 + 20 + cp locale $out/bin/locale 21 + cp locale.1 $out/share/man/man1 22 + ''; 23 + 24 + 25 + meta = { 26 + platforms = stdenv.lib.platforms.darwin; 27 + maintainers = with stdenv.lib.maintainers; [ gridaphobe ]; 28 + }; 29 + }
+39
pkgs/os-specific/darwin/binutils/default.nix
··· 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 4 , config ? {} 5 5 }: 6 6 7 - rec { 7 + let 8 + fetch = { file, sha256 }: import <nix/fetchurl.nix> { 9 + url = "https://dl.dropboxusercontent.com/u/2857322/${file}"; 10 + inherit sha256; 11 + executable = true; 12 + }; 13 + 14 + bootstrapFiles = { 15 + sh = fetch { file = "sh"; sha256 = "1qakpg37vl61jnkplz13m3g1csqr85cg8ybp6jwiv6apmg26isnm"; }; 16 + bzip2 = fetch { file = "bzip2"; sha256 = "1gxa67255q9v00j1vn1mzyrnbwys2g1102cx02vpcyvvrl4vqxr0"; }; 17 + mkdir = fetch { file = "mkdir"; sha256 = "1yfl8w65ksji7fggrbvqxw8lp0gm02qilk11n9axj2jxay53ngvg"; }; 18 + cpio = fetch { file = "cpio"; sha256 = "0nssyg19smgcblwq1mfcw4djbd85md84d2f093qcqkbigdjg484b"; }; 19 + }; 20 + tarball = fetch { file = "bootstrap-tools.9.cpio.bz2"; sha256 = "0fd79k7gy3z3sba5w4f4lnrcpiwff31vw02480x1pdry8bbgbf2j"; }; 21 + in rec { 8 22 allPackages = import ../../top-level/all-packages.nix; 9 23 10 - bootstrapTools = derivation { 11 - inherit system; 24 + commonPreHook = '' 25 + export NIX_ENFORCE_PURITY=1 26 + export NIX_IGNORE_LD_THROUGH_GCC=1 27 + stripAllFlags=" " # the Darwin "strip" command doesn't know "-s" 28 + export MACOSX_DEPLOYMENT_TARGET=10.7 29 + export SDKROOT= 30 + export CMAKE_OSX_ARCHITECTURES=x86_64 31 + ''; 32 + 33 + # libSystem and its transitive dependencies. Get used to this; it's a recurring theme in darwin land 34 + libSystemClosure = [ 35 + "/usr/lib/libSystem.dylib" 36 + "/usr/lib/libSystem.B.dylib" 37 + "/usr/lib/libobjc.A.dylib" 38 + "/usr/lib/libobjc.dylib" 39 + "/usr/lib/libauto.dylib" 40 + "/usr/lib/libc++abi.dylib" 41 + "/usr/lib/libc++.1.dylib" 42 + "/usr/lib/libDiagnosticMessagesClient.dylib" 43 + "/usr/lib/system" 44 + ]; 45 + 46 + # The one dependency of /bin/sh :( 47 + binShClosure = [ "/usr/lib/libncurses.5.4.dylib" ]; 48 + 49 + bootstrapTools = derivation rec { 50 + inherit system tarball; 51 + 52 + name = "bootstrap-tools"; 53 + builder = bootstrapFiles.sh; # Not a filename! Attribute 'sh' on bootstrapFiles 54 + args = [ ./unpack-bootstrap-tools.sh ]; 12 55 13 - name = "trivial-bootstrap-tools"; 14 - builder = "/bin/sh"; 15 - args = [ ./trivial-bootstrap.sh ]; 56 + inherit (bootstrapFiles) mkdir bzip2 cpio; 16 57 17 - mkdir = "/bin/mkdir"; 18 - ln = "/bin/ln"; 58 + __impureHostDeps = binShClosure ++ libSystemClosure; 19 59 }; 20 60 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; 61 + stageFun = step: last: {shell ? "${bootstrapTools}/bin/sh", 62 + overrides ? (pkgs: {}), 63 + extraPreHook ? "", 64 + extraBuildInputs ? with last.pkgs; [ xz darwin.CF libcxx ], 65 + extraInitialPath ? [], 66 + allowedRequisites ? null}: 67 + let 68 + thisStdenv = import ../generic { 69 + inherit system config shell extraBuildInputs allowedRequisites; 70 + 71 + name = "stdenv-darwin-boot-${toString step}"; 72 + 73 + cc = if isNull last then "/no-such-path" else import ../../build-support/cc-wrapper { 74 + inherit shell; 75 + inherit (last) stdenv; 76 + inherit (last.pkgs.darwin) dyld; 77 + 78 + nativeTools = true; 79 + nativePrefix = bootstrapTools; 80 + nativeLibc = false; 81 + libc = last.pkgs.darwin.Libsystem; 82 + cc = { name = "clang-9.9.9"; outPath = bootstrapTools; }; 83 + }; 84 + 85 + preHook = stage0.stdenv.lib.optionalString (shell == "${bootstrapTools}/bin/sh") '' 86 + # Don't patch #!/interpreter because it leads to retained 87 + # dependencies on the bootstrapTools in the final stdenv. 88 + dontPatchShebangs=1 89 + '' + '' 90 + ${commonPreHook} 91 + ${extraPreHook} 92 + ''; 93 + initialPath = extraInitialPath ++ [ bootstrapTools ]; 94 + fetchurlBoot = import ../../build-support/fetchurl { 95 + stdenv = stage0.stdenv; 96 + curl = bootstrapTools; 97 + }; 98 + 99 + # The stdenvs themselves don't use mkDerivation, so I need to specify this here 100 + __stdenvImpureHostDeps = binShClosure ++ libSystemClosure; 101 + __extraImpureHostDeps = binShClosure ++ libSystemClosure; 102 + 103 + extraAttrs = { inherit platform; }; 104 + overrides = pkgs: (overrides pkgs) // { fetchurl = thisStdenv.fetchurlBoot; }; 105 + }; 106 + 107 + thisPkgs = allPackages { 108 + inherit system platform; 109 + bootStdenv = thisStdenv; 110 + }; 111 + in { stdenv = thisStdenv; pkgs = thisPkgs; }; 112 + 113 + stage0 = stageFun 0 null { 114 + overrides = orig: with stage0; rec { 115 + darwin = orig.darwin // { 116 + Libsystem = stdenv.mkDerivation { 117 + name = "bootstrap-Libsystem"; 118 + buildCommand = '' 119 + mkdir -p $out 120 + ln -s ${bootstrapTools}/lib $out/lib 121 + ln -s ${bootstrapTools}/include-Libsystem $out/include 122 + ''; 123 + }; 124 + dyld = bootstrapTools; 125 + }; 126 + 127 + libcxx = stdenv.mkDerivation { 128 + name = "bootstrap-libcxx"; 129 + phases = [ "installPhase" "fixupPhase" ]; 130 + installPhase = '' 131 + mkdir -p $out/lib $out/include 132 + ln -s ${bootstrapTools}/lib/libc++.dylib $out/lib/libc++.dylib 133 + ln -s ${bootstrapTools}/include/c++ $out/include/c++ 134 + ''; 135 + setupHook = ../../development/compilers/llvm/3.5/libc++/setup-hook.sh; 136 + }; 137 + 138 + libcxxabi = stdenv.mkDerivation { 139 + name = "bootstrap-libcxxabi"; 140 + buildCommand = '' 141 + mkdir -p $out/lib 142 + ln -s ${bootstrapTools}/lib/libc++abi.dylib $out/lib/libc++abi.dylib 143 + ''; 144 + }; 145 + 26 146 }; 27 147 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"; 148 + extraBuildInputs = []; 149 + }; 150 + 151 + persistent0 = _: {}; 152 + 153 + stage1 = with stage0; stageFun 1 stage0 { 154 + extraPreHook = "export NIX_CFLAGS_COMPILE+=\" -F${bootstrapTools}/Library/Frameworks\""; 155 + extraBuildInputs = [ pkgs.libcxx ]; 156 + 157 + allowedRequisites = 158 + [ bootstrapTools ] ++ (with pkgs; [ libcxx libcxxabi ]) ++ [ pkgs.darwin.Libsystem ]; 159 + 160 + overrides = persistent0; 161 + }; 162 + 163 + persistent1 = orig: with stage1.pkgs; { 164 + inherit 165 + zlib patchutils m4 scons flex perl bison unifdef unzip openssl icu python 166 + libxml2 gettext sharutils gmp libarchive ncurses pkg-config libedit groff 167 + openssh sqlite sed serf openldap db cyrus-sasl expat apr-util subversion xz 168 + findfreetype libssh curl cmake autoconf automake libtool ed cpio coreutils; 169 + 170 + darwin = orig.darwin // { 171 + inherit (darwin) 172 + dyld Libsystem xnu configd libdispatch libclosure launchd; 35 173 }; 36 174 }; 37 175 38 - buildTools = import ../../os-specific/darwin/command-line-tools { 39 - inherit (stage0) stdenv fetchurl; 40 - xar = bootstrapTools; 41 - gzip = bootstrapTools; 42 - cpio = bootstrapTools; 176 + stage2 = with stage1; stageFun 2 stage1 { 177 + allowedRequisites = 178 + [ bootstrapTools ] ++ 179 + (with pkgs; [ xz libcxx libcxxabi icu ]) ++ 180 + (with pkgs.darwin; [ dyld Libsystem CF ]); 181 + 182 + overrides = persistent1; 43 183 }; 44 184 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 - # 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 - ''; 185 + persistent2 = orig: with stage2.pkgs; { 186 + inherit 187 + patchutils m4 scons flex perl bison unifdef unzip openssl python 188 + gettext sharutils libarchive pkg-config groff bash subversion 189 + openssh sqlite sed serf openldap db cyrus-sasl expat apr-util 190 + findfreetype libssh curl cmake autoconf automake libtool cpio 191 + libcxx libcxxabi; 192 + 193 + darwin = orig.darwin // { 194 + inherit (darwin) 195 + dyld Libsystem xnu configd libdispatch libclosure launchd libiconv; 196 + }; 197 + }; 62 198 63 - # 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"; 199 + stage3 = with stage2; stageFun 3 stage2 { 200 + shell = "${pkgs.bash}/bin/bash"; 66 201 67 - stdenv = import ../generic { 68 - name = "stdenv-darwin-boot-1"; 202 + # We have a valid shell here (this one has no bootstrap-tools runtime deps) so stageFun 203 + # enables patchShebangs above. Unfortunately, patchShebangs ignores our $SHELL setting 204 + # and instead goes by $PATH, which happens to contain bootstrapTools. So it goes and 205 + # patches our shebangs back to point at bootstrapTools. This makes sure bash comes first. 206 + extraInitialPath = [ pkgs.bash ]; 69 207 70 - inherit system config; 71 - inherit (stage0.stdenv) shell fetchurlBoot; 208 + allowedRequisites = 209 + [ bootstrapTools ] ++ 210 + (with pkgs; [ icu bash libcxx libcxxabi ]) ++ 211 + (with pkgs.darwin; [ dyld Libsystem ]); 72 212 73 - initialPath = stage0.stdenv.initialPath ++ [ nativePrefix ]; 213 + overrides = persistent2; 214 + }; 74 215 75 - 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 - ''; 216 + persistent3 = orig: with stage3.pkgs; { 217 + inherit 218 + gnumake gzip gnused bzip2 gawk ed xz patch bash 219 + libcxxabi libcxx ncurses libffi zlib llvm gmp pcre gnugrep 220 + coreutils findutils diffutils patchutils; 81 221 82 - 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 - }; 222 + llvmPackages = orig.llvmPackages // { 223 + inherit (llvmPackages) llvm clang-unwrapped; 95 224 }; 96 - pkgs = allPackages { 97 - inherit system platform; 98 - bootStdenv = stdenv; 225 + 226 + darwin = orig.darwin // { 227 + inherit (darwin) dyld Libsystem libiconv; 99 228 }; 100 229 }; 101 230 102 - stage2 = rec { 103 - stdenv = import ../generic { 104 - name = "stdenv-darwin-boot-2"; 231 + stage4 = with stage3; stageFun 4 stage3 { 232 + shell = "${pkgs.bash}/bin/bash"; 233 + extraInitialPath = [ pkgs.bash ]; 234 + overrides = persistent3; 235 + }; 105 236 106 - inherit system config; 107 - inherit (stage1.stdenv) shell fetchurlBoot preHook cc; 237 + persistent4 = orig: with stage4.pkgs; { 238 + inherit 239 + gnumake gzip gnused bzip2 gawk ed xz patch bash 240 + libcxxabi libcxx ncurses libffi zlib icu llvm gmp pcre gnugrep 241 + coreutils findutils diffutils patchutils binutils binutils-raw; 108 242 109 - initialPath = [ stage1.pkgs.xz ] ++ stage1.stdenv.initialPath; 243 + llvmPackages = orig.llvmPackages // { 244 + inherit (llvmPackages) llvm clang-unwrapped; 110 245 }; 111 - pkgs = allPackages { 112 - inherit system platform; 113 - bootStdenv = stdenv; 246 + 247 + darwin = orig.darwin // { 248 + inherit (darwin) dyld Libsystem cctools CF libiconv; 114 249 }; 115 250 }; 116 251 117 - # 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 - 252 + stage5 = with stage4; import ../generic rec { 122 253 inherit system config; 123 254 inherit (stdenv) fetchurlBoot; 124 255 125 - initialPath = (import ../common-path.nix) { inherit pkgs; }; 256 + name = "stdenv-darwin"; 126 257 127 - preHook = preHook + "\n" + '' 128 - export NIX_ENFORCE_PURITY=1 129 - ''; 258 + preHook = commonPreHook; 259 + 260 + __stdenvImpureHostDeps = binShClosure ++ libSystemClosure; 261 + __extraImpureHostDeps = binShClosure ++ libSystemClosure; 262 + 263 + initialPath = import ../common-path.nix { inherit pkgs; }; 264 + shell = "${pkgs.bash}/bin/bash"; 130 265 131 266 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; 267 + inherit stdenv shell; 268 + nativeTools = false; 269 + nativeLibc = false; 270 + inherit (pkgs) coreutils binutils; 271 + inherit (pkgs.darwin) dyld; 272 + cc = pkgs.llvmPackages.clang-unwrapped; 273 + libc = pkgs.darwin.Libsystem; 141 274 }; 142 275 143 - shell = "${pkgs.bash}/bin/bash"; 144 - }; 276 + extraBuildInputs = with pkgs; [ darwin.CF libcxx ]; 277 + 278 + extraAttrs = { 279 + inherit platform bootstrapTools; 280 + libc = pkgs.darwin.Libsystem; 281 + shellPackage = pkgs.bash; 282 + }; 145 283 146 - stdenvDarwin = stage3; 284 + allowedRequisites = (with pkgs; [ 285 + xz libcxx libcxxabi icu gmp gnumake findutils bzip2 llvm zlib libffi 286 + coreutils ed diffutils gnutar gzip ncurses gnused bash gawk 287 + gnugrep llvmPackages.clang-unwrapped patch pcre binutils-raw binutils gettext 288 + ]) ++ (with pkgs.darwin; [ 289 + dyld Libsystem CF cctools libiconv 290 + ]); 291 + 292 + overrides = orig: persistent4 orig // { 293 + clang = cc; 294 + inherit cc; 295 + }; 296 + }; 147 297 }
+6 -4
pkgs/stdenv/darwin/make-bootstrap-tools.nix
··· 63 63 64 64 cp -d ${gnugrep.pcre}/lib/libpcre*.dylib $out/lib 65 65 cp -d ${libiconv}/lib/libiconv*.dylib $out/lib 66 + cp -d ${gettext}/lib/libintl*.dylib $out/lib 67 + chmod +x $out/lib/libintl*.dylib 66 68 67 69 # Copy what we need of clang 68 - cp -d ${llvmPackages.clang}/bin/clang $out/bin 69 - cp -d ${llvmPackages.clang}/bin/clang++ $out/bin 70 - cp -d ${llvmPackages.clang}/bin/clang-3.5 $out/bin 70 + cp -d ${llvmPackages.clang-unwrapped}/bin/clang $out/bin 71 + cp -d ${llvmPackages.clang-unwrapped}/bin/clang++ $out/bin 72 + cp -d ${llvmPackages.clang-unwrapped}/bin/clang-3.6 $out/bin 71 73 72 - cp -rL ${llvmPackages.clang}/lib/clang $out/lib 74 + cp -rL ${llvmPackages.clang-unwrapped}/lib/clang $out/lib 73 75 74 76 cp -d ${libcxx}/lib/libc++*.dylib $out/lib 75 77 cp -d ${libcxxabi}/lib/libc++abi*.dylib $out/lib
+1 -1
pkgs/stdenv/default.nix
··· 37 37 stdenvLinux = (import ./linux { inherit system allPackages platform config lib; }).stdenvLinux; 38 38 39 39 # Darwin standard environment. 40 - stdenvDarwin = (import ./darwin { inherit system allPackages platform config;}).stdenvDarwin; 40 + stdenvDarwin = (import ./darwin { inherit system allPackages platform config;}).stage5; 41 41 42 42 # Select the appropriate stdenv for the platform `system'. 43 43 stdenv =
+25 -2
pkgs/stdenv/generic/default.nix
··· 10 10 , setupScript ? ./setup.sh 11 11 12 12 , extraBuildInputs ? [] 13 + , __stdenvImpureHostDeps ? [] 14 + , __extraImpureHostDeps ? [] 13 15 }: 14 16 15 17 let ··· 131 133 132 134 lib.addPassthru (derivation ( 133 135 (removeAttrs attrs ["meta" "passthru" "crossAttrs" "pos"]) 134 - // 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 135 149 { 136 150 builder = attrs.realBuilder or shell; 137 151 args = attrs.args or ["-e" (attrs.builder or ./default-builder.sh)]; ··· 147 161 nativeBuildInputs = nativeBuildInputs ++ (if crossConfig == null then buildInputs else []); 148 162 propagatedNativeBuildInputs = propagatedNativeBuildInputs ++ 149 163 (if crossConfig == null then propagatedBuildInputs else []); 150 - })) ( 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 + }))) ( 151 173 { 152 174 # The meta attribute is passed in the resulting attribute set, 153 175 # but it's not part of the actual derivation, i.e., it's not ··· 171 193 (if isNull allowedRequisites then {} else { allowedRequisites = allowedRequisites ++ defaultNativeBuildInputs; }) // 172 194 { 173 195 inherit system name; 196 + __impureHostDeps = __stdenvImpureHostDeps; 174 197 175 198 builder = shell; 176 199
+6
pkgs/tools/archivers/gnutar/default.nix
··· 11 11 12 12 patches = stdenv.lib.optional stdenv.isDarwin ./gnutar-1.28-darwin.patch; 13 13 14 + # 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 + 14 20 # gnutar tries to call into gettext between `fork` and `exec`, 15 21 # which is not safe on darwin. 16 22 # see http://article.gmane.org/gmane.os.macosx.fink.devel/21882
+1 -1
pkgs/tools/archivers/sharutils/default.nix
··· 12 12 '' 13 13 # Fix for building on Glibc 2.16. Won't be needed once the 14 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 15 + sed -i ${stdenv.lib.optionalString ((stdenv.isFreeBSD || stdenv.isOpenBSD) && stdenv.cc.nativeTools) "''"} '/gets is a security hole/d' lib/stdio.in.h 16 16 ''; 17 17 18 18 # GNU Gettext is needed on non-GNU platforms.
+8 -3
pkgs/tools/text/gawk/default.nix
··· 1 - { stdenv, fetchurl, libsigsegv, readline, readlineSupport ? false }: 1 + { stdenv, fetchurl, libsigsegv, readline, readlineSupport ? false 2 + , locale ? null }: 2 3 3 4 stdenv.mkDerivation rec { 4 5 name = "gawk-4.1.3"; ··· 8 9 sha256 = "09d6pmx6h3i2glafm0jd1v1iyrs03vcyv2rkz12jisii3vlmbkz3"; 9 10 }; 10 11 11 - doCheck = !stdenv.isCygwin; # XXX: `test-dup2' segfaults on Cygwin 6.1 12 + doCheck = !( 13 + stdenv.isCygwin # XXX: `test-dup2' segfaults on Cygwin 6.1 14 + || stdenv.isDarwin # XXX: `locale' segfaults 15 + ); 12 16 13 17 buildInputs = stdenv.lib.optional (stdenv.system != "x86_64-cygwin") libsigsegv 14 - ++ stdenv.lib.optional readlineSupport readline; 18 + ++ stdenv.lib.optional readlineSupport readline 19 + ++ stdenv.lib.optional stdenv.isDarwin locale; 15 20 16 21 configureFlags = stdenv.lib.optional (stdenv.system != "x86_64-cygwin") "--with-libsigsegv-prefix=${libsigsegv}" 17 22 ++ stdenv.lib.optional readlineSupport "--with-readline=${readline}"
+15 -9
pkgs/top-level/all-packages.nix
··· 1512 1512 1513 1513 garmintools = callPackage ../development/libraries/garmintools {}; 1514 1514 1515 - gawk = callPackage ../tools/text/gawk { }; 1515 + gawk = callPackage ../tools/text/gawk { inherit (darwin) locale; }; 1516 1516 1517 1517 gawkInteractive = appendToName "interactive" 1518 1518 (gawk.override { readlineSupport = true; }); ··· 4670 4670 nativePrefix = stdenv.cc.nativePrefix or ""; 4671 4671 cc = baseCC; 4672 4672 libc = libc; 4673 + dyld = if stdenv.isDarwin then darwin.dyld else null; 4673 4674 isGNU = baseCC.isGNU or false; 4674 4675 isClang = baseCC.isClang or false; 4675 4676 inherit stdenv binutils coreutils zlib; 4676 4677 }; 4677 4678 4678 - wrapCC = wrapCCWith (makeOverridable (import ../build-support/cc-wrapper)) glibc; 4679 + wrapCC = wrapCCWith (makeOverridable (import ../build-support/cc-wrapper)) stdenv.cc.libc; 4679 4680 # legacy version, used for gnat bootstrapping 4680 4681 wrapGCC-old = baseGCC: (makeOverridable (import ../build-support/gcc-wrapper-old)) { 4681 4682 nativeTools = stdenv.cc.nativeTools or false; ··· 5182 5183 5183 5184 bin_replace_string = callPackage ../development/tools/misc/bin_replace_string { }; 5184 5185 5185 - binutils = if stdenv.isDarwin 5186 - then import ../build-support/native-darwin-cctools-wrapper {inherit stdenv;} 5187 - else callPackage ../development/tools/misc/binutils { 5188 - inherit noSysDirs; 5189 - }; 5186 + binutils = if stdenv.isDarwin then darwin.binutils else binutils-raw; 5187 + 5188 + binutils-raw = callPackage ../development/tools/misc/binutils { inherit noSysDirs; }; 5190 5189 5191 5190 binutils_nogold = lowPrio (callPackage ../development/tools/misc/binutils { 5192 5191 inherit noSysDirs; ··· 6942 6941 # glibc provides libiconv so systems with glibc don't need to build libiconv 6943 6942 # separately, but we also provide libiconvReal, which will always be a 6944 6943 # standalone libiconv, just in case you want it 6945 - libiconv = if stdenv.isGlibc then stdenv.cc.libc else libiconvReal; 6944 + libiconv = 6945 + if stdenv.isGlibc then stdenv.cc.libc 6946 + else if stdenv.isDarwin then darwin.libiconv 6947 + else libiconvReal; 6946 6948 6947 6949 libiconvReal = callPackage ../development/libraries/libiconv { 6948 6950 fetchurl = fetchurlBoot; ··· 9279 9281 xctoolchain = xcode.toolchain; 9280 9282 }; 9281 9283 9282 - cctools = (callPackage ../os-specific/darwin/cctools/port.nix {}).native; 9284 + cctools = (callPackage ../os-specific/darwin/cctools/port.nix { inherit libobjc; }).native; 9283 9285 9284 9286 maloader = callPackage ../os-specific/darwin/maloader { 9285 9287 inherit opencflite; ··· 9294 9296 9295 9297 ps = callPackage ../os-specific/darwin/adv_cmds/ps.nix {}; 9296 9298 9299 + locale = callPackage ../os-specific/darwin/adv_cmds/locale.nix {}; 9300 + 9297 9301 security_tool = callPackage ../os-specific/darwin/security-tool { inherit osx_private_sdk; }; 9302 + 9303 + binutils = callPackage ../os-specific/darwin/binutils { inherit cctools; }; 9298 9304 9299 9305 cmdline_sdk = cmdline.sdk; 9300 9306 cmdline_tools = cmdline.tools;