Unverified Commit 8b9d5897 authored by Randy Eckenrode's avatar Randy Eckenrode
Browse files

apple-sdk: improve compatibility with Swift Build

Swift Build requires additional fields in `MacOSX.platform/Info.plist`,
or it won’t recognize the SDK as being from Xcode. Having it recognize
the SDK as from Xcode is required for it to use the SDK at all.
parent 475f17b8
Loading
Loading
Loading
Loading
+16 −3
Original line number Diff line number Diff line
@@ -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
+2 −1
Original line number Diff line number Diff line
@@ -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;
+1 −1
Original line number Diff line number Diff line
@@ -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.
    ++ [