diff options
Diffstat (limited to 'nixpkgs/pkgs/os-specific/darwin/xcode')
3 files changed, 134 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/os-specific/darwin/xcode/default.nix b/nixpkgs/pkgs/os-specific/darwin/xcode/default.nix new file mode 100644 index 000000000000..369529d71675 --- /dev/null +++ b/nixpkgs/pkgs/os-specific/darwin/xcode/default.nix @@ -0,0 +1,50 @@ +{ stdenv, requireFile, lib }: + +let requireXcode = version: sha256: + let + xip = "Xcode_" + version + ".xip"; + # TODO(alexfmpe): Find out how to validate the .xip signature in Linux + unxip = if stdenv.isDarwin + then '' + open -W ${xip} + rm -rf ${xip} + '' + else '' + xar -xf ${xip} + rm -rf ${xip} + pbzx -n Content | cpio -i + rm Content Metadata + ''; + app = requireFile rec { + name = "Xcode.app"; + url = "https://developer.apple.com/services-account/download?path=/Developer_Tools/Xcode_${version}/${xip}"; + hashMode = "recursive"; + inherit sha256; + message = '' + Unfortunately, we cannot download ${name} automatically. + Please go to ${url} + to download it yourself, and add it to the Nix store by running the following commands. + Note: download (~ 5GB), extraction and storing of Xcode will take a while + + ${unxip} + nix-store --add-fixed --recursive sha256 Xcode.app + rm -rf Xcode.app + ''; + }; + meta = with stdenv.lib; { + homepage = https://developer.apple.com/downloads/; + description = "Apple's XCode SDK"; + license = licenses.unfree; + platforms = platforms.darwin ++ platforms.linux; + }; + + in app.overrideAttrs ( oldAttrs: oldAttrs // { inherit meta; }); + +in lib.makeExtensible (self: { + xcode_8_1 = requireXcode "8.1" "18xjvfipwzia66gm3r9p770xdd4r375vak7chw5vgqnv9yyjiq2n"; + xcode_8_2 = requireXcode "8.2" "13nd1zsfqcp9hwp15hndr0rsbb8rgprrz7zr2ablj4697qca06m2"; + xcode_9_1 = requireXcode "9.1" "0ab1403wy84ys3yn26fj78cazhpnslmh3nzzp1wxib3mr1afjvic"; + xcode_9_2 = requireXcode "9.2" "1bgfgdp266cbbqf2axcflz92frzvhi0qw0jdkcw6r85kdpc8dj4c"; + xcode_9_4 = requireXcode "9.4" "6731381785075602a52489f7ea47ece8f6daf225007ba3ffae1fd59b1c0b5f01"; + xcode = self."xcode_${lib.replaceStrings ["."] ["_"] (if stdenv.targetPlatform.useiOSPrebuilt then stdenv.targetPlatform.xcodeVer else "8.2")}"; +}) diff --git a/nixpkgs/pkgs/os-specific/darwin/xcode/gcc-fix-enum-attributes.patch b/nixpkgs/pkgs/os-specific/darwin/xcode/gcc-fix-enum-attributes.patch new file mode 100644 index 000000000000..1e1895c28945 --- /dev/null +++ b/nixpkgs/pkgs/os-specific/darwin/xcode/gcc-fix-enum-attributes.patch @@ -0,0 +1,13 @@ +diff --git a/System/Library/Frameworks/Foundation.framework/Headers/NSUserNotification.h b/System/Library/Frameworks/Foundation.framework/Headers/NSUserNotification.h +index fa0c290..7da7e0c 100644 +--- a/System/Library/Frameworks/Foundation.framework/Headers/NSUserNotification.h ++++ b/System/Library/Frameworks/Foundation.framework/Headers/NSUserNotification.h +@@ -13,7 +13,7 @@ typedef NS_ENUM(NSInteger, NSUserNotificationActivationType) { + NSUserNotificationActivationTypeNone = 0, + NSUserNotificationActivationTypeContentsClicked = 1, + NSUserNotificationActivationTypeActionButtonClicked = 2, +- NSUserNotificationActivationTypeReplied NS_AVAILABLE(10_9, NA) = 3 ++ NSUserNotificationActivationTypeReplied = 3 + } NS_ENUM_AVAILABLE(10_8, NA); + + NS_CLASS_AVAILABLE(10_8, NA) diff --git a/nixpkgs/pkgs/os-specific/darwin/xcode/sdk-pkgs.nix b/nixpkgs/pkgs/os-specific/darwin/xcode/sdk-pkgs.nix new file mode 100644 index 000000000000..b848265736e6 --- /dev/null +++ b/nixpkgs/pkgs/os-specific/darwin/xcode/sdk-pkgs.nix @@ -0,0 +1,71 @@ +{ targetPlatform +, clang-unwrapped +, binutils-unwrapped +, runCommand +, stdenv +, wrapBintoolsWith +, wrapCCWith +, buildIosSdk, targetIosSdkPkgs +, xcode +}: + +let + +minSdkVersion = "9.0"; + +iosPlatformArch = { parsed, ... }: { + "armv7a" = "armv7"; + "aarch64" = "arm64"; + "x86_64" = "x86_64"; +}.${parsed.cpu.name}; + +in + +rec { + sdk = rec { + name = "ios-sdk"; + type = "derivation"; + outPath = xcode + "/Contents/Developer/Platforms/${platform}.platform/Developer/SDKs/${platform}${version}.sdk"; + + platform = targetPlatform.xcodePlatform; + version = targetPlatform.sdkVer; + }; + + binutils = wrapBintoolsWith { + libc = targetIosSdkPkgs.libraries; + bintools = binutils-unwrapped; + extraBuildCommands = '' + echo "-arch ${iosPlatformArch targetPlatform}" >> $out/nix-support/libc-ldflags + ''; + }; + + clang = (wrapCCWith { + cc = clang-unwrapped; + bintools = binutils; + libc = targetIosSdkPkgs.libraries; + extraBuildCommands = '' + tr '\n' ' ' < $out/nix-support/cc-cflags > cc-cflags.tmp + mv cc-cflags.tmp $out/nix-support/cc-cflags + echo "-target ${targetPlatform.config} -arch ${iosPlatformArch targetPlatform}" >> $out/nix-support/cc-cflags + echo "-isystem ${sdk}/usr/include -isystem ${sdk}/usr/include/c++/4.2.1/ -stdlib=libstdc++" >> $out/nix-support/cc-cflags + '' + stdenv.lib.optionalString (sdk.platform == "iPhoneSimulator") '' + echo "-mios-simulator-version-min=${minSdkVersion}" >> $out/nix-support/cc-cflags + '' + stdenv.lib.optionalString (sdk.platform == "iPhoneOS") '' + echo "-miphoneos-version-min=${minSdkVersion}" >> $out/nix-support/cc-cflags + ''; + }) // { + inherit sdk; + }; + + libraries = let sdk = buildIosSdk; in runCommand "libSystem-prebuilt" { + passthru = { + inherit sdk; + }; + } '' + if ! [ -d ${sdk} ]; then + echo "You must have version ${sdk.version} of the ${sdk.platform} sdk installed at ${sdk}" >&2 + exit 1 + fi + ln -s ${sdk}/usr $out + ''; +} |