about summary refs log tree commit diff
path: root/pkgs/development/tools/xcbuild/wrapper.nix
diff options
context:
space:
mode:
authorMatthew Bauer <mjbauer95@gmail.com>2016-06-25 23:45:55 -0500
committerMatthew Bauer <mjbauer95@gmail.com>2016-11-15 18:57:20 -0600
commitde87138b9ac14a466fe5f0b43462542308913cb0 (patch)
tree5abe617bea36ed32d39f855f5fb514048a575ee3 /pkgs/development/tools/xcbuild/wrapper.nix
parentd05d063572915a9e9a5955566ac7c797e97ca405 (diff)
downloadnixlib-de87138b9ac14a466fe5f0b43462542308913cb0.tar
nixlib-de87138b9ac14a466fe5f0b43462542308913cb0.tar.gz
nixlib-de87138b9ac14a466fe5f0b43462542308913cb0.tar.bz2
nixlib-de87138b9ac14a466fe5f0b43462542308913cb0.tar.lz
nixlib-de87138b9ac14a466fe5f0b43462542308913cb0.tar.xz
nixlib-de87138b9ac14a466fe5f0b43462542308913cb0.tar.zst
nixlib-de87138b9ac14a466fe5f0b43462542308913cb0.zip
xcbuild: add wrapper
Also updates xcbuild version.

This changes the raw string expressions into nix expressions that are
then converted into json by builtins.toJSON. Then, converted to Plist
XML by Apple's plutil. Sadly, xcbuild does not support using raw JSON
but Apple's plutil does so we just convert the file from JSON to XML
using Apple's plutil. The result is not ideal but it looks like all OS X
systems have working plutil's.

- set mac version to 10.10
- add setup hook.
Diffstat (limited to 'pkgs/development/tools/xcbuild/wrapper.nix')
-rw-r--r--pkgs/development/tools/xcbuild/wrapper.nix64
1 files changed, 64 insertions, 0 deletions
diff --git a/pkgs/development/tools/xcbuild/wrapper.nix b/pkgs/development/tools/xcbuild/wrapper.nix
new file mode 100644
index 000000000000..1b38c85ceb95
--- /dev/null
+++ b/pkgs/development/tools/xcbuild/wrapper.nix
@@ -0,0 +1,64 @@
+{ stdenv, callPackage, makeWrapper, writeText, CoreServices, ImageIO, CoreGraphics
+, cctools, bootstrap_cmds}:
+
+let
+
+  toolchainName = "com.apple.dt.toolchain.XcodeDefault";
+  platformName = "com.apple.platform.macosx";
+  sdkName = "macosx10.9";
+
+  xcbuild = callPackage ./default.nix {
+    inherit CoreServices ImageIO CoreGraphics;
+  };
+
+  toolchain = callPackage ./toolchain.nix {
+    inherit cctools bootstrap_cmds toolchainName xcbuild;
+    cc = stdenv.cc;
+  };
+
+  sdk = callPackage ./sdk.nix {
+    inherit toolchainName sdkName xcbuild;
+  };
+
+  platform = callPackage ./platform.nix {
+    inherit sdk platformName xcbuild;
+  };
+
+  developer = callPackage ./developer.nix {
+    inherit platform toolchain xcbuild;
+  };
+
+  xcconfig = writeText "nix.xcconfig" ''
+SDKROOT=${sdkName}
+  '';
+
+in
+
+stdenv.mkDerivation {
+  name = "xcbuild-wrapper";
+
+  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
+
+    wrapProgram $out/bin/xcodebuild \
+      --add-flags "-xcconfig ${xcconfig}" \
+      --add-flags "DERIVED_DATA_DIR=." \
+      --set DEVELOPER_DIR "${developer}"
+    wrapProgram $out/bin/xcrun \
+      --add-flags "-sdk ${sdkName}" \
+      --set DEVELOPER_DIR "${developer}"
+  '';
+
+  preferLocalBuild = true;
+}