apple-sdk: remove code for old SDKs

This commit is contained in:
Emily
2024-11-18 00:05:22 +00:00
parent 685ed87ecc
commit fee73d8d33
4 changed files with 4 additions and 40 deletions
@@ -27,11 +27,7 @@ fetchurl {
mv "$downloadedFile" "$renamed"
pbzx "$renamed" | cpio -idm
# SDKs are inconsistent about whether MacOSX.sdk or MacOSX<version>.sdk is a symlink.
src=Library/Developer/CommandLineTools/SDKs/MacOSX${lib.versions.majorMinor version}.sdk
if [ ! -d $src ]; then
src=Library/Developer/CommandLineTools/SDKs/MacOSX.sdk
fi
# Remove unwanted binaries, man pages, and folders from the SDK.
rm -rf $src/usr/bin $src/usr/share $src/System/Library/Perl
@@ -24,7 +24,6 @@ self: super: {
+ ''
echo "Removing the following dylibs from the libSystem reexported libraries list: ${lib.escapeShellArg (lib.concatStringsSep ", " removedDylibs)}"
for libSystem in libSystem.B.tbd libSystem.B_asan.tbd; do
test ! -e usr/lib/$libSystem && continue # TODO: remove once the minimum SDK is 10.14 or newer.
tapi stubify --filetype=tbd-v5 usr/lib/$libSystem -o usr/lib/$libSystem # tbd-v5 is a JSON-based format.
jq --argjson libs ${lib.escapeShellArg (builtins.toJSON removedDylibs)} '
if .libraries then
@@ -1,18 +0,0 @@
{ lib, sdkVersion }:
let
name = "MacOSX${lib.versions.majorMinor sdkVersion}.sdk";
in
self: super: {
# Rewrite the stubs to point to dylibs in the SDK instead of at system locations. This is needed for umbrella
# frameworks in older SDKs, which dont also embed their stubs.
buildPhase =
super.buildPhase or ""
+ ''
echo "Rewriting stubs to reference the SDK location in the store"
find . -name '*.tbd' -type f -exec sed -E \
-e "/^install-name/n; s|( \\|'\\|\"\\|\\[)/usr/|\1$sdkpath/${name}/usr/|g" \
-e "/^install-name/n; s|( \\|'\\|\"\\|\\[)/System/|\1$sdkpath/${name}/System/|g" \
-i {} \;
'';
}
+4 -17
View File
@@ -9,12 +9,8 @@ in
substitute,
# Specifies the major version used for the SDK. Uses `hostPlatform.darwinSdkVersion` by default.
darwinSdkMajorVersion ? (
if lib.versionOlder stdenv.hostPlatform.darwinSdkVersion "11" then
lib.versions.majorMinor stdenv.hostPlatform.darwinSdkVersion
else
lib.versions.major stdenv.hostPlatform.darwinSdkVersion
),
darwinSdkMajorVersion ? lib.versions.major stdenv.hostPlatform.darwinSdkVersion,
# Enabling bootstrap disables propagation. Defaults to `false` (meaning to propagate certain packages and `xcrun`)
# except in stage0 of the Darwin stdenv bootstrap.
enableBootstrap ? stdenv.name == "bootstrap-stage0-stdenv-darwin",
@@ -48,11 +44,6 @@ let
(callPackage ./common/propagate-inputs.nix { })
(callPackage ./common/propagate-xcrun.nix { })
]
# Older SDKs do not include the libraries re-exported from umbrella frameworks in the umbrellas stubs, which causes
# link failures for those libraries unless their paths have been rewritten to point to the store.
++ lib.optionals (lib.versionOlder sdkVersion "11.0") [
(callPackage ./common/rewrite-sdk-paths.nix { inherit sdkVersion; })
]
# This has to happen last.
++ [
(callPackage ./common/run-build-phase-hooks.nix { })
@@ -97,9 +88,7 @@ stdenvNoCC.mkDerivation (
mkdir -p "$sdkpath"
cp -rd . "$sdkpath/${sdkName}"
${lib.optionalString (lib.versionAtLeast finalAttrs.version "11.0") ''
ln -s "${sdkName}" "$sdkpath/MacOSX${sdkMajor}.sdk"
''}
ln -s "${sdkName}" "$sdkpath/MacOSX${sdkMajor}.sdk"
ln -s "${sdkName}" "$sdkpath/MacOSX.sdk"
runHook postInstall
@@ -116,9 +105,7 @@ stdenvNoCC.mkDerivation (
homepage = "https://developer.apple.com";
maintainers = lib.teams.darwin.members;
platforms = lib.platforms.darwin;
badPlatforms =
lib.optionals (lib.versionAtLeast sdkVersion "10.15") [ lib.systems.inspect.patterns.is32bit ]
++ lib.optionals (lib.versionOlder sdkVersion "11.0") [ lib.systems.inspect.patterns.isAarch ];
badPlatforms = [ lib.systems.inspect.patterns.is32bit ];
};
})
)