From f529df0e8d4fe717db09bc2464c53e4f8398a301 Mon Sep 17 00:00:00 2001 From: John Ericson Date: Thu, 6 May 2021 15:56:46 -0400 Subject: [PATCH 1/2] darwin packages: Get ready for cross If things build fine with `stdenvNoCC`, let them use that. If tools might be prefixed, prepare for that. --- .../CarbonHeaders/default.nix | 4 +- .../CommonCrypto/default.nix | 4 +- .../apple-source-releases/Csu/default.nix | 7 +- .../apple-source-releases/IOKit/default.nix | 4 +- .../apple-source-releases/Libc/825_40_1.nix | 4 +- .../apple-source-releases/Libc/default.nix | 4 +- .../apple-source-releases/Libinfo/default.nix | 4 +- .../apple-source-releases/Libm/default.nix | 4 +- .../Libnotify/default.nix | 4 +- .../Libsystem/default.nix | 24 +-- .../apple-source-releases/Security/boot.nix | 4 +- .../architecture/default.nix | 4 +- .../bootstrap_cmds/default.nix | 15 +- .../apple-source-releases/configd/default.nix | 148 +++++++++--------- .../copyfile/default.nix | 4 +- .../darwin/apple-source-releases/default.nix | 34 ++-- .../apple-source-releases/dyld/default.nix | 4 +- .../eap8021x/default.nix | 4 +- .../apple-source-releases/hfs/default.nix | 4 +- .../apple-source-releases/launchd/default.nix | 4 +- .../libclosure/default.nix | 4 +- .../libdispatch/default.nix | 4 +- .../libplatform/default.nix | 4 +- .../libpthread/default.nix | 4 +- .../libresolv/default.nix | 67 ++++---- .../apple-source-releases/libutil/default.nix | 4 +- .../mDNSResponder/default.nix | 4 +- .../apple-source-releases/ppp/default.nix | 4 +- .../removefile/default.nix | 4 +- .../apple-source-releases/xnu/default.nix | 23 ++- .../darwin/darwin-stubs/default.nix | 4 +- pkgs/stdenv/darwin/default.nix | 2 +- 32 files changed, 225 insertions(+), 191 deletions(-) diff --git a/pkgs/os-specific/darwin/apple-source-releases/CarbonHeaders/default.nix b/pkgs/os-specific/darwin/apple-source-releases/CarbonHeaders/default.nix index b53c5985a21c2..25e1df3773dbf 100644 --- a/pkgs/os-specific/darwin/apple-source-releases/CarbonHeaders/default.nix +++ b/pkgs/os-specific/darwin/apple-source-releases/CarbonHeaders/default.nix @@ -1,6 +1,6 @@ -{ lib, appleDerivation }: +{ lib, appleDerivation', stdenvNoCC }: -appleDerivation { +appleDerivation' stdenvNoCC { dontBuild = true; installPhase = '' diff --git a/pkgs/os-specific/darwin/apple-source-releases/CommonCrypto/default.nix b/pkgs/os-specific/darwin/apple-source-releases/CommonCrypto/default.nix index 476a77c59d7f8..36013fe307ce4 100644 --- a/pkgs/os-specific/darwin/apple-source-releases/CommonCrypto/default.nix +++ b/pkgs/os-specific/darwin/apple-source-releases/CommonCrypto/default.nix @@ -1,6 +1,6 @@ -{ lib, appleDerivation }: +{ lib, appleDerivation', stdenvNoCC }: -appleDerivation { +appleDerivation' stdenvNoCC { installPhase = '' mkdir -p $out/include/CommonCrypto cp include/* $out/include/CommonCrypto diff --git a/pkgs/os-specific/darwin/apple-source-releases/Csu/default.nix b/pkgs/os-specific/darwin/apple-source-releases/Csu/default.nix index e3b3179d4a3b2..10ec988462ee9 100644 --- a/pkgs/os-specific/darwin/apple-source-releases/Csu/default.nix +++ b/pkgs/os-specific/darwin/apple-source-releases/Csu/default.nix @@ -1,13 +1,14 @@ -{ lib, appleDerivation }: +{ lib, appleDerivation', stdenv }: + +appleDerivation' stdenv { -appleDerivation { prePatch = '' substituteInPlace Makefile \ --replace /usr/lib /lib \ --replace /usr/local/lib /lib \ --replace /usr/bin "" \ --replace /bin/ "" \ - --replace "CC = " "CC = cc #" \ + --replace "CC = " "CC = ${stdenv.cc.targetPrefix or ""}cc #" \ --replace "SDK_DIR = " "SDK_DIR = . #" \ # Mac OS didn't support rpaths back before 10.5, but we don't care about it. diff --git a/pkgs/os-specific/darwin/apple-source-releases/IOKit/default.nix b/pkgs/os-specific/darwin/apple-source-releases/IOKit/default.nix index 0ba61ccb49150..085d223bd04d8 100644 --- a/pkgs/os-specific/darwin/apple-source-releases/IOKit/default.nix +++ b/pkgs/os-specific/darwin/apple-source-releases/IOKit/default.nix @@ -1,7 +1,7 @@ -{ lib, appleDerivation, IOKitSrcs, xnu, darwin-stubs }: +{ lib, appleDerivation', stdenv, IOKitSrcs, xnu, darwin-stubs }: # Someday it'll make sense to split these out into their own packages, but today is not that day. -appleDerivation { +appleDerivation' stdenv { srcs = lib.attrValues IOKitSrcs; sourceRoot = "."; diff --git a/pkgs/os-specific/darwin/apple-source-releases/Libc/825_40_1.nix b/pkgs/os-specific/darwin/apple-source-releases/Libc/825_40_1.nix index 29aa3d64cb08b..c9202b536583c 100644 --- a/pkgs/os-specific/darwin/apple-source-releases/Libc/825_40_1.nix +++ b/pkgs/os-specific/darwin/apple-source-releases/Libc/825_40_1.nix @@ -1,6 +1,6 @@ -{ appleDerivation, ed, unifdef }: +{ appleDerivation', stdenvNoCC, ed, unifdef }: -appleDerivation { +appleDerivation' stdenvNoCC { nativeBuildInputs = [ ed unifdef ]; installPhase = '' diff --git a/pkgs/os-specific/darwin/apple-source-releases/Libc/default.nix b/pkgs/os-specific/darwin/apple-source-releases/Libc/default.nix index 3554a2e15b074..9bec0b103c9db 100644 --- a/pkgs/os-specific/darwin/apple-source-releases/Libc/default.nix +++ b/pkgs/os-specific/darwin/apple-source-releases/Libc/default.nix @@ -1,6 +1,6 @@ -{ appleDerivation, ed, unifdef, Libc_old, Libc_10-9 }: +{ appleDerivation', stdenvNoCC, ed, unifdef, Libc_old, Libc_10-9 }: -appleDerivation { +appleDerivation' stdenvNoCC { nativeBuildInputs = [ ed unifdef ]; # TODO: asl.h actually comes from syslog project now diff --git a/pkgs/os-specific/darwin/apple-source-releases/Libinfo/default.nix b/pkgs/os-specific/darwin/apple-source-releases/Libinfo/default.nix index 5481ae74d38d4..789e536b8a7f1 100644 --- a/pkgs/os-specific/darwin/apple-source-releases/Libinfo/default.nix +++ b/pkgs/os-specific/darwin/apple-source-releases/Libinfo/default.nix @@ -1,6 +1,6 @@ -{ appleDerivation }: +{ appleDerivation', stdenvNoCC }: -appleDerivation { +appleDerivation' stdenvNoCC { installPhase = '' substituteInPlace xcodescripts/install_files.sh \ --replace "/usr/local/" "/" \ diff --git a/pkgs/os-specific/darwin/apple-source-releases/Libm/default.nix b/pkgs/os-specific/darwin/apple-source-releases/Libm/default.nix index df5f6b7b8fd64..6e6712f375e65 100644 --- a/pkgs/os-specific/darwin/apple-source-releases/Libm/default.nix +++ b/pkgs/os-specific/darwin/apple-source-releases/Libm/default.nix @@ -1,6 +1,6 @@ -{ appleDerivation }: +{ appleDerivation', stdenvNoCC }: -appleDerivation { +appleDerivation' stdenvNoCC { installPhase = '' mkdir -p $out/include diff --git a/pkgs/os-specific/darwin/apple-source-releases/Libnotify/default.nix b/pkgs/os-specific/darwin/apple-source-releases/Libnotify/default.nix index 2ee80d7026463..969e64427c9b9 100644 --- a/pkgs/os-specific/darwin/apple-source-releases/Libnotify/default.nix +++ b/pkgs/os-specific/darwin/apple-source-releases/Libnotify/default.nix @@ -1,6 +1,6 @@ -{ appleDerivation }: +{ appleDerivation', stdenvNoCC }: -appleDerivation { +appleDerivation' stdenvNoCC { installPhase = '' mkdir -p $out/include cp notify.h $out/include diff --git a/pkgs/os-specific/darwin/apple-source-releases/Libsystem/default.nix b/pkgs/os-specific/darwin/apple-source-releases/Libsystem/default.nix index 2c98dd35e39d9..cb85566b51281 100644 --- a/pkgs/os-specific/darwin/apple-source-releases/Libsystem/default.nix +++ b/pkgs/os-specific/darwin/apple-source-releases/Libsystem/default.nix @@ -1,9 +1,13 @@ -{ lib, appleDerivation, cpio, xnu, Libc, Libm, libdispatch, cctools, Libinfo +{ lib, stdenv, buildPackages +, appleDerivation', cpio, xnu, Libc, Libm, libdispatch, Libinfo , dyld, Csu, architecture, libclosure, CarbonHeaders, ncurses, CommonCrypto -, copyfile, removefile, libresolv, Libnotify, libplatform, libpthread -, mDNSResponder, launchd, libutil, hfs, darling, darwin-stubs }: +, copyfile, removefile, libresolvHeaders, libresolv, Libnotify, libplatform, libpthread +, mDNSResponder, launchd, libutilHeaders, hfsHeaders, darling, darwin-stubs +, headersOnly ? false +, withLibresolv ? !headersOnly +}: -appleDerivation { +appleDerivation' stdenv { dontBuild = true; dontFixup = true; @@ -21,13 +25,13 @@ appleDerivation { for dep in ${Libc} ${Libm} ${Libinfo} ${dyld} ${architecture} \ ${libclosure} ${CarbonHeaders} ${libdispatch} ${ncurses.dev} \ - ${CommonCrypto} ${copyfile} ${removefile} ${libresolv} \ + ${CommonCrypto} ${copyfile} ${removefile} ${libresolvHeaders} \ ${Libnotify} ${libplatform} ${mDNSResponder} ${launchd} \ - ${libutil} ${libpthread} ${hfs}; do + ${libutilHeaders} ${libpthread} ${hfsHeaders}; do (cd $dep/include && find . -name '*.h' | cpio -pdm $out/include) done - (cd ${cctools.dev}/include/mach-o && find . -name '*.h' | cpio -pdm $out/include/mach-o) + (cd ${buildPackages.darwin.cctools.dev}/include/mach-o && find . -name '*.h' | cpio -pdm $out/include/mach-o) mkdir -p $out/include/os @@ -84,6 +88,7 @@ appleDerivation { #define TARGET_RT_64_BIT 1 #endif /* __TARGETCONDITIONALS__ */ EOF + '' + lib.optionalString (!headersOnly) '' # The startup object files cp ${Csu}/lib/* $out/lib @@ -101,14 +106,15 @@ appleDerivation { for name in c dbm dl info m mx poll proc pthread rpcsvc util gcc_s.10.4 gcc_s.10.5; do ln -s libSystem.tbd $out/lib/lib$name.tbd done + '' + lib.optionalString withLibresolv '' # This probably doesn't belong here, but we want to stay similar to glibc, which includes resolv internally... cp ${libresolv}/lib/libresolv.9.dylib $out/lib/libresolv.9.dylib - resolv_libSystem=$(otool -L "$out/lib/libresolv.9.dylib" | tail -n +3 | grep -o "$NIX_STORE.*-\S*") || true + resolv_libSystem=$(${stdenv.cc.bintools.targetPrefix}otool -L "$out/lib/libresolv.9.dylib" | tail -n +3 | grep -o "$NIX_STORE.*-\S*") || true echo $libs chmod +w $out/lib/libresolv.9.dylib - install_name_tool \ + ${stdenv.cc.bintools.targetPrefix}install_name_tool \ -id $out/lib/libresolv.9.dylib \ -change "$resolv_libSystem" /usr/lib/libSystem.dylib \ $out/lib/libresolv.9.dylib diff --git a/pkgs/os-specific/darwin/apple-source-releases/Security/boot.nix b/pkgs/os-specific/darwin/apple-source-releases/Security/boot.nix index b819057f0c1ad..bb09adce252e1 100644 --- a/pkgs/os-specific/darwin/apple-source-releases/Security/boot.nix +++ b/pkgs/os-specific/darwin/apple-source-releases/Security/boot.nix @@ -1,6 +1,6 @@ -{ appleDerivation, darwin-stubs }: +{ appleDerivation', stdenv, darwin-stubs }: -appleDerivation { +appleDerivation' stdenv { phases = [ "unpackPhase" "installPhase" ]; __propagatedImpureHostDeps = [ diff --git a/pkgs/os-specific/darwin/apple-source-releases/architecture/default.nix b/pkgs/os-specific/darwin/apple-source-releases/architecture/default.nix index 74327bc4c4285..e0e27255b72f4 100644 --- a/pkgs/os-specific/darwin/apple-source-releases/architecture/default.nix +++ b/pkgs/os-specific/darwin/apple-source-releases/architecture/default.nix @@ -1,6 +1,6 @@ -{ lib, appleDerivation }: +{ lib, appleDerivation', stdenvNoCC }: -appleDerivation { +appleDerivation' stdenvNoCC { dontBuild = true; postPatch = '' diff --git a/pkgs/os-specific/darwin/apple-source-releases/bootstrap_cmds/default.nix b/pkgs/os-specific/darwin/apple-source-releases/bootstrap_cmds/default.nix index 800da92dae9d5..3520d4bcddb1e 100644 --- a/pkgs/os-specific/darwin/apple-source-releases/bootstrap_cmds/default.nix +++ b/pkgs/os-specific/darwin/apple-source-releases/bootstrap_cmds/default.nix @@ -1,4 +1,13 @@ -{ lib, stdenv, appleDerivation, bison, flex }: +{ lib, appleDerivation, stdenv, bison, flex }: + +let + + # Hard to get CC to pull this off without infinite recursion + targetTargetPrefix = lib.optionalString + (with stdenv; hostPlatform != targetPlatform) + (stdenv.targetPlatform.config + "-"); + +in appleDerivation { nativeBuildInputs = [ bison flex ]; @@ -12,7 +21,7 @@ appleDerivation { yacc -d parser.y flex --header-file=lexxer.yy.h -o lexxer.yy.c lexxer.l - cc -std=gnu99 -Os -dead_strip -DMIG_VERSION=\"$pname-$version\" -I. -o migcom *.c + ${stdenv.cc.targetPrefix or ""}cc -std=gnu99 -Os -dead_strip -DMIG_VERSION=\"$pname-$version\" -I. -o migcom *.c ''; installPhase = '' @@ -29,6 +38,6 @@ appleDerivation { --replace 'arch=`/usr/bin/arch`' 'arch=${stdenv.targetPlatform.darwinArch}' \ --replace '/usr/bin/' "" \ --replace '/bin/rmdir' "rmdir" \ - --replace 'C=''${MIGCC}' "C=cc" + --replace 'C=''${MIGCC}' "C=${targetTargetPrefix}cc" ''; } diff --git a/pkgs/os-specific/darwin/apple-source-releases/configd/default.nix b/pkgs/os-specific/darwin/apple-source-releases/configd/default.nix index 20168d24dd712..2bd9f2087de8a 100644 --- a/pkgs/os-specific/darwin/apple-source-releases/configd/default.nix +++ b/pkgs/os-specific/darwin/apple-source-releases/configd/default.nix @@ -1,6 +1,6 @@ -{ stdenv, appleDerivation, launchd, bootstrap_cmds, xnu, ppp, IOKit, eap8021x, Security }: +{ stdenv, appleDerivation', launchd, bootstrap_cmds, xnu, ppp, IOKit, eap8021x, Security }: -appleDerivation { +appleDerivation' stdenv { meta.broken = stdenv.cc.nativeLibc; nativeBuildInputs = [ bootstrap_cmds ]; @@ -127,78 +127,78 @@ appleDerivation { mig -arch x86_64 -header derived/helper.h -user derived/helperUser.c -sheader /dev/null -server /dev/null helper/helper.defs mig -arch x86_64 -header derived/pppcontroller.h -user derived/pppcontrollerUser.c -sheader /dev/null -server /dev/null pppcontroller.defs - cc -I. -Ihelper -Iderived -F. -c SCSchemaDefinitions.c -o SCSchemaDefinitions.o - cc -I. -Ihelper -Iderived -F. -c SCD.c -o SCD.o - cc -I. -Ihelper -Iderived -F. -c SCDKeys.c -o SCDKeys.o - cc -I. -Ihelper -Iderived -F. -c SCDPrivate.c -o SCDPrivate.o - cc -I. -Ihelper -Iderived -F. -c SCDPlugin.c -o SCDPlugin.o - cc -I. -Ihelper -Iderived -F. -c CaptiveNetwork.c -o CaptiveNetwork.o - cc -I. -Ihelper -Iderived -F. -c SCDOpen.c -o SCDOpen.o - cc -I. -Ihelper -Iderived -F. -c SCDList.c -o SCDList.o - cc -I. -Ihelper -Iderived -F. -c SCDAdd.c -o SCDAdd.o - cc -I. -Ihelper -Iderived -F. -c SCDGet.c -o SCDGet.o - cc -I. -Ihelper -Iderived -F. -c SCDSet.c -o SCDSet.o - cc -I. -Ihelper -Iderived -F. -c SCDRemove.c -o SCDRemove.o - cc -I. -Ihelper -Iderived -F. -c SCDNotify.c -o SCDNotify.o - cc -I. -Ihelper -Iderived -F. -c SCDNotifierSetKeys.c -o SCDNotifierSetKeys.o - cc -I. -Ihelper -Iderived -F. -c SCDNotifierAdd.c -o SCDNotifierAdd.o - cc -I. -Ihelper -Iderived -F. -c SCDNotifierRemove.c -o SCDNotifierRemove.o - cc -I. -Ihelper -Iderived -F. -c SCDNotifierGetChanges.c -o SCDNotifierGetChanges.o - cc -I. -Ihelper -Iderived -F. -c SCDNotifierWait.c -o SCDNotifierWait.o - cc -I. -Ihelper -Iderived -F. -c SCDNotifierInformViaCallback.c -o SCDNotifierInformViaCallback.o - cc -I. -Ihelper -Iderived -F. -c SCDNotifierInformViaFD.c -o SCDNotifierInformViaFD.o - cc -I. -Ihelper -Iderived -F. -c SCDNotifierInformViaSignal.c -o SCDNotifierInformViaSignal.o - cc -I. -Ihelper -Iderived -F. -c SCDNotifierCancel.c -o SCDNotifierCancel.o - cc -I. -Ihelper -Iderived -F. -c SCDSnapshot.c -o SCDSnapshot.o - cc -I. -Ihelper -Iderived -F. -c SCP.c -o SCP.o - cc -I. -Ihelper -Iderived -F. -c SCPOpen.c -o SCPOpen.o - cc -I. -Ihelper -Iderived -F. -c SCPLock.c -o SCPLock.o - cc -I. -Ihelper -Iderived -F. -c SCPUnlock.c -o SCPUnlock.o - cc -I. -Ihelper -Iderived -F. -c SCPList.c -o SCPList.o - cc -I. -Ihelper -Iderived -F. -c SCPGet.c -o SCPGet.o - cc -I. -Ihelper -Iderived -F. -c SCPAdd.c -o SCPAdd.o - cc -I. -Ihelper -Iderived -F. -c SCPSet.c -o SCPSet.o - cc -I. -Ihelper -Iderived -F. -c SCPRemove.c -o SCPRemove.o - cc -I. -Ihelper -Iderived -F. -c SCPCommit.c -o SCPCommit.o - cc -I. -Ihelper -Iderived -F. -c SCPApply.c -o SCPApply.o - cc -I. -Ihelper -Iderived -F. -c SCPPath.c -o SCPPath.o - cc -I. -Ihelper -Iderived -F. -c SCDConsoleUser.c -o SCDConsoleUser.o - cc -I. -Ihelper -Iderived -F. -c SCDHostName.c -o SCDHostName.o - cc -I. -Ihelper -Iderived -F. -c SCLocation.c -o SCLocation.o - cc -I. -Ihelper -Iderived -F. -c SCNetwork.c -o SCNetwork.o - cc -I. -Ihelper -Iderived -F. -c derived/pppcontrollerUser.c -o pppcontrollerUser.o - cc -I. -Ihelper -Iderived -F. -c SCNetworkConnection.c -o SCNetworkConnection.o - cc -I. -Ihelper -Iderived -F. -c SCNetworkConnectionPrivate.c -o SCNetworkConnectionPrivate.o - cc -I. -Ihelper -Iderived -I../dnsinfo -F. -c SCNetworkReachability.c -o SCNetworkReachability.o - cc -I. -Ihelper -Iderived -F. -c SCProxies.c -o SCProxies.o - cc -I. -Ihelper -Iderived -F. -c DHCP.c -o DHCP.o - cc -I. -Ihelper -Iderived -F. -c moh.c -o moh.o - cc -I. -Ihelper -Iderived -F. -c DeviceOnHold.c -o DeviceOnHold.o - cc -I. -Ihelper -Iderived -I $HACK -F. -c LinkConfiguration.c -o LinkConfiguration.o - cc -I. -Ihelper -Iderived -F. -c dy_framework.c -o dy_framework.o - cc -I. -Ihelper -Iderived -I $HACK -F. -c VLANConfiguration.c -o VLANConfiguration.o - cc -I. -Ihelper -Iderived -F. -c derived/configUser.c -o configUser.o - cc -I. -Ihelper -Iderived -F. -c SCPreferencesPathKey.c -o SCPreferencesPathKey.o - cc -I. -Ihelper -Iderived -I../dnsinfo -F. -c derived/shared_dns_infoUser.c -o shared_dns_infoUser.o - cc -I. -Ihelper -Iderived -F. -c SCNetworkConfigurationInternal.c -o SCNetworkConfigurationInternal.o - cc -I. -Ihelper -Iderived -F. -c SCNetworkInterface.c -o SCNetworkInterface.o - cc -I. -Ihelper -Iderived -F. -c SCNetworkProtocol.c -o SCNetworkProtocol.o - cc -I. -Ihelper -Iderived -F. -c SCNetworkService.c -o SCNetworkService.o - cc -I. -Ihelper -Iderived -F. -c SCNetworkSet.c -o SCNetworkSet.o - cc -I. -Ihelper -Iderived -I $HACK -F. -c BondConfiguration.c -o BondConfiguration.o - cc -I. -Ihelper -Iderived -I $HACK -F. -c BridgeConfiguration.c -o BridgeConfiguration.o - cc -I. -Ihelper -Iderived -F. -c helper/SCHelper_client.c -o SCHelper_client.o - cc -I. -Ihelper -Iderived -F. -c SCPreferencesKeychainPrivate.c -o SCPreferencesKeychainPrivate.o - cc -I. -Ihelper -Iderived -F. -c SCNetworkSignature.c -o SCNetworkSignature.o - cc -I. -Ihelper -Iderived -F. -c VPNPrivate.c -o VPNPrivate.o - cc -I. -Ihelper -Iderived -F. -c VPNConfiguration.c -o VPNConfiguration.o - cc -I. -Ihelper -Iderived -F. -c VPNTunnel.c -o VPNTunnel.o - cc -I. -Ihelper -Iderived -F. -c derived/helperUser.c -o helperUser.o - cc -I. -Ihelper -Iderived -F. -c reachability/SCNetworkReachabilityServer_client.c -o SCNetworkReachabilityServer_client.o - cc -I. -Ihelper -Iderived -F. -c reachability/rb.c -o rb.o - cc -I. -Ihelper -Iderived -F. -c derived/SystemConfiguration_vers.c -o SystemConfiguration_vers.o - - cc -dynamiclib *.o -install_name $out/Library/Frameworks/SystemConfiguration.framework/SystemConfiguration -dead_strip -framework CoreFoundation -single_module -o SystemConfiguration.framework/SystemConfiguration + ${stdenv.cc.targetPrefix or ""}cc -I. -Ihelper -Iderived -F. -c SCSchemaDefinitions.c -o SCSchemaDefinitions.o + ${stdenv.cc.targetPrefix or ""}cc -I. -Ihelper -Iderived -F. -c SCD.c -o SCD.o + ${stdenv.cc.targetPrefix or ""}cc -I. -Ihelper -Iderived -F. -c SCDKeys.c -o SCDKeys.o + ${stdenv.cc.targetPrefix or ""}cc -I. -Ihelper -Iderived -F. -c SCDPrivate.c -o SCDPrivate.o + ${stdenv.cc.targetPrefix or ""}cc -I. -Ihelper -Iderived -F. -c SCDPlugin.c -o SCDPlugin.o + ${stdenv.cc.targetPrefix or ""}cc -I. -Ihelper -Iderived -F. -c CaptiveNetwork.c -o CaptiveNetwork.o + ${stdenv.cc.targetPrefix or ""}cc -I. -Ihelper -Iderived -F. -c SCDOpen.c -o SCDOpen.o + ${stdenv.cc.targetPrefix or ""}cc -I. -Ihelper -Iderived -F. -c SCDList.c -o SCDList.o + ${stdenv.cc.targetPrefix or ""}cc -I. -Ihelper -Iderived -F. -c SCDAdd.c -o SCDAdd.o + ${stdenv.cc.targetPrefix or ""}cc -I. -Ihelper -Iderived -F. -c SCDGet.c -o SCDGet.o + ${stdenv.cc.targetPrefix or ""}cc -I. -Ihelper -Iderived -F. -c SCDSet.c -o SCDSet.o + ${stdenv.cc.targetPrefix or ""}cc -I. -Ihelper -Iderived -F. -c SCDRemove.c -o SCDRemove.o + ${stdenv.cc.targetPrefix or ""}cc -I. -Ihelper -Iderived -F. -c SCDNotify.c -o SCDNotify.o + ${stdenv.cc.targetPrefix or ""}cc -I. -Ihelper -Iderived -F. -c SCDNotifierSetKeys.c -o SCDNotifierSetKeys.o + ${stdenv.cc.targetPrefix or ""}cc -I. -Ihelper -Iderived -F. -c SCDNotifierAdd.c -o SCDNotifierAdd.o + ${stdenv.cc.targetPrefix or ""}cc -I. -Ihelper -Iderived -F. -c SCDNotifierRemove.c -o SCDNotifierRemove.o + ${stdenv.cc.targetPrefix or ""}cc -I. -Ihelper -Iderived -F. -c SCDNotifierGetChanges.c -o SCDNotifierGetChanges.o + ${stdenv.cc.targetPrefix or ""}cc -I. -Ihelper -Iderived -F. -c SCDNotifierWait.c -o SCDNotifierWait.o + ${stdenv.cc.targetPrefix or ""}cc -I. -Ihelper -Iderived -F. -c SCDNotifierInformViaCallback.c -o SCDNotifierInformViaCallback.o + ${stdenv.cc.targetPrefix or ""}cc -I. -Ihelper -Iderived -F. -c SCDNotifierInformViaFD.c -o SCDNotifierInformViaFD.o + ${stdenv.cc.targetPrefix or ""}cc -I. -Ihelper -Iderived -F. -c SCDNotifierInformViaSignal.c -o SCDNotifierInformViaSignal.o + ${stdenv.cc.targetPrefix or ""}cc -I. -Ihelper -Iderived -F. -c SCDNotifierCancel.c -o SCDNotifierCancel.o + ${stdenv.cc.targetPrefix or ""}cc -I. -Ihelper -Iderived -F. -c SCDSnapshot.c -o SCDSnapshot.o + ${stdenv.cc.targetPrefix or ""}cc -I. -Ihelper -Iderived -F. -c SCP.c -o SCP.o + ${stdenv.cc.targetPrefix or ""}cc -I. -Ihelper -Iderived -F. -c SCPOpen.c -o SCPOpen.o + ${stdenv.cc.targetPrefix or ""}cc -I. -Ihelper -Iderived -F. -c SCPLock.c -o SCPLock.o + ${stdenv.cc.targetPrefix or ""}cc -I. -Ihelper -Iderived -F. -c SCPUnlock.c -o SCPUnlock.o + ${stdenv.cc.targetPrefix or ""}cc -I. -Ihelper -Iderived -F. -c SCPList.c -o SCPList.o + ${stdenv.cc.targetPrefix or ""}cc -I. -Ihelper -Iderived -F. -c SCPGet.c -o SCPGet.o + ${stdenv.cc.targetPrefix or ""}cc -I. -Ihelper -Iderived -F. -c SCPAdd.c -o SCPAdd.o + ${stdenv.cc.targetPrefix or ""}cc -I. -Ihelper -Iderived -F. -c SCPSet.c -o SCPSet.o + ${stdenv.cc.targetPrefix or ""}cc -I. -Ihelper -Iderived -F. -c SCPRemove.c -o SCPRemove.o + ${stdenv.cc.targetPrefix or ""}cc -I. -Ihelper -Iderived -F. -c SCPCommit.c -o SCPCommit.o + ${stdenv.cc.targetPrefix or ""}cc -I. -Ihelper -Iderived -F. -c SCPApply.c -o SCPApply.o + ${stdenv.cc.targetPrefix or ""}cc -I. -Ihelper -Iderived -F. -c SCPPath.c -o SCPPath.o + ${stdenv.cc.targetPrefix or ""}cc -I. -Ihelper -Iderived -F. -c SCDConsoleUser.c -o SCDConsoleUser.o + ${stdenv.cc.targetPrefix or ""}cc -I. -Ihelper -Iderived -F. -c SCDHostName.c -o SCDHostName.o + ${stdenv.cc.targetPrefix or ""}cc -I. -Ihelper -Iderived -F. -c SCLocation.c -o SCLocation.o + ${stdenv.cc.targetPrefix or ""}cc -I. -Ihelper -Iderived -F. -c SCNetwork.c -o SCNetwork.o + ${stdenv.cc.targetPrefix or ""}cc -I. -Ihelper -Iderived -F. -c derived/pppcontrollerUser.c -o pppcontrollerUser.o + ${stdenv.cc.targetPrefix or ""}cc -I. -Ihelper -Iderived -F. -c SCNetworkConnection.c -o SCNetworkConnection.o + ${stdenv.cc.targetPrefix or ""}cc -I. -Ihelper -Iderived -F. -c SCNetworkConnectionPrivate.c -o SCNetworkConnectionPrivate.o + ${stdenv.cc.targetPrefix or ""}cc -I. -Ihelper -Iderived -I../dnsinfo -F. -c SCNetworkReachability.c -o SCNetworkReachability.o + ${stdenv.cc.targetPrefix or ""}cc -I. -Ihelper -Iderived -F. -c SCProxies.c -o SCProxies.o + ${stdenv.cc.targetPrefix or ""}cc -I. -Ihelper -Iderived -F. -c DHCP.c -o DHCP.o + ${stdenv.cc.targetPrefix or ""}cc -I. -Ihelper -Iderived -F. -c moh.c -o moh.o + ${stdenv.cc.targetPrefix or ""}cc -I. -Ihelper -Iderived -F. -c DeviceOnHold.c -o DeviceOnHold.o + ${stdenv.cc.targetPrefix or ""}cc -I. -Ihelper -Iderived -I $HACK -F. -c LinkConfiguration.c -o LinkConfiguration.o + ${stdenv.cc.targetPrefix or ""}cc -I. -Ihelper -Iderived -F. -c dy_framework.c -o dy_framework.o + ${stdenv.cc.targetPrefix or ""}cc -I. -Ihelper -Iderived -I $HACK -F. -c VLANConfiguration.c -o VLANConfiguration.o + ${stdenv.cc.targetPrefix or ""}cc -I. -Ihelper -Iderived -F. -c derived/configUser.c -o configUser.o + ${stdenv.cc.targetPrefix or ""}cc -I. -Ihelper -Iderived -F. -c SCPreferencesPathKey.c -o SCPreferencesPathKey.o + ${stdenv.cc.targetPrefix or ""}cc -I. -Ihelper -Iderived -I../dnsinfo -F. -c derived/shared_dns_infoUser.c -o shared_dns_infoUser.o + ${stdenv.cc.targetPrefix or ""}cc -I. -Ihelper -Iderived -F. -c SCNetworkConfigurationInternal.c -o SCNetworkConfigurationInternal.o + ${stdenv.cc.targetPrefix or ""}cc -I. -Ihelper -Iderived -F. -c SCNetworkInterface.c -o SCNetworkInterface.o + ${stdenv.cc.targetPrefix or ""}cc -I. -Ihelper -Iderived -F. -c SCNetworkProtocol.c -o SCNetworkProtocol.o + ${stdenv.cc.targetPrefix or ""}cc -I. -Ihelper -Iderived -F. -c SCNetworkService.c -o SCNetworkService.o + ${stdenv.cc.targetPrefix or ""}cc -I. -Ihelper -Iderived -F. -c SCNetworkSet.c -o SCNetworkSet.o + ${stdenv.cc.targetPrefix or ""}cc -I. -Ihelper -Iderived -I $HACK -F. -c BondConfiguration.c -o BondConfiguration.o + ${stdenv.cc.targetPrefix or ""}cc -I. -Ihelper -Iderived -I $HACK -F. -c BridgeConfiguration.c -o BridgeConfiguration.o + ${stdenv.cc.targetPrefix or ""}cc -I. -Ihelper -Iderived -F. -c helper/SCHelper_client.c -o SCHelper_client.o + ${stdenv.cc.targetPrefix or ""}cc -I. -Ihelper -Iderived -F. -c SCPreferencesKeychainPrivate.c -o SCPreferencesKeychainPrivate.o + ${stdenv.cc.targetPrefix or ""}cc -I. -Ihelper -Iderived -F. -c SCNetworkSignature.c -o SCNetworkSignature.o + ${stdenv.cc.targetPrefix or ""}cc -I. -Ihelper -Iderived -F. -c VPNPrivate.c -o VPNPrivate.o + ${stdenv.cc.targetPrefix or ""}cc -I. -Ihelper -Iderived -F. -c VPNConfiguration.c -o VPNConfiguration.o + ${stdenv.cc.targetPrefix or ""}cc -I. -Ihelper -Iderived -F. -c VPNTunnel.c -o VPNTunnel.o + ${stdenv.cc.targetPrefix or ""}cc -I. -Ihelper -Iderived -F. -c derived/helperUser.c -o helperUser.o + ${stdenv.cc.targetPrefix or ""}cc -I. -Ihelper -Iderived -F. -c reachability/SCNetworkReachabilityServer_client.c -o SCNetworkReachabilityServer_client.o + ${stdenv.cc.targetPrefix or ""}cc -I. -Ihelper -Iderived -F. -c reachability/rb.c -o rb.o + ${stdenv.cc.targetPrefix or ""}cc -I. -Ihelper -Iderived -F. -c derived/SystemConfiguration_vers.c -o SystemConfiguration_vers.o + + ${stdenv.cc.targetPrefix or ""}cc -dynamiclib *.o -install_name $out/Library/Frameworks/SystemConfiguration.framework/SystemConfiguration -dead_strip -framework CoreFoundation -single_module -o SystemConfiguration.framework/SystemConfiguration popd >/dev/null ''; diff --git a/pkgs/os-specific/darwin/apple-source-releases/copyfile/default.nix b/pkgs/os-specific/darwin/apple-source-releases/copyfile/default.nix index 7e1dc5309b1d0..5e7f38e84d7d8 100644 --- a/pkgs/os-specific/darwin/apple-source-releases/copyfile/default.nix +++ b/pkgs/os-specific/darwin/apple-source-releases/copyfile/default.nix @@ -1,6 +1,6 @@ -{ appleDerivation }: +{ appleDerivation', stdenvNoCC }: -appleDerivation { +appleDerivation' stdenvNoCC { dontBuild = true; installPhase = '' mkdir -p $out/include/ diff --git a/pkgs/os-specific/darwin/apple-source-releases/default.nix b/pkgs/os-specific/darwin/apple-source-releases/default.nix index 3e431810f20d9..4fa4951c21da0 100644 --- a/pkgs/os-specific/darwin/apple-source-releases/default.nix +++ b/pkgs/os-specific/darwin/apple-source-releases/default.nix @@ -154,7 +154,7 @@ let version = versions.${sdkName}.${pname}; in fetchApple' pname version sha256; - appleDerivation' = pname: version: sdkName: sha256: attrs: stdenv.mkDerivation ({ + appleDerivation'' = stdenv: pname: version: sdkName: sha256: attrs: stdenv.mkDerivation ({ inherit pname version; src = if attrs ? srcs then null else (fetchApple' pname version sha256); @@ -220,17 +220,22 @@ let macosPackages_11_0_1 = import ./macos-11.0.1.nix { inherit applePackage'; }; developerToolsPackages_11_3_1 = import ./developer-tools-11.3.1.nix { inherit applePackage'; }; - applePackage' = namePath: version: sdkName: sha256: + applePackage'_ = stdenv: namePath: version: sdkName: sha256: let pname = builtins.head (lib.splitString "/" namePath); - appleDerivation = appleDerivation' pname version sdkName sha256; - callPackage = self.newScope { inherit appleDerivation; }; + appleDerivation' = stdenv: appleDerivation'' stdenv pname version sdkName sha256; + appleDerivation = appleDerivation' stdenv; + callPackage = self.newScope { inherit appleDerivation' appleDerivation; }; in callPackage (./. + "/${namePath}"); - applePackage = namePath: sdkName: sha256: let + applePackage' = applePackage'_ stdenv; + + applePackage_ = stdenv: namePath: sdkName: sha256: let pname = builtins.head (lib.splitString "/" namePath); version = versions.${sdkName}.${pname}; - in applePackage' namePath version sdkName sha256; + in applePackage'_ stdenv namePath version sdkName sha256; + + applePackage = applePackage_ stdenv; # Only used for bootstrapping. It’s convenient because it was the last version to come with a real makefile. adv_cmds-boot = applePackage "adv_cmds/boot.nix" "osx-10.5.8" "102ssayxbg9wb35mdmhswbnw0bg7js3pfd8fcbic83c5q3bqa6c6" {}; @@ -243,8 +248,8 @@ developerToolsPackages_11_3_1 // macosPackages_11_0_1 // { inherit (adv_cmds-boot) ps locale; architecture = applePackage "architecture" "osx-10.11.6" "1pbpjcd7is69hn8y29i98ci0byik826if8gnp824ha92h90w0fq3" {}; bsdmake = applePackage "bsdmake" "dev-tools-3.2.6" "11a9kkhz5bfgi1i8kpdkis78lhc6b5vxmhd598fcdgra1jw4iac2" {}; - CarbonHeaders = applePackage "CarbonHeaders" "osx-10.6.2" "1zam29847cxr6y9rnl76zqmkbac53nx0szmqm9w5p469a6wzjqar" {}; - CommonCrypto = applePackage "CommonCrypto" "osx-10.12.6" "0sgsqjcxbdm2g2zfpc50mzmk4b4ldyw7xvvkwiayhpczg1fga4ff" {}; + CarbonHeaders = applePackage_ stdenvNoCC "CarbonHeaders" "osx-10.6.2" "1zam29847cxr6y9rnl76zqmkbac53nx0szmqm9w5p469a6wzjqar" {}; + CommonCrypto = applePackage_ stdenvNoCC "CommonCrypto" "osx-10.12.6" "0sgsqjcxbdm2g2zfpc50mzmk4b4ldyw7xvvkwiayhpczg1fga4ff" {}; configd = applePackage "configd" "osx-10.8.5" "1gxakahk8gallf16xmhxhprdxkh3prrmzxnmxfvj0slr0939mmr2" { Security = applePackage "Security/boot.nix" "osx-10.9.5" "1nv0dczf67dhk17hscx52izgdcyacgyy12ag0jh6nl5hmfzsn8yy" {}; }; @@ -272,17 +277,16 @@ developerToolsPackages_11_3_1 // macosPackages_11_0_1 // { libplatform = applePackage "libplatform" "osx-10.12.6" "0rh1f5ybvwz8s0nwfar8s0fh7jbgwqcy903cv2x8m15iq1x599yn" {}; libpthread = applePackage "libpthread" "osx-10.12.6" "1j6541rcgjpas1fc77ip5krjgw4bvz6jq7bq7h9q7axb0jv2ns6c" {}; libresolv = applePackage "libresolv" "osx-10.12.6" "077j6ljfh7amqpk2146rr7dsz5vasvr3als830mgv5jzl7l6vz88" {}; - Libsystem = applePackage "Libsystem" "osx-10.12.6" "1082ircc1ggaq3wha218vmfa75jqdaqidsy1bmrc4ckfkbr3bwx2" { - libutil = pkgs.darwin.libutil.override { headersOnly = true; }; - hfs = pkgs.darwin.hfs.override { headersOnly = true; }; - }; + Libsystem = applePackage "Libsystem" "osx-10.12.6" "1082ircc1ggaq3wha218vmfa75jqdaqidsy1bmrc4ckfkbr3bwx2" {}; libutil = applePackage "libutil" "osx-10.12.6" "0lqdxaj82h8yjbjm856jjz9k2d96k0viimi881akfng08xk1246y" {}; libunwind = applePackage "libunwind" "osx-10.12.6" "0miffaa41cv0lzf8az5k1j1ng8jvqvxcr4qrlkf3xyj479arbk1b" {}; mDNSResponder = applePackage "mDNSResponder" "osx-10.12.6" "02ms1p8zlgmprzn65jzr7yaqxykh3zxjcrw0c06aayim6h0dsqfy" {}; objc4 = applePackage "objc4" "osx-10.12.6" "1cj1vhbcs9pkmag2ms8wslagicnq9bxi2qjkszmp3ys7z7ccrbwz" {}; ppp = applePackage "ppp" "osx-10.12.6" "1kcc2nc4x1kf8sz0a23i6nfpvxg381kipi0qdisrp8x9z2gbkxb8" {}; removefile = applePackage "removefile" "osx-10.12.6" "0jzjxbmxgjzhssqd50z7kq9dlwrv5fsdshh57c0f8mdwcs19bsyx" {}; - xnu = applePackage "xnu" "osx-10.12.6" "1sjb0i7qzz840v2h4z3s4jyjisad4r5yyi6sg8pakv3wd81i5fg5" {}; + xnu = applePackage "xnu" "osx-10.12.6" "1sjb0i7qzz840v2h4z3s4jyjisad4r5yyi6sg8pakv3wd81i5fg5" { + python3 = pkgs.buildPackages.buildPackages.python3; # TODO(@Ericson2314) this shouldn't be needed. + }; hfs = applePackage "hfs" "osx-10.12.6" "1mj3xvqpq1mgd80b6kl1s04knqnap7hccr0gz8rjphalq14rbl5g" {}; Librpcsvc = applePackage "Librpcsvc" "osx-10.11.6" "1zwfwcl9irxl1dlnf2b4v30vdybp0p0r6n6g1pd14zbdci1jcg2k" {}; adv_cmds = applePackage "adv_cmds" "osx-10.11.6" "12gbv35i09aij9g90p6b3x2f3ramw43qcb2gjrg8lzkzmwvcyw9q" {}; @@ -297,6 +301,10 @@ developerToolsPackages_11_3_1 // macosPackages_11_0_1 // { top = applePackage "top" "osx-10.11.6" "0i9120rfwapgwdvjbfg0ya143i29s1m8zbddsxh39pdc59xnsg5l" {}; PowerManagement = applePackage "PowerManagement" "osx-10.11.6" "1llimhvp0gjffd47322lnjq7cqwinx0c5z7ikli04ad5srpa68mh" {}; + libutilHeaders = pkgs.darwin.libutil.override { stdenv = pkgs.stdenvNoCC; headersOnly = true; }; + hfsHeaders = pkgs.darwin.hfs.override { stdenv = pkgs.stdenvNoCC; headersOnly = true; }; + libresolvHeaders= pkgs.darwin.libresolv.override { stdenv = pkgs.stdenvNoCC; headersOnly = true; }; + # TODO(matthewbauer): # To be removed, once I figure out how to build a newer Security version. Security = applePackage "Security/boot.nix" "osx-10.9.5" "1nv0dczf67dhk17hscx52izgdcyacgyy12ag0jh6nl5hmfzsn8yy" {}; diff --git a/pkgs/os-specific/darwin/apple-source-releases/dyld/default.nix b/pkgs/os-specific/darwin/apple-source-releases/dyld/default.nix index 01d44d22f5ef0..ca3b70cd09264 100644 --- a/pkgs/os-specific/darwin/apple-source-releases/dyld/default.nix +++ b/pkgs/os-specific/darwin/apple-source-releases/dyld/default.nix @@ -1,6 +1,6 @@ -{ lib, appleDerivation }: +{ lib, appleDerivation', stdenvNoCC }: -appleDerivation { +appleDerivation' stdenvNoCC { installPhase = '' mkdir -p $out/lib $out/include ln -s /usr/lib/dyld $out/lib/dyld diff --git a/pkgs/os-specific/darwin/apple-source-releases/eap8021x/default.nix b/pkgs/os-specific/darwin/apple-source-releases/eap8021x/default.nix index b24d94b9d70d8..f5c47f01d37a9 100644 --- a/pkgs/os-specific/darwin/apple-source-releases/eap8021x/default.nix +++ b/pkgs/os-specific/darwin/apple-source-releases/eap8021x/default.nix @@ -1,6 +1,6 @@ -{ appleDerivation }: +{ appleDerivation', stdenv }: -appleDerivation { +appleDerivation' stdenv { dontBuild = true; installPhase = '' mkdir -p $out/Library/Frameworks/EAP8021X.framework/Headers diff --git a/pkgs/os-specific/darwin/apple-source-releases/hfs/default.nix b/pkgs/os-specific/darwin/apple-source-releases/hfs/default.nix index 58bac765a959c..114a659fbbb07 100644 --- a/pkgs/os-specific/darwin/apple-source-releases/hfs/default.nix +++ b/pkgs/os-specific/darwin/apple-source-releases/hfs/default.nix @@ -1,6 +1,6 @@ -{ appleDerivation, lib, headersOnly ? true }: +{ appleDerivation', stdenv, lib, headersOnly ? true }: -appleDerivation { +appleDerivation' stdenv { installPhase = lib.optionalString headersOnly '' mkdir -p $out/include/hfs cp core/*.h $out/include/hfs diff --git a/pkgs/os-specific/darwin/apple-source-releases/launchd/default.nix b/pkgs/os-specific/darwin/apple-source-releases/launchd/default.nix index c882b83d0a384..67e051d56853e 100644 --- a/pkgs/os-specific/darwin/apple-source-releases/launchd/default.nix +++ b/pkgs/os-specific/darwin/apple-source-releases/launchd/default.nix @@ -1,6 +1,6 @@ -{ appleDerivation }: +{ appleDerivation', stdenvNoCC }: -appleDerivation { +appleDerivation' stdenvNoCC { # No clue why the same file has two different names. Ask Apple! installPhase = '' mkdir -p $out/include/ $out/include/servers diff --git a/pkgs/os-specific/darwin/apple-source-releases/libclosure/default.nix b/pkgs/os-specific/darwin/apple-source-releases/libclosure/default.nix index d42a288208c5b..976658b7e5ddc 100644 --- a/pkgs/os-specific/darwin/apple-source-releases/libclosure/default.nix +++ b/pkgs/os-specific/darwin/apple-source-releases/libclosure/default.nix @@ -1,6 +1,6 @@ -{ appleDerivation }: +{ appleDerivation', stdenvNoCC }: -appleDerivation { +appleDerivation' stdenvNoCC { installPhase = '' mkdir -p $out/include cp *.h $out/include/ diff --git a/pkgs/os-specific/darwin/apple-source-releases/libdispatch/default.nix b/pkgs/os-specific/darwin/apple-source-releases/libdispatch/default.nix index 3b9d4a34cc63a..e91ee86cde08f 100644 --- a/pkgs/os-specific/darwin/apple-source-releases/libdispatch/default.nix +++ b/pkgs/os-specific/darwin/apple-source-releases/libdispatch/default.nix @@ -1,6 +1,6 @@ -{ appleDerivation }: +{ appleDerivation', stdenvNoCC }: -appleDerivation { +appleDerivation' stdenvNoCC { dontConfigure = true; dontBuild = true; installPhase = '' diff --git a/pkgs/os-specific/darwin/apple-source-releases/libplatform/default.nix b/pkgs/os-specific/darwin/apple-source-releases/libplatform/default.nix index 9acbcb212e4d8..39c801962692f 100644 --- a/pkgs/os-specific/darwin/apple-source-releases/libplatform/default.nix +++ b/pkgs/os-specific/darwin/apple-source-releases/libplatform/default.nix @@ -1,6 +1,6 @@ -{ appleDerivation }: +{ appleDerivation', stdenvNoCC }: -appleDerivation { +appleDerivation' stdenvNoCC { installPhase = '' mkdir $out cp -r include $out/include diff --git a/pkgs/os-specific/darwin/apple-source-releases/libpthread/default.nix b/pkgs/os-specific/darwin/apple-source-releases/libpthread/default.nix index 20eccd8205970..3d62270d76c0d 100644 --- a/pkgs/os-specific/darwin/apple-source-releases/libpthread/default.nix +++ b/pkgs/os-specific/darwin/apple-source-releases/libpthread/default.nix @@ -1,6 +1,6 @@ -{ lib, appleDerivation, libdispatch, xnu }: +{ lib, appleDerivation', stdenvNoCC, libdispatch, xnu }: -appleDerivation { +appleDerivation' stdenvNoCC { propagatedBuildInputs = [ libdispatch xnu ]; installPhase = '' diff --git a/pkgs/os-specific/darwin/apple-source-releases/libresolv/default.nix b/pkgs/os-specific/darwin/apple-source-releases/libresolv/default.nix index f3c7558cfc626..595a74dd4d016 100644 --- a/pkgs/os-specific/darwin/apple-source-releases/libresolv/default.nix +++ b/pkgs/os-specific/darwin/apple-source-releases/libresolv/default.nix @@ -1,37 +1,39 @@ -{ appleDerivation, Libinfo, configd, mDNSResponder }: +{ lib, appleDerivation', stdenv, Libinfo, configd, mDNSResponder +, headersOnly ? false +}: -appleDerivation { - buildInputs = [ Libinfo configd mDNSResponder ]; +appleDerivation' stdenv { + buildInputs = lib.optionals (!headersOnly) [ Libinfo configd mDNSResponder ]; - buildPhase = '' - cc -I. -c dns_util.c - cc -I. -c dns.c - cc -I. -c dns_async.c - cc -I. -c base64.c - cc -I. -c dst_api.c - cc -I. -c dst_hmac_link.c - cc -I. -c dst_support.c - cc -I. -c ns_date.c - cc -I. -c ns_name.c - cc -I. -c ns_netint.c - cc -I. -c ns_parse.c - cc -I. -c ns_print.c - cc -I. -c ns_samedomain.c - cc -I. -c ns_sign.c - cc -I. -c ns_ttl.c - cc -I. -c ns_verify.c - cc -I. -c res_comp.c - cc -I. -c res_data.c - cc -I. -c res_debug.c - cc -I. -c res_findzonecut.c - cc -I. -c res_init.c - cc -I. -c res_mkquery.c - cc -I. -c res_mkupdate.c - cc -I. -c res_query.c - cc -I. -c res_send.c - cc -I. -c res_sendsigned.c - cc -I. -c res_update.c - cc -dynamiclib -install_name $out/lib/libresolv.9.dylib -current_version 1.0.0 -compatibility_version 1.0.0 -o libresolv.9.dylib *.o + buildPhase = lib.optionalString (!headersOnly) '' + ${stdenv.cc.targetPrefix or ""}cc -I. -c dns_util.c + ${stdenv.cc.targetPrefix or ""}cc -I. -c dns.c + ${stdenv.cc.targetPrefix or ""}cc -I. -c dns_async.c + ${stdenv.cc.targetPrefix or ""}cc -I. -c base64.c + ${stdenv.cc.targetPrefix or ""}cc -I. -c dst_api.c + ${stdenv.cc.targetPrefix or ""}cc -I. -c dst_hmac_link.c + ${stdenv.cc.targetPrefix or ""}cc -I. -c dst_support.c + ${stdenv.cc.targetPrefix or ""}cc -I. -c ns_date.c + ${stdenv.cc.targetPrefix or ""}cc -I. -c ns_name.c + ${stdenv.cc.targetPrefix or ""}cc -I. -c ns_netint.c + ${stdenv.cc.targetPrefix or ""}cc -I. -c ns_parse.c + ${stdenv.cc.targetPrefix or ""}cc -I. -c ns_print.c + ${stdenv.cc.targetPrefix or ""}cc -I. -c ns_samedomain.c + ${stdenv.cc.targetPrefix or ""}cc -I. -c ns_sign.c + ${stdenv.cc.targetPrefix or ""}cc -I. -c ns_ttl.c + ${stdenv.cc.targetPrefix or ""}cc -I. -c ns_verify.c + ${stdenv.cc.targetPrefix or ""}cc -I. -c res_comp.c + ${stdenv.cc.targetPrefix or ""}cc -I. -c res_data.c + ${stdenv.cc.targetPrefix or ""}cc -I. -c res_debug.c + ${stdenv.cc.targetPrefix or ""}cc -I. -c res_findzonecut.c + ${stdenv.cc.targetPrefix or ""}cc -I. -c res_init.c + ${stdenv.cc.targetPrefix or ""}cc -I. -c res_mkquery.c + ${stdenv.cc.targetPrefix or ""}cc -I. -c res_mkupdate.c + ${stdenv.cc.targetPrefix or ""}cc -I. -c res_query.c + ${stdenv.cc.targetPrefix or ""}cc -I. -c res_send.c + ${stdenv.cc.targetPrefix or ""}cc -I. -c res_sendsigned.c + ${stdenv.cc.targetPrefix or ""}cc -I. -c res_update.c + ${stdenv.cc.targetPrefix or ""}cc -dynamiclib -install_name $out/lib/libresolv.9.dylib -current_version 1.0.0 -compatibility_version 1.0.0 -o libresolv.9.dylib *.o ''; installPhase = '' @@ -42,6 +44,7 @@ appleDerivation { cp nameser.h $out/include ln -s ../nameser.h $out/include/arpa cp resolv.h $out/include + '' + lib.optionalString (!headersOnly) '' cp libresolv.9.dylib $out/lib ln -s libresolv.9.dylib $out/lib/libresolv.dylib diff --git a/pkgs/os-specific/darwin/apple-source-releases/libutil/default.nix b/pkgs/os-specific/darwin/apple-source-releases/libutil/default.nix index ea9ca75e7e54b..373314dc2b7bb 100644 --- a/pkgs/os-specific/darwin/apple-source-releases/libutil/default.nix +++ b/pkgs/os-specific/darwin/apple-source-releases/libutil/default.nix @@ -1,9 +1,9 @@ -{ lib, appleDerivation, xcbuildHook +{ lib, stdenv, appleDerivation', xcbuildHook # headersOnly is true when building for libSystem , headersOnly ? false }: -appleDerivation { +appleDerivation' stdenv { nativeBuildInputs = lib.optional (!headersOnly) xcbuildHook; prePatch = '' diff --git a/pkgs/os-specific/darwin/apple-source-releases/mDNSResponder/default.nix b/pkgs/os-specific/darwin/apple-source-releases/mDNSResponder/default.nix index f17ed785360d9..64de728805fd3 100644 --- a/pkgs/os-specific/darwin/apple-source-releases/mDNSResponder/default.nix +++ b/pkgs/os-specific/darwin/apple-source-releases/mDNSResponder/default.nix @@ -1,6 +1,6 @@ -{ appleDerivation }: +{ appleDerivation', stdenvNoCC }: -appleDerivation { +appleDerivation' stdenvNoCC { phases = [ "unpackPhase" "installPhase" ]; installPhase = '' diff --git a/pkgs/os-specific/darwin/apple-source-releases/ppp/default.nix b/pkgs/os-specific/darwin/apple-source-releases/ppp/default.nix index 5668c376130e7..4ced564ffb722 100644 --- a/pkgs/os-specific/darwin/apple-source-releases/ppp/default.nix +++ b/pkgs/os-specific/darwin/apple-source-releases/ppp/default.nix @@ -1,6 +1,6 @@ -{ appleDerivation }: +{ appleDerivation', stdenv }: -appleDerivation { +appleDerivation' stdenv { dontBuild = true; installPhase = '' mkdir -p $out/include/ppp diff --git a/pkgs/os-specific/darwin/apple-source-releases/removefile/default.nix b/pkgs/os-specific/darwin/apple-source-releases/removefile/default.nix index 0b2c1c9c7dcc3..611f445e1ec94 100644 --- a/pkgs/os-specific/darwin/apple-source-releases/removefile/default.nix +++ b/pkgs/os-specific/darwin/apple-source-releases/removefile/default.nix @@ -1,6 +1,6 @@ -{ appleDerivation }: +{ appleDerivation', stdenvNoCC }: -appleDerivation { +appleDerivation' stdenvNoCC { installPhase = '' mkdir -p $out/include/ cp removefile.h checkint.h $out/include/ diff --git a/pkgs/os-specific/darwin/apple-source-releases/xnu/default.nix b/pkgs/os-specific/darwin/apple-source-releases/xnu/default.nix index 9892814468e9b..850933b45f1e5 100644 --- a/pkgs/os-specific/darwin/apple-source-releases/xnu/default.nix +++ b/pkgs/os-specific/darwin/apple-source-releases/xnu/default.nix @@ -1,8 +1,15 @@ -{ appleDerivation, lib, bootstrap_cmds, bison, flex +{ appleDerivation', lib, stdenv, buildPackages +, bootstrap_cmds, bison, flex , gnum4, unifdef, perl, python3 -, headersOnly ? true }: +, headersOnly ? true +}: + +appleDerivation' stdenv ({ + # TODO Make unconditional next mass rebuild + depsBuildBuild = lib.optional + (stdenv.hostPlatform != stdenv.buildPlatform) + buildPackages.stdenv.cc; -appleDerivation ({ nativeBuildInputs = [ bootstrap_cmds bison flex gnum4 unifdef perl python3 ]; patches = [ ./python3.patch ]; @@ -44,16 +51,16 @@ appleDerivation ({ PLATFORM = "MacOSX"; SDKVERSION = "10.11"; - CC = "cc"; - CXX = "c++"; + CC = "${stdenv.cc.targetPrefix or ""}cc"; + CXX = "${stdenv.cc.targetPrefix or ""}c++"; MIG = "mig"; MIGCOM = "migcom"; - STRIP = "strip"; - NM = "nm"; + STRIP = "${stdenv.cc.bintools.targetPrefix or ""}strip"; + NM = "${stdenv.cc.bintools.targetPrefix or ""}nm"; UNIFDEF = "unifdef"; DSYMUTIL = "dsymutil"; HOST_OS_VERSION = "10.10"; - HOST_CC = "cc"; + HOST_CC = "${buildPackages.stdenv.cc.targetPrefix or ""}cc"; HOST_FLEX = "flex"; HOST_BISON = "bison"; HOST_GM4 = "m4"; diff --git a/pkgs/os-specific/darwin/darwin-stubs/default.nix b/pkgs/os-specific/darwin/darwin-stubs/default.nix index aa946eb5bf0a2..6e3439455cce5 100644 --- a/pkgs/os-specific/darwin/darwin-stubs/default.nix +++ b/pkgs/os-specific/darwin/darwin-stubs/default.nix @@ -1,6 +1,6 @@ -{ stdenv, fetchurl }: +{ stdenvNoCC, fetchurl }: -stdenv.mkDerivation { +stdenvNoCC.mkDerivation { pname = "darwin-stubs"; version = "10.12"; diff --git a/pkgs/stdenv/darwin/default.nix b/pkgs/stdenv/darwin/default.nix index c2db758bbeae6..6ccebd20adefe 100644 --- a/pkgs/stdenv/darwin/default.nix +++ b/pkgs/stdenv/darwin/default.nix @@ -201,7 +201,7 @@ in rec { ''; }; - darwin-stubs = superDarwin.darwin-stubs.override { inherit (self) stdenv fetchurl; }; + darwin-stubs = superDarwin.darwin-stubs.override { inherit (self) stdenvNoCC fetchurl; }; dyld = { name = "bootstrap-stage0-dyld"; From 08d11318de151dd4253ab0878941f1580fd23d30 Mon Sep 17 00:00:00 2001 From: John Ericson Date: Sat, 1 May 2021 03:03:19 +0000 Subject: [PATCH 2/2] treewide: Try to put together darwin cross bootsttrapping --- pkgs/build-support/cc-wrapper/default.nix | 1 + .../development/compilers/llvm/10/default.nix | 10 ++- .../development/compilers/llvm/11/default.nix | 10 ++- pkgs/development/compilers/llvm/5/default.nix | 10 ++- pkgs/development/compilers/llvm/6/default.nix | 10 ++- pkgs/development/compilers/llvm/7/default.nix | 63 +++++++++++++++++-- pkgs/development/compilers/llvm/8/default.nix | 10 ++- pkgs/development/compilers/llvm/9/default.nix | 10 ++- .../darwin/apple-source-releases/default.nix | 62 +++++++++++++++++- pkgs/top-level/all-packages.nix | 40 +++++++++--- pkgs/top-level/stage.nix | 3 +- 11 files changed, 209 insertions(+), 20 deletions(-) diff --git a/pkgs/build-support/cc-wrapper/default.nix b/pkgs/build-support/cc-wrapper/default.nix index 36a98a180b3e2..696d1a390099d 100644 --- a/pkgs/build-support/cc-wrapper/default.nix +++ b/pkgs/build-support/cc-wrapper/default.nix @@ -64,6 +64,7 @@ let useGccForLibs = isClang && libcxx == null + && !stdenv.targetPlatform.isDarwin && !(stdenv.targetPlatform.useLLVM or false) && !(stdenv.targetPlatform.useAndroidPrebuilt or false) && !(stdenv.targetPlatform.isiOS or false) diff --git a/pkgs/development/compilers/llvm/10/default.nix b/pkgs/development/compilers/llvm/10/default.nix index 9bc79b586930d..338099bff8684 100644 --- a/pkgs/development/compilers/llvm/10/default.nix +++ b/pkgs/development/compilers/llvm/10/default.nix @@ -1,5 +1,5 @@ { lowPrio, newScope, pkgs, lib, stdenv, cmake, gccForLibs -, libxml2, python3, isl, fetchurl, overrideCC, wrapCCWith, wrapBintoolsWith +, libxml2, python3, isl, fetchurl, overrideCC, wrapCCWith, wrapCCWithoutLibc, wrapBintoolsWith , buildLlvmTools # tools, but from the previous stage, for cross , targetLlvmLibraries # libraries, but from the next stage, for cross }: @@ -80,6 +80,14 @@ let extraBuildCommands = mkExtraBuildCommands cc; }; + clangNoLibc = wrapCCWithoutLibc rec { + cc = tools.clang-unwrapped; + extraPackages = [ + targetLlvmLibraries.compiler-rt + ]; + extraBuildCommands = mkExtraBuildCommands cc; + }; + lld = callPackage ./lld {}; lldb = callPackage ./lldb {}; diff --git a/pkgs/development/compilers/llvm/11/default.nix b/pkgs/development/compilers/llvm/11/default.nix index cb5d08d9ff029..e96979125ae11 100644 --- a/pkgs/development/compilers/llvm/11/default.nix +++ b/pkgs/development/compilers/llvm/11/default.nix @@ -1,5 +1,5 @@ { lowPrio, newScope, pkgs, lib, stdenv, cmake, gccForLibs -, libxml2, python3, isl, fetchurl, overrideCC, wrapCCWith, wrapBintoolsWith +, libxml2, python3, isl, fetchurl, overrideCC, wrapCCWith, wrapCCWithoutLibc, wrapBintoolsWith , buildLlvmTools # tools, but from the previous stage, for cross , targetLlvmLibraries # libraries, but from the next stage, for cross }: @@ -82,6 +82,14 @@ let extraBuildCommands = mkExtraBuildCommands cc; }; + clangNoLibc = wrapCCWithoutLibc rec { + cc = tools.clang-unwrapped; + extraPackages = [ + targetLlvmLibraries.compiler-rt + ]; + extraBuildCommands = mkExtraBuildCommands cc; + }; + lld = callPackage ./lld {}; lldb = callPackage ./lldb {}; diff --git a/pkgs/development/compilers/llvm/5/default.nix b/pkgs/development/compilers/llvm/5/default.nix index 97a295d2d29a9..3c56fcab013cd 100644 --- a/pkgs/development/compilers/llvm/5/default.nix +++ b/pkgs/development/compilers/llvm/5/default.nix @@ -1,5 +1,5 @@ { lowPrio, newScope, pkgs, lib, stdenv, cmake, gccForLibs -, libxml2, python3, isl, fetchurl, overrideCC, wrapCCWith +, libxml2, python3, isl, fetchurl, overrideCC, wrapCCWith, wrapCCWithoutLibc , buildLlvmTools # tools, but from the previous stage, for cross , targetLlvmLibraries # libraries, but from the next stage, for cross }: @@ -76,6 +76,14 @@ let extraBuildCommands = mkExtraBuildCommands cc; }; + clangNoLibc = wrapCCWithoutLibc rec { + cc = tools.clang-unwrapped; + extraPackages = [ + targetLlvmLibraries.compiler-rt + ]; + extraBuildCommands = mkExtraBuildCommands cc; + }; + lld = callPackage ./lld {}; lldb = callPackage ./lldb {}; diff --git a/pkgs/development/compilers/llvm/6/default.nix b/pkgs/development/compilers/llvm/6/default.nix index 0fc49844b5de6..ffc1617378148 100644 --- a/pkgs/development/compilers/llvm/6/default.nix +++ b/pkgs/development/compilers/llvm/6/default.nix @@ -1,5 +1,5 @@ { lowPrio, newScope, pkgs, lib, stdenv, cmake, gccForLibs -, libxml2, python3, isl, fetchurl, overrideCC, wrapCCWith +, libxml2, python3, isl, fetchurl, overrideCC, wrapCCWith, wrapCCWithoutLibc , buildLlvmTools # tools, but from the previous stage, for cross , targetLlvmLibraries # libraries, but from the next stage, for cross }: @@ -77,6 +77,14 @@ let extraBuildCommands = mkExtraBuildCommands cc; }; + clangNoLibc = wrapCCWithoutLibc rec { + cc = tools.clang-unwrapped; + extraPackages = [ + targetLlvmLibraries.compiler-rt + ]; + extraBuildCommands = mkExtraBuildCommands cc; + }; + lld = callPackage ./lld {}; lldb = callPackage ./lldb {}; diff --git a/pkgs/development/compilers/llvm/7/default.nix b/pkgs/development/compilers/llvm/7/default.nix index 8a80c55d45a2d..8330d24e972ae 100644 --- a/pkgs/development/compilers/llvm/7/default.nix +++ b/pkgs/development/compilers/llvm/7/default.nix @@ -1,5 +1,5 @@ { lowPrio, newScope, pkgs, lib, stdenv, cmake, gccForLibs -, libxml2, python3, isl, fetchurl, overrideCC, wrapCCWith, wrapBintoolsWith +, libxml2, python3, isl, fetchurl, overrideCC, wrapCCWith, wrapCCWithoutLibc, wrapBintoolsWith , buildLlvmTools # tools, but from the previous stage, for cross , targetLlvmLibraries # libraries, but from the next stage, for cross }: @@ -82,6 +82,52 @@ let extraBuildCommands = mkExtraBuildCommands cc; }; + clangNoLibcxx = wrapCCWith rec { + cc = tools.clang-unwrapped; + libcxx = null; + bintools = wrapBintoolsWith { + inherit (tools) bintools; + }; + extraPackages = [ + targetLlvmLibraries.compiler-rt + ]; + extraBuildCommands = '' + echo "-rtlib=compiler-rt" >> $out/nix-support/cc-cflags + echo "-B${targetLlvmLibraries.compiler-rt}/lib" >> $out/nix-support/cc-cflags + echo "-nostdlib++" >> $out/nix-support/cc-cflags + '' + mkExtraBuildCommands cc; + }; + + clangNoLibcYesCompilerRt = wrapCCWithoutLibc rec { + cc = tools.clang-unwrapped; + extraPackages = [ + targetLlvmLibraries.compiler-rt + ]; + extraBuildCommands = '' + echo "-rtlib=compiler-rt" >> $out/nix-support/cc-cflags + echo "-B${targetLlvmLibraries.compiler-rt}/lib" >> $out/nix-support/cc-cflags + '' + mkExtraBuildCommands cc; + }; + + # Darwin "builds" Libsystem then compiler-rt + clangYesLibcNoCompilerRt = wrapCCWith { + cc = tools.clang-unwrapped; + libcxx = null; + extraPackages = [ ]; + extraBuildCommands = '' + echo "-nostartfiles" >> $out/nix-support/cc-cflags + ''; + }; + + clangNoLibcNoCompilerRt = wrapCCWithoutLibc { + cc = tools.clang-unwrapped; + libcxx = null; + extraPackages = [ ]; + extraBuildCommands = '' + echo "-nostartfiles" >> $out/nix-support/cc-cflags + ''; + }; + lld = callPackage ./lld {}; lldb = callPackage ./lldb {}; @@ -167,9 +213,12 @@ let in { compiler-rt = callPackage ./compiler-rt { - stdenv = if stdenv.hostPlatform.useLLVM or false - then overrideCC stdenv buildLlvmTools.lldClangNoCompilerRt - else stdenv; + stdenv = + /**/ if stdenv.hostPlatform.useLLVM or false + then overrideCC stdenv buildLlvmTools.lldClangNoCompilerRt + else if stdenv.hostPlatform != stdenv.buildPlatform && stdenv.hostPlatform.isDarwin + then overrideCC stdenv buildLlvmTools.clangYesLibcNoCompilerRt + else stdenv; }; stdenv = overrideCC stdenv buildLlvmTools.clang; @@ -177,11 +226,17 @@ let libcxxStdenv = overrideCC stdenv buildLlvmTools.libcxxClang; libcxx = callPackage ./libc++ ({} // + (lib.optionalAttrs (stdenv.hostPlatform != stdenv.buildPlatform && stdenv.hostPlatform.isDarwin) { + stdenv = overrideCC stdenv buildLlvmTools.clangNoLibcxx; + }) // (lib.optionalAttrs (stdenv.hostPlatform.useLLVM or false) { stdenv = overrideCC stdenv buildLlvmTools.lldClangNoLibcxx; })); libcxxabi = callPackage ./libc++abi ({} // + (lib.optionalAttrs (stdenv.hostPlatform != stdenv.buildPlatform && stdenv.hostPlatform.isDarwin) { + stdenv = overrideCC stdenv buildLlvmTools.clangYesLibcNoCompilerRt; + }) // (lib.optionalAttrs (stdenv.hostPlatform.useLLVM or false) { stdenv = overrideCC stdenv buildLlvmTools.lldClangNoLibcxx; libunwind = libraries.libunwind; diff --git a/pkgs/development/compilers/llvm/8/default.nix b/pkgs/development/compilers/llvm/8/default.nix index 3e7ef892e3dbe..3836e3ebe873a 100644 --- a/pkgs/development/compilers/llvm/8/default.nix +++ b/pkgs/development/compilers/llvm/8/default.nix @@ -1,5 +1,5 @@ { lowPrio, newScope, pkgs, lib, stdenv, cmake, gccForLibs -, libxml2, python3, isl, fetchurl, overrideCC, wrapCCWith, wrapBintoolsWith +, libxml2, python3, isl, fetchurl, overrideCC, wrapCCWith, wrapCCWithoutLibc, wrapBintoolsWith , buildLlvmTools # tools, but from the previous stage, for cross , targetLlvmLibraries # libraries, but from the next stage, for cross }: @@ -83,6 +83,14 @@ let extraBuildCommands = mkExtraBuildCommands cc; }; + clangNoLibc = wrapCCWithoutLibc rec { + cc = tools.clang-unwrapped; + extraPackages = [ + targetLlvmLibraries.compiler-rt + ]; + extraBuildCommands = mkExtraBuildCommands cc; + }; + lld = callPackage ./lld {}; lldb = callPackage ./lldb {}; diff --git a/pkgs/development/compilers/llvm/9/default.nix b/pkgs/development/compilers/llvm/9/default.nix index 1415784253762..873fedd9459df 100644 --- a/pkgs/development/compilers/llvm/9/default.nix +++ b/pkgs/development/compilers/llvm/9/default.nix @@ -1,5 +1,5 @@ { lowPrio, newScope, pkgs, lib, stdenv, cmake, gccForLibs -, libxml2, python3, isl, fetchurl, overrideCC, wrapCCWith, wrapBintoolsWith +, libxml2, python3, isl, fetchurl, overrideCC, wrapCCWith, wrapCCWithoutLibc, wrapBintoolsWith , buildLlvmTools # tools, but from the previous stage, for cross , targetLlvmLibraries # libraries, but from the next stage, for cross }: @@ -83,6 +83,14 @@ let extraBuildCommands = mkExtraBuildCommands cc; }; + clangNoLibc = wrapCCWithoutLibc rec { + cc = tools.clang-unwrapped; + extraPackages = [ + targetLlvmLibraries.compiler-rt + ]; + extraBuildCommands = mkExtraBuildCommands cc; + }; + lld = callPackage ./lld {}; lldb = callPackage ./lldb {}; diff --git a/pkgs/os-specific/darwin/apple-source-releases/default.nix b/pkgs/os-specific/darwin/apple-source-releases/default.nix index 4fa4951c21da0..1420f3af308c6 100644 --- a/pkgs/os-specific/darwin/apple-source-releases/default.nix +++ b/pkgs/os-specific/darwin/apple-source-releases/default.nix @@ -240,6 +240,27 @@ let # Only used for bootstrapping. It’s convenient because it was the last version to come with a real makefile. adv_cmds-boot = applePackage "adv_cmds/boot.nix" "osx-10.5.8" "102ssayxbg9wb35mdmhswbnw0bg7js3pfd8fcbic83c5q3bqa6c6" {}; + # Contains a headers-only libsystem + stdenvHeadersLibsystem = pkgs.crossLibcStdenv.override (old: { + cc = old.cc.override rec { + bintools = old.cc.bintools.override { + libc = pkgs.darwin.LibsystemCrossHeaders; + noLibc = false; + }; + libc = bintools.libc; + noLibc = false; + }; + }); + + # Contains a libsystem withot libresolv + stdenvBasicLibsystem = stdenvHeadersLibsystem.override (old: { + cc = old.cc.override rec { + bintools = old.cc.bintools.override { + libc = pkgs.darwin.LibsystemCrossBasic; + }; + libc = bintools.libc; + }; + }); in developerToolsPackages_11_3_1 // macosPackages_11_0_1 // { @@ -307,5 +328,44 @@ developerToolsPackages_11_3_1 // macosPackages_11_0_1 // { # TODO(matthewbauer): # To be removed, once I figure out how to build a newer Security version. - Security = applePackage "Security/boot.nix" "osx-10.9.5" "1nv0dczf67dhk17hscx52izgdcyacgyy12ag0jh6nl5hmfzsn8yy" {}; + Security = applePackage "Security/boot.nix" "osx-10.9.5" "1nv0dczf67dhk17hscx52izgdcyacgyy12ag0jh6nl5hmfzsn8yy" {}; + + # TODO(@Ericson2314): Dedup after fewer overrides are needed, as described below + LibsystemCrossHeaders = pkgs.darwin.Libsystem.override { + # TODO most of these could unconditionally use stdenvNoCC; do that next mass rebuild. + stdenv = pkgs.crossLibcStdenv; + xnu = pkgs.darwin.xnu.override { stdenv = pkgs.crossLibcStdenv; }; + ncurses = pkgs.buildPackages.ncurses; # TODO we are taking headers from a non-darwin package? Find a better way to get headers. + libpthread = pkgs.darwin.libpthread.override { + xnu = pkgs.darwin.xnu.override { stdenv = pkgs.crossLibcStdenv; }; + }; + + headersOnly = true; + withLibresolv = false; + }; + LibsystemCrossBasic = pkgs.darwin.LibsystemCrossHeaders.override { + headersOnly = false; + Csu = pkgs.darwin.Csu.override { + stdenv = stdenvHeadersLibsystem; + }; + }; + LibsystemCross = pkgs.darwin.LibsystemCrossBasic.override { + withLibresolv = true; + libresolv = pkgs.darwin.libresolv.override { + stdenv = stdenvBasicLibsystem; + configd = pkgs.darwin.configd.override { + stdenv = stdenvBasicLibsystem; + ppp = pkgs.darwin.ppp.override { stdenv = stdenvBasicLibsystem; }; + IOKit = pkgs.darwin.IOKit.override { + stdenv = stdenvBasicLibsystem; + xnu = pkgs.darwin.xnu.override { stdenv = pkgs.crossLibcStdenv; }; + }; + eap8021x = pkgs.darwin.eap8021x.override { stdenv = stdenvBasicLibsystem; }; + Security = pkgs.darwin.Security.override { + stdenv = stdenvBasicLibsystem; + }; + xnu = pkgs.darwin.xnu.override { stdenv = pkgs.crossLibcStdenv; }; + }; + }; + }; } diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 45a25ec3eee0d..3c41418594f8b 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -44,11 +44,25 @@ in extraPackages = []; inherit bintools; }; - allowedRequisites = - lib.mapNullable (rs: rs ++ [ bintools ]) (stdenv.allowedRequisites or null); + allowedRequisites = null; }; - stdenvNoLibs = mkStdenvNoLibs stdenv; + stdenvNoLibs = + if stdenv.hostPlatform != stdenv.buildPlatform && (stdenv.hostPlatform.isDarwin || stdenv.hostPlatform.isDarwin.useLLVM or false) + then + # We cannot touch binutils or cc themselves, because that will cause + # infinite recursion. So instead, we just choose a libc based on the + # current platform. That meanse we won't respect whatever compiler was + # passed in with the stdenv stage argument. + # + # TODO It would be much better to pass the `stdenvNoCC` and *unwrapped* + # cc, bintools, compiler-rt equivalent, etc. and create all final stdenvs + # as part of the stage. Then we would never be tempted to override a + # later thing to to create an earlier thing (leading to infinite + # recursion) and we also would still respect the stage arguments choices + # for these things. + overrideCC stdenv buildPackages.llvmPackages.clangNoCompilerRt + else mkStdenvNoLibs stdenv; gccStdenvNoLibs = mkStdenvNoLibs gccStdenv; clangStdenvNoLibs = mkStdenvNoLibs clangStdenv; @@ -10392,8 +10406,10 @@ in gccCrossLibcStdenv = overrideCC stdenv buildPackages.gccCrossStageStatic; crossLibcStdenv = - if stdenv.hostPlatform.useLLVM or false - then overrideCC stdenv buildPackages.llvmPackages_8.lldClangNoLibc + /**/ if stdenv.hostPlatform.useLLVM or false + then overrideCC stdenv buildPackages.llvmPackages.lldClangNoLibc + else if stdenv.hostPlatform.isDarwin + then overrideCC stdenv buildPackages.llvmPackages.clangNoLibcNoCompilerRt else gccCrossLibcStdenv; # The GCC used to build libc for the target platform. Normal gccs will be @@ -11710,6 +11726,10 @@ in inherit cc bintools libc libcxx extraPackages zlib; } // extraArgs; in self); + wrapCCWithoutLibc = args: wrapCCWith ({ + bintools = if stdenv.targetPlatform.isDarwin then darwin.binutilsNoLibc else binutilsNoLibc; + } // args); + wrapCC = cc: wrapCCWith { inherit cc; }; @@ -12537,7 +12557,10 @@ in bintools = binutils-unwrapped; libc = /**/ if stdenv.targetPlatform.libc == "msvcrt" then targetPackages.windows.mingw_w64_headers - else if stdenv.targetPlatform.libc == "libSystem" then darwin.xcode + else if stdenv.targetPlatform.libc == "libSystem" then + if stdenv.targetPlatform.useiOSPrebuilt or false + then targetPackages.darwin.xcode + else null else if stdenv.targetPlatform.libc == "nblibc" then targetPackages.netbsdCross.headers else null; }; @@ -14685,7 +14708,10 @@ in else if name == "musl" then targetPackages.muslCross or muslCross else if name == "msvcrt" then targetPackages.windows.mingw_w64 or windows.mingw_w64 else if stdenv.targetPlatform.useiOSPrebuilt then targetPackages.darwin.iosSdkPkgs.libraries or darwin.iosSdkPkgs.libraries - else if name == "libSystem" then targetPackages.darwin.xcode + else if name == "libSystem" then + if stdenv.targetPlatform.useiOSPrebuilt or false + then targetPackages.darwin.xcode + else targetPackages.darwin.LibsystemCross or darwin.LibsystemCross else if name == "nblibc" then targetPackages.netbsdCross.libc or netbsdCross.libc else if name == "wasilibc" then targetPackages.wasilibc or wasilibc else if name == "relibc" then targetPackages.relibc or relibc diff --git a/pkgs/top-level/stage.nix b/pkgs/top-level/stage.nix index 77f3cc677f656..7cc5b08b0b25d 100644 --- a/pkgs/top-level/stage.nix +++ b/pkgs/top-level/stage.nix @@ -216,10 +216,9 @@ let pkgsStatic = super'; })] ++ overlays; crossOverlays = [ (import ./static.nix) ]; - } // lib.optionalAttrs stdenv.hostPlatform.isLinux { crossSystem = { isStatic = true; - parsed = stdenv.hostPlatform.parsed // { + parsed = stdenv.hostPlatform.parsed // lib.optionalAttrs stdenv.hostPlatform.isLinux { abi = { gnu = lib.systems.parse.abis.musl; gnueabi = lib.systems.parse.abis.musleabi;