2016-06-26 06:45:55 +02:00
|
|
|
{ stdenv, callPackage, makeWrapper, writeText, CoreServices, ImageIO, CoreGraphics
|
2016-11-06 01:51:15 +01:00
|
|
|
, cctools, bootstrap_cmds, binutils}:
|
2016-06-26 06:45:55 +02:00
|
|
|
|
|
|
|
let
|
|
|
|
|
|
|
|
toolchainName = "com.apple.dt.toolchain.XcodeDefault";
|
|
|
|
platformName = "com.apple.platform.macosx";
|
2016-11-06 01:51:15 +01:00
|
|
|
sdkName = "macosx10.10";
|
2016-06-26 06:45:55 +02:00
|
|
|
|
|
|
|
xcbuild = callPackage ./default.nix {
|
|
|
|
inherit CoreServices ImageIO CoreGraphics;
|
|
|
|
};
|
|
|
|
|
|
|
|
toolchain = callPackage ./toolchain.nix {
|
2016-11-10 21:53:28 +01:00
|
|
|
inherit cctools bootstrap_cmds toolchainName xcbuild binutils stdenv;
|
2016-06-26 06:45:55 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
sdk = callPackage ./sdk.nix {
|
|
|
|
inherit toolchainName sdkName xcbuild;
|
|
|
|
};
|
|
|
|
|
|
|
|
platform = callPackage ./platform.nix {
|
|
|
|
inherit sdk platformName xcbuild;
|
|
|
|
};
|
|
|
|
|
|
|
|
xcconfig = writeText "nix.xcconfig" ''
|
2016-11-06 01:51:15 +01:00
|
|
|
SDKROOT=${sdkName}
|
2016-06-26 06:45:55 +02:00
|
|
|
'';
|
|
|
|
|
|
|
|
in
|
|
|
|
|
|
|
|
stdenv.mkDerivation {
|
2018-01-20 20:50:23 +01:00
|
|
|
name = "xcbuild-wrapper-${xcbuild.version}";
|
2016-06-26 06:45:55 +02:00
|
|
|
|
|
|
|
buildInputs = [ xcbuild makeWrapper ];
|
|
|
|
|
|
|
|
setupHook = ./setup-hook.sh;
|
|
|
|
|
|
|
|
phases = [ "installPhase" "fixupPhase" ];
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
mkdir -p $out/bin
|
|
|
|
cd $out/bin/
|
|
|
|
|
|
|
|
for file in ${xcbuild}/bin/*; do
|
|
|
|
ln -s $file
|
|
|
|
done
|
|
|
|
|
2016-11-12 22:51:25 +01:00
|
|
|
mkdir -p $out/Library/Xcode/
|
|
|
|
ln -s ${xcbuild}/Library/Xcode/Specifications $out/Library/Xcode/Specifications
|
|
|
|
|
|
|
|
mkdir -p $out/Platforms/
|
2017-03-22 04:22:15 +01:00
|
|
|
ln -s ${platform} $out/Platforms/nixpkgs.platform
|
2016-11-12 22:51:25 +01:00
|
|
|
|
|
|
|
mkdir -p $out/Toolchains/
|
2017-03-22 17:33:37 +01:00
|
|
|
ln -s ${toolchain} $out/Toolchains/nixpkgs.xctoolchain
|
2016-11-12 22:51:25 +01:00
|
|
|
|
2016-06-26 06:45:55 +02:00
|
|
|
wrapProgram $out/bin/xcodebuild \
|
|
|
|
--add-flags "-xcconfig ${xcconfig}" \
|
|
|
|
--add-flags "DERIVED_DATA_DIR=." \
|
2017-10-10 22:41:44 +02:00
|
|
|
--set DEVELOPER_DIR "$out" \
|
|
|
|
--set SDKROOT ${sdkName}
|
2016-06-26 06:45:55 +02:00
|
|
|
wrapProgram $out/bin/xcrun \
|
2017-10-10 22:41:44 +02:00
|
|
|
--set DEVELOPER_DIR "$out" \
|
|
|
|
--set SDKROOT ${sdkName}
|
2017-01-19 22:21:00 +01:00
|
|
|
wrapProgram $out/bin/xcode-select \
|
2017-10-10 22:41:44 +02:00
|
|
|
--set DEVELOPER_DIR "$out" \
|
|
|
|
--set SDKROOT ${sdkName}
|
2016-06-26 06:45:55 +02:00
|
|
|
'';
|
|
|
|
|
2016-12-15 18:07:54 +01:00
|
|
|
inherit (xcbuild) meta;
|
|
|
|
|
2016-11-02 06:17:58 +01:00
|
|
|
passthru = {
|
|
|
|
raw = xcbuild;
|
|
|
|
};
|
|
|
|
|
2016-06-26 06:45:55 +02:00
|
|
|
preferLocalBuild = true;
|
|
|
|
}
|