at 15.09-beta 52 lines 1.4 kB view raw
1{ stdenv, requireFile, xpwn }: 2 3with stdenv.lib; 4 5let 6 osxVersion = "10.9"; 7in stdenv.mkDerivation rec { 8 name = "xcode-${version}"; 9 version = "5.1"; 10 11 src = requireFile { 12 name = "xcode_${version}.dmg"; 13 url = meta.homepage; 14 sha256 = "70bb550cc14eca80b9825f4ae9bfbf7f076bb75777311be428bc30a7eb7a6f7e"; 15 }; 16 17 phases = [ "unpackPhase" "patchPhase" "installPhase" "fixupPhase" ]; 18 outputs = [ "out" "toolchain" ]; 19 20 21 unpackCmd = let 22 basePath = "Xcode.app/Contents/Developer/Platforms/MacOSX.platform"; 23 sdkPath = "${basePath}/Developer/SDKs"; 24 in '' 25 ${xpwn}/bin/dmg extract "$curSrc" main.hfs > /dev/null 26 ${xpwn}/bin/hfsplus main.hfs extractall "${sdkPath}" > /dev/null 27 ''; 28 29 setSourceRoot = "sourceRoot=MacOSX${osxVersion}.sdk"; 30 31 patches = optional (osxVersion == "10.9") ./gcc-fix-enum-attributes.patch; 32 33 installPhase = '' 34 mkdir -p "$out/share/sysroot" 35 cp -a * "$out/share/sysroot/" 36 ln -s "$out/share/sysroot/usr/lib" "$out/lib" 37 ln -s "$out/share/sysroot/usr/include" "$out/include" 38 39 mkdir -p "$toolchain" 40 pushd "$toolchain" 41 ${xpwn}/bin/hfsplus "$(dirs +1)/../main.hfs" extractall \ 42 Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr \ 43 > /dev/null 44 popd 45 ''; 46 47 meta = { 48 homepage = "https://developer.apple.com/downloads/"; 49 description = "Apple's XCode SDK"; 50 license = stdenv.lib.licenses.unfree; 51 }; 52}