summary refs log tree commit diff
path: root/pkgs/development/tools/xcbuild/wrapper.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/development/tools/xcbuild/wrapper.nix')
-rw-r--r--pkgs/development/tools/xcbuild/wrapper.nix23
1 files changed, 14 insertions, 9 deletions
diff --git a/pkgs/development/tools/xcbuild/wrapper.nix b/pkgs/development/tools/xcbuild/wrapper.nix
index 77ef8565a34..4aa08f99457 100644
--- a/pkgs/development/tools/xcbuild/wrapper.nix
+++ b/pkgs/development/tools/xcbuild/wrapper.nix
@@ -1,4 +1,4 @@
-{ lib, buildPackages, makeWrapper, writeText, runCommand
+{ stdenv, lib, buildPackages, makeWrapper, writeText, runCommand
 , CoreServices, ImageIO, CoreGraphics
 , targetPlatform
 , xcodePlatform ? targetPlatform.xcodePlatform or "MacOSX"
@@ -36,14 +36,14 @@ let
   '';
 
   xcode-select = writeText "xcode-select" ''
-#!/usr/bin/env sh
+#!${stdenv.shell}
 while [ $# -gt 0 ]; do
    case "$1" in
          -h | --help) ;; # noop
          -s | --switch) shift;; # noop
          -r | --reset) ;; # noop
          -v | --version) echo xcode-select version ${xcodeSelectVersion} ;;
-         -p | --print-path) echo @DEVELOPER_DIR@ ;;
+         -p | -print-path | --print-path) echo @DEVELOPER_DIR@ ;;
          --install) ;; # noop
     esac
     shift
@@ -51,7 +51,7 @@ done
   '';
 
   xcrun = writeText "xcrun" ''
-#!/usr/bin/env sh
+#!${stdenv.shell}
 while [ $# -gt 0 ]; do
    case "$1" in
          --sdk | -sdk) shift ;;
@@ -86,16 +86,20 @@ runCommand "xcodebuild-${xcbuild.version}" {
   inherit (xcbuild) meta;
 
   # ensure that the toolchain goes in PATH
-  propagatedBuildInputs = [ "${toolchains}/XcodeDefault.xctoolchain/usr" ];
+  propagatedBuildInputs = [ "${toolchains}/XcodeDefault.xctoolchain" ];
 
-  passthru = { inherit xcbuild; };
+  passthru = {
+    inherit xcbuild;
+    toolchain = "${toolchains}/XcodeDefault.xctoolchain";
+    sdk = "${sdks}/${sdkName}";
+    platform = "${platforms}/${xcodePlatform}.platform";
+  };
 
   preferLocalBuild = true;
 } ''
   mkdir -p $out/bin
 
-  mkdir -p $out/usr
-  ln -s $out/bin $out/usr/bin
+  ln -s $out $out/usr
 
   mkdir -p $out/Library/Xcode
   ln -s ${xcbuild}/Library/Xcode/Specifications $out/Library/Xcode/Specifications
@@ -108,7 +112,8 @@ runCommand "xcodebuild-${xcbuild.version}" {
     --add-flags "DERIVED_DATA_DIR=." \
     --set DEVELOPER_DIR "$out" \
     --set SDKROOT ${sdkName} \
-    --run '[ "$1" = "-version" ] && (echo Xcode ${xcodeVer}; echo Build version ${sdkBuildVersion}) && exit 0'
+    --run '[ "$1" = "-version" ] && [ "$#" -eq 1 ] && (echo Xcode ${xcodeVer}; echo Build version ${sdkBuildVersion}) && exit 0' \
+    --run '[ "$1" = "-license" ] && exit 0'
 
   substitute ${xcode-select} $out/bin/xcode-select \
     --subst-var-by DEVELOPER_DIR $out