nixpkgs/pkgs/os-specific/darwin/xcode/default.nix
aszlig a6621202af
xcode: Drop use of weak_import on enumerators.
GCC doesn't support attributes on enumerators, which could pose a
problem but fortunately not in this case. Here a
__attribute__((weak_import)) is used, which doesn't make much sense for
enumerators anyway (noone will die because the corresponding enumerator
won't be referenced either in older OS X versions).

Signed-off-by: aszlig <aszlig@redmoonstudios.org>
2014-03-12 10:00:49 +01:00

53 lines
1.4 KiB
Nix

{ stdenv, requireFile, xpwn }:
with stdenv.lib;
let
osxVersion = "10.9";
in stdenv.mkDerivation rec {
name = "xcode-${version}";
version = "5.0.2";
src = requireFile {
name = "xcode_${version}.dmg";
url = meta.homepage;
sha256 = "0mrligqkfqwx8cy883pxm4w5w7a17nfh227zdspfll23r9agf32k";
};
phases = [ "unpackPhase" "patchPhase" "installPhase" "fixupPhase" ];
outputs = [ "out" "toolchain" ];
unpackCmd = let
basePath = "Xcode.app/Contents/Developer/Platforms/MacOSX.platform";
sdkPath = "${basePath}/Developer/SDKs";
in ''
${xpwn}/bin/dmg extract "$curSrc" main.hfs > /dev/null
${xpwn}/bin/hfsplus main.hfs extractall "${sdkPath}" > /dev/null
'';
setSourceRoot = "sourceRoot=MacOSX${osxVersion}.sdk";
patches = optional (osxVersion == "10.9") ./gcc-fix-enum-attributes.patch;
installPhase = ''
ensureDir "$out/share/sysroot"
cp -a * "$out/share/sysroot/"
ln -s "$out/share/sysroot/usr/lib" "$out/lib"
ln -s "$out/share/sysroot/usr/include" "$out/include"
ensureDir "$toolchain"
pushd "$toolchain"
${xpwn}/bin/hfsplus "$(dirs +1)/../main.hfs" extractall \
Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr \
> /dev/null
popd
'';
meta = {
homepage = "https://developer.apple.com/downloads/";
description = "Apple's XCode SDK";
license = stdenv.lib.licenses.unfree;
};
}