diff --git a/pkgs/by-name/ap/apple-sdk/common/add-core-symbolication.nix b/pkgs/by-name/ap/apple-sdk/common/add-core-symbolication.nix index 68704a0d4a4c..10935377cd22 100644 --- a/pkgs/by-name/ap/apple-sdk/common/add-core-symbolication.nix +++ b/pkgs/by-name/ap/apple-sdk/common/add-core-symbolication.nix @@ -42,7 +42,6 @@ in self: super: { buildPhase = super.buildPhase or "" + '' mkdir -p System/Library/PrivateFrameworks/CoreSymbolication.framework/Versions/A/Headers - ln -s A System/Library/PrivateFrameworks/CoreSymbolication.framework/Versions/Current ln -s Versions/Current/Headers System/Library/PrivateFrameworks/CoreSymbolication.framework/Headers cp '${CoreSymbolication}/include/'*.h System/Library/PrivateFrameworks/CoreSymbolication.framework/Versions/A/Headers ''; diff --git a/pkgs/by-name/ap/apple-sdk/common/plists.nix b/pkgs/by-name/ap/apple-sdk/common/plists.nix index 33bb1f134c12..70184d89429b 100644 --- a/pkgs/by-name/ap/apple-sdk/common/plists.nix +++ b/pkgs/by-name/ap/apple-sdk/common/plists.nix @@ -2,15 +2,28 @@ lib, stdenvNoCC, xcodePlatform, + sdkVersion, }: let inherit (lib.generators) toPlist; - Info = { - CFBundleIdentifier = "com.apple.platform.${lib.toLower xcodePlatform}"; - Type = "Platform"; + Info = rec { + CFBundleIdentifier = "com.apple.platform.${Name}"; + DefaultProperties = { + COMPRESS_PNG_FILES = "NO"; + DEPLOYMENT_TARGET_SETTING_NAME = stdenvNoCC.hostPlatform.darwinMinVersionVariable; + STRIP_PNG_TEXT = "NO"; + }; + Description = if stdenvNoCC.hostPlatform.isMacOS then "macOS" else "iOS"; + FamilyDisplayName = Description; + FamilyIdentifier = lib.toLower xcodePlatform; + FamilyName = Description; + Identifier = CFBundleIdentifier; + MinimumSDKVersion = stdenvNoCC.hostPlatform.darwinMinVersion; Name = lib.toLower xcodePlatform; + Type = "Platform"; + Version = sdkVersion; }; # These files are all based off of Xcode spec files found in diff --git a/pkgs/by-name/ap/apple-sdk/common/propagate-inputs.nix b/pkgs/by-name/ap/apple-sdk/common/propagate-inputs.nix index fe58181980b6..f9551b5b9bad 100644 --- a/pkgs/by-name/ap/apple-sdk/common/propagate-inputs.nix +++ b/pkgs/by-name/ap/apple-sdk/common/propagate-inputs.nix @@ -56,16 +56,19 @@ self: super: { darwin.libsbuf # Shipped with the SDK only as a library with no headers (lib.getLib darwin.libutil) - # Required by some SDK headers - cupsHeaders ] # x86_64-darwin links the object files from Csu when targeting very old releases ++ lib.optionals stdenvNoCC.hostPlatform.isx86_64 [ darwin.Csu ]; # The Darwin module for Swift requires certain headers to be included in the SDK (and not just be propagated). buildPhase = super.buildPhase or "" + '' - for header in '${lib.getDev libiconv}/include/'* '${lib.getDev ncurses}/include/'*; do + for header in '${lib.getDev libiconv}/include/'* '${lib.getDev ncurses}/include/'* '${cupsHeaders}/include/'*; do ln -s "$header" "usr/include/$(basename "$header")" done ''; + + # Exported to allow the headers to pass the requisites check in the stdenv bootstrap. + passthru = (super.passthru or { }) // { + cups-headers = cupsHeaders; + }; } diff --git a/pkgs/by-name/ap/apple-sdk/common/propagate-xcrun.nix b/pkgs/by-name/ap/apple-sdk/common/propagate-xcrun.nix index f993441c757e..ff0094df60e0 100644 --- a/pkgs/by-name/ap/apple-sdk/common/propagate-xcrun.nix +++ b/pkgs/by-name/ap/apple-sdk/common/propagate-xcrun.nix @@ -3,11 +3,12 @@ pkgsBuildHost, stdenv, stdenvNoCC, + sdkVersion, }: let plists = import ./plists.nix { - inherit lib stdenvNoCC; + inherit lib stdenvNoCC sdkVersion; xcodePlatform = if stdenvNoCC.hostPlatform.isMacOS then "MacOSX" else "iPhoneOS"; }; inherit (pkgsBuildHost) darwin cctools xcbuild; @@ -38,11 +39,15 @@ self: super: { # Include `libtool` in the toolchain, so `xcrun -find libtool` can find it without requiring `cctools.libtool` # as a `nativeBuildInput`. mkdir -p "$toolchainsPath/usr/bin" - ln -s '${cctools.libtool}/bin/${stdenv.cc.targetPrefix}libtool' "$toolchainsPath/usr/bin/libtool" + if [ -e '${cctools.libtool}/bin/${stdenv.cc.targetPrefix}libtool' ]; then + ln -s '${cctools.libtool}/bin/${stdenv.cc.targetPrefix}libtool' "$toolchainsPath/usr/bin/libtool" + fi # Include additional binutils required by some packages (such as Chromium). for tool in lipo nm otool size strip; do - ln -s '${darwin.binutils-unwrapped}/bin/${stdenv.cc.targetPrefix}'$tool "$toolchainsPath/usr/bin/$tool" + if [ -e '${darwin.binutils-unwrapped}/bin/${stdenv.cc.targetPrefix}'$tool ]; then + ln -s '${darwin.binutils-unwrapped}/bin/${stdenv.cc.targetPrefix}'$tool "$toolchainsPath/usr/bin/$tool" + fi done ''; } diff --git a/pkgs/by-name/ap/apple-sdk/package.nix b/pkgs/by-name/ap/apple-sdk/package.nix index 04b32f07a642..2a0dabd97ae0 100644 --- a/pkgs/by-name/ap/apple-sdk/package.nix +++ b/pkgs/by-name/ap/apple-sdk/package.nix @@ -41,7 +41,7 @@ let # Avoid infinite recursions by not propagating certain packages, so they can themselves build with the SDK. ++ lib.optionals (!enableBootstrap) [ (callPackage ./common/propagate-inputs.nix { }) - (callPackage ./common/propagate-xcrun.nix { }) + (callPackage ./common/propagate-xcrun.nix { inherit sdkVersion; }) ] # This has to happen last. ++ [ @@ -58,12 +58,6 @@ stdenvNoCC.mkDerivation ( dontConfigure = true; - # TODO(@connorbaker): - # This is a quick fix unblock builds broken by https://github.com/NixOS/nixpkgs/pull/370750. - # Fails due to a reflexive symlink: - # $out/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.3.sdk/System/Library/PrivateFrameworks/CoreSymbolication.framework/Versions/A/A - dontCheckForBrokenSymlinks = true; - strictDeps = true; setupHooks = [ @@ -96,6 +90,11 @@ stdenvNoCC.mkDerivation ( ln -s "${sdkName}" "$sdkpath/MacOSX${sdkMajor}.sdk" ln -s "${sdkName}" "$sdkpath/MacOSX.sdk" + # Swift adds these locations to its search paths. Avoid spurious warnings by making sure they exist. + mkdir -p "$platformPath/Developer/Library/Frameworks" + mkdir -p "$platformPath/Developer/Library/PrivateFrameworks" + mkdir -p "$platformPath/Developer/usr/lib" + runHook postInstall ''; diff --git a/pkgs/stdenv/darwin/default.nix b/pkgs/stdenv/darwin/default.nix index 0edf63dbc71e..0a5a29fad85b 100644 --- a/pkgs/stdenv/darwin/default.nix +++ b/pkgs/stdenv/darwin/default.nix @@ -1121,6 +1121,7 @@ assert bootstrapTools.passthru.isFromBootstrapFiles or false; # sanity check with prevStage; [ apple-sdk + apple-sdk.cups-headers bashNonInteractive bzip2.bin bzip2.out