Merge pull request #324155 from paparodeo/x64-sdk11-no-rebuilds

treewide: change various flags to allow x64 darwin to default to sdk 11.0 when ready
This commit is contained in:
Tristan Ross 2024-07-08 17:19:17 -07:00 committed by GitHub
commit 7a95a8948b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
18 changed files with 1527 additions and 39 deletions

View File

@ -236,8 +236,7 @@ in let
# https://github.com/NixOS/nixpkgs/pull/194634#issuecomment-1272129132
++ lib.optional (
stdenv.targetPlatform.isDarwin
&& !stdenv.targetPlatform.isAarch64
&& (lib.versionOlder darwin.apple_sdk.sdk.version "11.0")
&& lib.versionOlder stdenv.targetPlatform.darwinSdkVersion "11.0"
) ./lldb/cpu_subtype_arm64e_replacement.patch;
};

View File

@ -208,8 +208,7 @@ in let
# https://github.com/NixOS/nixpkgs/pull/194634#issuecomment-1272129132
++ lib.optional (
stdenv.targetPlatform.isDarwin
&& !stdenv.targetPlatform.isAarch64
&& (lib.versionOlder darwin.apple_sdk.sdk.version "11.0")
&& lib.versionOlder stdenv.targetPlatform.darwinSdkVersion "11.0"
) ./lldb/cpu_subtype_arm64e_replacement.patch;
};

View File

@ -250,8 +250,7 @@ in let
# https://github.com/NixOS/nixpkgs/pull/194634#issuecomment-1272129132
++ lib.optional (
stdenv.targetPlatform.isDarwin
&& !stdenv.targetPlatform.isAarch64
&& (lib.versionOlder darwin.apple_sdk.sdk.version "11.0")
&& lib.versionOlder stdenv.targetPlatform.darwinSdkVersion "11.0"
) ./lldb/cpu_subtype_arm64e_replacement.patch;
};

View File

@ -251,8 +251,7 @@ in let
# https://github.com/NixOS/nixpkgs/pull/194634#issuecomment-1272129132
++ lib.optional (
stdenv.targetPlatform.isDarwin
&& !stdenv.targetPlatform.isAarch64
&& (lib.versionOlder darwin.apple_sdk.sdk.version "11.0")
&& lib.versionOlder stdenv.targetPlatform.darwinSdkVersion "11.0"
) ./lldb/cpu_subtype_arm64e_replacement.patch;
};

View File

@ -243,8 +243,7 @@ in let
# https://github.com/NixOS/nixpkgs/pull/194634#issuecomment-1272129132
++ lib.optional (
stdenv.targetPlatform.isDarwin
&& !stdenv.targetPlatform.isAarch64
&& (lib.versionOlder darwin.apple_sdk.sdk.version "11.0")
&& lib.versionOlder stdenv.targetPlatform.darwinSdkVersion "11.0"
) ./lldb/cpu_subtype_arm64e_replacement.patch;
};

View File

@ -242,8 +242,7 @@ in let
# https://github.com/NixOS/nixpkgs/pull/194634#issuecomment-1272129132
++ lib.optional (
stdenv.targetPlatform.isDarwin
&& !stdenv.targetPlatform.isAarch64
&& (lib.versionOlder darwin.apple_sdk.sdk.version "11.0")
&& lib.versionOlder stdenv.targetPlatform.darwinSdkVersion "11.0"
) ./lldb/cpu_subtype_arm64e_replacement.patch;
};

View File

@ -101,7 +101,7 @@ stdenv.mkDerivation (rec {
++ lib.optional
(
stdenv.targetPlatform.isDarwin
&& !stdenv.targetPlatform.isAarch64
&& lib.versionOlder stdenv.targetPlatform.darwinSdkVersion "11.0"
&& (lib.versionAtLeast release_version "15")
)
(

View File

@ -239,8 +239,7 @@ in let
# https://github.com/NixOS/nixpkgs/pull/194634#issuecomment-1272129132
++ lib.optional (
stdenv.targetPlatform.isDarwin
&& !stdenv.targetPlatform.isAarch64
&& (lib.versionOlder darwin.apple_sdk.sdk.version "11.0")
&& lib.versionOlder stdenv.targetPlatform.darwinSdkVersion "11.0"
) ./lldb/cpu_subtype_arm64e_replacement.patch;
};

View File

@ -151,7 +151,11 @@ stdenv.mkDerivation (finalAttrs: {
] ++ lib.optionals stdenv.isDarwin [
libedit
readline
] ++ lib.optional (stdenv.isDarwin && !stdenv.isAarch64) (
] ++ lib.optional (stdenv.isDarwin && lib.versionOlder stdenv.hostPlatform.darwinSdkVersion "11.0") (
# this can likely be removed as:
# "libproc.h is included in the 10.12 SDK Libsystem and should be identical to this one."
# but the package is marked broken on darwin so unable to test
# Pull a header that contains a definition of proc_pid_rusage().
# (We pick just that one because using the other headers from `sdk` is not
# compatible with our C++ standard library. This header is already in

View File

@ -51,7 +51,7 @@ let
};
mkCc = cc:
if stdenv.isAarch64 then cc
if lib.versionAtLeast stdenv.hostPlatform.darwinSdkVersion "11" then cc
else
cc.override {
bintools = stdenv.cc.bintools.override { libc = packages.Libsystem; };
@ -59,7 +59,7 @@ let
};
mkStdenv = stdenv:
if stdenv.isAarch64 then stdenv
if lib.versionAtLeast stdenv.hostPlatform.darwinSdkVersion "11" then stdenv
else
let
darwinMinVersion = "10.12";

View File

@ -1,6 +1,10 @@
{ lib, stdenv, fetchurl, fetchFromGitHub, pkgs }:
let
isSdk10_12 = stdenv.hostPlatform.darwinSdkVersion == "10.12";
# This attrset can in theory be computed automatically, but for that to work nicely we need
# import-from-derivation to work properly. Currently it's rather ugly when we try to bootstrap
# a stdenv out of something like this. With some care we can probably get rid of this, but for
@ -271,10 +275,10 @@ developerToolsPackages_11_3_1 // macosPackages_11_0_1 // {
Libinfo = applePackage "Libinfo" "osx-10.11.6" "sha256-6F7wiwerv4nz/xXHtp1qCHSaFzZgzcRN+jbmXA5oWOQ=" {};
Libm = applePackage "Libm" "osx-10.7.4" "sha256-KjMETfT4qJm0m0Ux/F6Rq8bI4Q4UVnFx6IKbKxXd+Es=" {};
Libnotify = applePackage "Libnotify" "osx-10.12.6" "sha256-6wvMBxAUfiYcQtmlfYCj1d3kFmFM/jdboTd7hRvi3e4=" {};
libmalloc = if stdenv.isx86_64 then
libmalloc = if isSdk10_12 then
applePackage "libmalloc" "osx-10.12.6" "sha256-brfG4GEF2yZipKdhlPq6DhT2z5hKYSb2MAmffaikdO4=" {}
else macosPackages_11_0_1.libmalloc;
libplatform = if stdenv.isx86_64 then
libplatform = if isSdk10_12 then
applePackage "libplatform" "osx-10.12.6" "sha256-6McMTjw55xtnCsFI3AB1osRagnuB5pSTqeMKD3gpGtM=" {}
else macosPackages_11_0_1.libplatform;
libpthread = applePackage "libpthread" "osx-10.12.6" "sha256-QvJ9PERmrCWBiDmOWrLvQUKZ4JxHuh8gS5nlZKDLqE8=" {};
@ -286,7 +290,7 @@ developerToolsPackages_11_3_1 // macosPackages_11_0_1 // {
objc4 = applePackage "objc4" "osx-10.12.6" "sha256-ZsxRpdsfv3Dxs7yBBCkjbKXKR6aXwkEpxc1XYXz7ueM=" {};
ppp = applePackage "ppp" "osx-10.12.6" "sha256-M1zoEjjeKIDUEP6ACbpUJk3OXjobw4g/qzUmxGdX1J0=" {};
removefile = applePackage "removefile" "osx-10.12.6" "sha256-UpNk27kGXnZss1ZXWVJU9jLz/NW63ZAZEDLhyCYoi9M=" {};
xnu = if stdenv.isx86_64 then
xnu = if isSdk10_12 then
applePackage "xnu" "osx-10.12.6" "sha256-C8TPQlUT3RbzAy8YnZPNtr70hpaVG9Llv0h42s3NENI=" {}
else macosPackages_11_0_1.xnu;
hfs = applePackage "hfs" "osx-10.12.6" "sha256-eGi18HQFJrU5UHoBOE0LqO5gQ0xOf8+OJuAWQljfKE4=" {};
@ -297,7 +301,7 @@ developerToolsPackages_11_3_1 // macosPackages_11_0_1 // {
diskdev_cmds = applePackage "diskdev_cmds" "osx-10.11.6" "sha256-VX+hcZ7JhOA8EhwLloPlM3Yx79RXp9OYHV9Mi10uw3Q=" {
macosPackages_11_0_1 = macosPackages_11_0_1;
};
network_cmds = if stdenv.isx86_64 then
network_cmds = if isSdk10_12 then
applePackage "network_cmds" "osx-10.11.6" "sha256-I89CLIswGheewOjiNZwQTgWvWbhm0qtB5+KUqzxnQ5M=" {}
else macosPackages_11_0_1.network_cmds;
file_cmds = applePackage "file_cmds" "osx-10.11.6" "sha256-JYy6HwmultKeZtLfaysbsyLoWg+OaTh7eJu54JkJC0Q=" {};

View File

@ -1,4 +1,4 @@
{ appleDerivation', lib, stdenv, stdenvNoCC, buildPackages
{ appleDerivation', lib, stdenv, stdenvNoCC, buildPackages, pkgsBuildBuild
, bootstrap_cmds, bison, flex
, gnum4, unifdef, perl, python3
, headersOnly ? true
@ -12,7 +12,7 @@ appleDerivation' (if headersOnly then stdenvNoCC else stdenv) (
nativeBuildInputs = [ bootstrap_cmds bison flex gnum4 unifdef perl python3 ];
patches = lib.optionals stdenv.isx86_64 [ ./python3.patch ];
patches = lib.optionals (lib.versionOlder stdenv.hostPlatform.darwinSdkVersion "11") [ ./python3.patch ];
postPatch = ''
substituteInPlace Makefile \
@ -48,7 +48,7 @@ appleDerivation' (if headersOnly then stdenvNoCC else stdenv) (
--replace 'MACHINE_ARCH=armv7' 'MACHINE_ARCH=arm64' # this might break the comments saying 32-bit is required
patchShebangs .
'' + lib.optionalString stdenv.isAarch64 ''
'' + lib.optionalString (lib.versionAtLeast stdenv.hostPlatform.darwinSdkVersion "11") ''
# iig is closed-sourced, we don't have it
# create an empty file to the header instead
# this line becomes: echo "" > $@; echo --header ...
@ -72,7 +72,11 @@ appleDerivation' (if headersOnly then stdenvNoCC else stdenv) (
HOST_FLEX = "flex";
HOST_BISON = "bison";
HOST_GM4 = "m4";
MIGCC = "cc";
# use unwrapped clang to generate headers because wrapper is not compatible with a 32 bit -arch.
# aarch64 should likely do this as well and remove the --replace MACHINE_ARCH above
MIGCC = if stdenv.isx86_64 && lib.versionAtLeast stdenv.hostPlatform.darwinSdkVersion "11"
then "${lib.getBin pkgsBuildBuild.stdenv.cc.cc}/bin/clang"
else "cc";
ARCHS = arch;
ARCH_CONFIGS = arch;
@ -80,7 +84,7 @@ appleDerivation' (if headersOnly then stdenvNoCC else stdenv) (
preBuild = let macosVersion =
"10.0 10.1 10.2 10.3 10.4 10.5 10.6 10.7 10.8 10.9 10.10 10.11" +
lib.optionalString stdenv.isAarch64 " 10.12 10.13 10.14 10.15 11.0";
lib.optionalString (lib.versionAtLeast stdenv.hostPlatform.darwinSdkVersion "11") " 10.12 10.13 10.14 10.15 11.0";
in ''
# This is a bit of a hack...
mkdir -p sdk/usr/local/libexec
@ -150,7 +154,7 @@ appleDerivation' (if headersOnly then stdenvNoCC else stdenv) (
mv $out/Library/Frameworks/IOKit.framework $out/Library/PrivateFrameworks
'';
appleHeaders = builtins.readFile (./. + "/headers-${arch}.txt");
appleHeaders = builtins.readFile (./. + "/headers-${stdenv.hostPlatform.darwinSdkVersion}-${arch}.txt");
} // lib.optionalAttrs headersOnly {
HOST_CODESIGN = "echo";
HOST_CODESIGN_ALLOCATE = "echo";

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,8 @@
{ lib, stdenv, fetchFromGitHub, cmake, openpam, darwin }:
let
sdkOlderThan11 = lib.versionOlder stdenv.hostPlatform.darwinSdkVersion "11.0";
in
stdenv.mkDerivation rec {
pname = "pam_reattach";
version = "1.3";
@ -12,17 +15,12 @@ stdenv.mkDerivation rec {
};
cmakeFlags = [
"-DCMAKE_OSX_ARCHITECTURES=${
if stdenv.hostPlatform.system == "x86_64-darwin" then
"x86_64"
else
"arm64"
}"
"-DCMAKE_OSX_ARCHITECTURES=${stdenv.hostPlatform.darwinArch}"
"-DENABLE_CLI=ON"
] ++ lib.optional (!stdenv.isAarch64) "-DCMAKE_LIBRARY_PATH=${darwin.apple_sdk.sdk}/usr/lib";
] ++ lib.optional sdkOlderThan11 "-DCMAKE_LIBRARY_PATH=${darwin.apple_sdk.sdk}/usr/lib";
buildInputs = [ openpam ]
++ lib.optional (!stdenv.isAarch64) darwin.apple_sdk.sdk;
++ lib.optional sdkOlderThan11 darwin.apple_sdk.sdk;
nativeBuildInputs = [ cmake ];

View File

@ -25,7 +25,7 @@ assert crossSystem == localSystem;
let
inherit (localSystem) system;
useAppleSDKLibs = localSystem.isAarch64;
useAppleSDKLibs = lib.versionAtLeast localSystem.darwinSdkVersion "11";
commonImpureHostDeps = [
"/bin/sh"

View File

@ -48,11 +48,15 @@ makeScopeWithSplicing' {
};
# Pick an SDK
apple_sdk = if stdenv.hostPlatform.isAarch64 then apple_sdk_11_0 else apple_sdk_10_12;
apple_sdk = {
"10.12" = apple_sdk_10_12;
"11.0" = apple_sdk_11_0;
}.${stdenv.hostPlatform.darwinSdkVersion}
or (throw "Unsupported sdk: ${stdenv.hostPlatform.darwinSdkVersion}");
# Pick the source of libraries: either Apple's open source releases, or the
# SDK.
useAppleSDKLibs = stdenv.hostPlatform.isAarch64;
useAppleSDKLibs = lib.versionAtLeast stdenv.hostPlatform.darwinSdkVersion "11";
selectAttrs = attrs: names:
lib.listToAttrs (lib.concatMap (n: lib.optionals (attrs ? "${n}") [(lib.nameValuePair n attrs."${n}")]) names);