xcbuild: allow building arm64 binaries

File paths are copied from XCode 12.

authored by Ivan Babrou and committed by Andrew Childs bac14180 23cae56c

+16 -16
+15 -15
pkgs/development/tools/xcbuild/platforms.nix
··· 1 - { runCommand, lib, sdks, xcodePlatform, writeText }: 1 + { stdenv, runCommand, lib, sdks, xcodePlatform, writeText }: 2 2 3 3 let 4 4 ··· 15 15 }; 16 16 17 17 # These files are all based off of Xcode spec fies found in 18 - # /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/Library/Xcode/Speciications/. 18 + # /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/Library/Xcode/PrivatePlugIns/IDEOSXSupportCore.ideplugin/Contents/Resources. 19 19 20 - # Based off of the MacOSX Architectures.xcpsec file. All i386 stuff 21 - # is removed because NixPkgs only supports darwin-x86_64. 20 + # Based off of the "MacOSX Architectures.xcspec" file. All i386 stuff 21 + # is removed because NixPkgs only supports darwin-x86_64 and darwin-arm64. 22 22 Architectures = [ 23 23 { 24 24 Identifier = "Standard"; 25 25 Type = "Architecture"; 26 - Name = "Standard Architectures (64-bit Intel)"; 27 - RealArchitectures = [ "x86_64" ]; 26 + Name = "Standard Architectures (Apple Silicon, 64-bit Intel)"; 27 + RealArchitectures = [ "arm64" "x86_64" ]; 28 28 ArchitectureSetting = "ARCHS_STANDARD"; 29 29 } 30 30 { 31 31 Identifier = "Universal"; 32 32 Type = "Architecture"; 33 - Name = "Universal (64-bit Intel)"; 34 - RealArchitectures = [ "x86_64" ]; 33 + Name = "Universal (Apple Silicon, 64-bit Intel)"; 34 + RealArchitectures = [ "arm64" "x86_64" ]; 35 35 ArchitectureSetting = "ARCHS_STANDARD_32_64_BIT"; 36 36 } 37 37 { ··· 43 43 { 44 44 Identifier = "Standard64bit"; 45 45 Type = "Architecture"; 46 - Name = "64-bit Intel"; 47 - RealArchitectures = [ "x86_64" ]; 46 + Name = "Apple Silicon, 64-bit Intel"; 47 + RealArchitectures = [ "arm64" "x86_64" ]; 48 48 ArchitectureSetting = "ARCHS_STANDARD_64_BIT"; 49 49 } 50 50 { 51 - Identifier = "x86_64"; 51 + Identifier = if stdenv.isAarch64 then "arm64" else "x86_64"; 52 52 Type = "Architecture"; 53 - Name = "Intel 64-bit"; 53 + Name = "Apple Silicon or Intel 64-bit"; 54 54 } 55 55 { 56 56 Identifier = "Standard_Including_64_bit"; 57 57 Type = "Architecture"; 58 58 Name = "Standard Architectures (including 64-bit)"; 59 - RealArchitectures = [ "x86_64" ]; 59 + RealArchitectures = [ "arm64" "x86_64" ]; 60 60 ArchitectureSetting = "ARCHS_STANDARD_INCLUDING_64_BIT"; 61 61 } 62 62 ]; 63 63 64 - # Based off of the MacOSX Package Types.xcpsec file. Only keep the 64 + # Based off of the "MacOSX Package Types.xcspec" file. Only keep the 65 65 # bare minimum needed. 66 66 PackageTypes = [ 67 67 { ··· 169 169 } 170 170 ]; 171 171 172 - # Based off of the MacOSX Product Types.xcpsec file. All 172 + # Based off of the "MacOSX Product Types.xcspec" file. All 173 173 # bundles/wrapper are removed, because we prefer dynamic products in 174 174 # NixPkgs. 175 175 ProductTypes = [
+1 -1
pkgs/development/tools/xcbuild/wrapper.nix
··· 28 28 }; 29 29 30 30 platforms = callPackage ./platforms.nix { 31 - inherit sdks xcodePlatform; 31 + inherit sdks xcodePlatform stdenv; 32 32 }; 33 33 34 34 xcconfig = writeText "nix.xcconfig" ''