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