xcbuild: allow building arm64 binaries

File paths are copied from XCode 12.
This commit is contained in:
Ivan Babrou 2021-02-05 09:34:12 -08:00 committed by Andrew Childs
parent 23cae56ca7
commit bac1418031
2 changed files with 16 additions and 16 deletions

View file

@ -1,4 +1,4 @@
{ runCommand, lib, sdks, xcodePlatform, writeText }: { stdenv, runCommand, lib, sdks, xcodePlatform, writeText }:
let let
@ -15,23 +15,23 @@ let
}; };
# These files are all based off of Xcode spec fies found in # These files are all based off of Xcode spec fies found in
# /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/Library/Xcode/Speciications/. # /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/Library/Xcode/PrivatePlugIns/IDEOSXSupportCore.ideplugin/Contents/Resources.
# Based off of the MacOSX Architectures.xcpsec file. All i386 stuff # Based off of the "MacOSX Architectures.xcspec" file. All i386 stuff
# is removed because NixPkgs only supports darwin-x86_64. # is removed because NixPkgs only supports darwin-x86_64 and darwin-arm64.
Architectures = [ Architectures = [
{ {
Identifier = "Standard"; Identifier = "Standard";
Type = "Architecture"; Type = "Architecture";
Name = "Standard Architectures (64-bit Intel)"; Name = "Standard Architectures (Apple Silicon, 64-bit Intel)";
RealArchitectures = [ "x86_64" ]; RealArchitectures = [ "arm64" "x86_64" ];
ArchitectureSetting = "ARCHS_STANDARD"; ArchitectureSetting = "ARCHS_STANDARD";
} }
{ {
Identifier = "Universal"; Identifier = "Universal";
Type = "Architecture"; Type = "Architecture";
Name = "Universal (64-bit Intel)"; Name = "Universal (Apple Silicon, 64-bit Intel)";
RealArchitectures = [ "x86_64" ]; RealArchitectures = [ "arm64" "x86_64" ];
ArchitectureSetting = "ARCHS_STANDARD_32_64_BIT"; ArchitectureSetting = "ARCHS_STANDARD_32_64_BIT";
} }
{ {
@ -43,25 +43,25 @@ let
{ {
Identifier = "Standard64bit"; Identifier = "Standard64bit";
Type = "Architecture"; Type = "Architecture";
Name = "64-bit Intel"; Name = "Apple Silicon, 64-bit Intel";
RealArchitectures = [ "x86_64" ]; RealArchitectures = [ "arm64" "x86_64" ];
ArchitectureSetting = "ARCHS_STANDARD_64_BIT"; ArchitectureSetting = "ARCHS_STANDARD_64_BIT";
} }
{ {
Identifier = "x86_64"; Identifier = if stdenv.isAarch64 then "arm64" else "x86_64";
Type = "Architecture"; Type = "Architecture";
Name = "Intel 64-bit"; Name = "Apple Silicon or Intel 64-bit";
} }
{ {
Identifier = "Standard_Including_64_bit"; Identifier = "Standard_Including_64_bit";
Type = "Architecture"; Type = "Architecture";
Name = "Standard Architectures (including 64-bit)"; Name = "Standard Architectures (including 64-bit)";
RealArchitectures = [ "x86_64" ]; RealArchitectures = [ "arm64" "x86_64" ];
ArchitectureSetting = "ARCHS_STANDARD_INCLUDING_64_BIT"; ArchitectureSetting = "ARCHS_STANDARD_INCLUDING_64_BIT";
} }
]; ];
# Based off of the MacOSX Package Types.xcpsec file. Only keep the # Based off of the "MacOSX Package Types.xcspec" file. Only keep the
# bare minimum needed. # bare minimum needed.
PackageTypes = [ PackageTypes = [
{ {
@ -169,7 +169,7 @@ let
} }
]; ];
# Based off of the MacOSX Product Types.xcpsec file. All # Based off of the "MacOSX Product Types.xcspec" file. All
# bundles/wrapper are removed, because we prefer dynamic products in # bundles/wrapper are removed, because we prefer dynamic products in
# NixPkgs. # NixPkgs.
ProductTypes = [ ProductTypes = [

View file

@ -28,7 +28,7 @@ let
}; };
platforms = callPackage ./platforms.nix { platforms = callPackage ./platforms.nix {
inherit sdks xcodePlatform; inherit sdks xcodePlatform stdenv;
}; };
xcconfig = writeText "nix.xcconfig" '' xcconfig = writeText "nix.xcconfig" ''