summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--pkgs/development/tools/xcbuild/wrapper.nix4
1 files changed, 4 insertions, 0 deletions
diff --git a/pkgs/development/tools/xcbuild/wrapper.nix b/pkgs/development/tools/xcbuild/wrapper.nix
index cd7b8616366..861ef0fc847 100644
--- a/pkgs/development/tools/xcbuild/wrapper.nix
+++ b/pkgs/development/tools/xcbuild/wrapper.nix
@@ -110,11 +110,15 @@ runCommand "xcodebuild-${xcbuild.version}" {
   mkdir -p $out/Applications/Xcode.app/Contents
   ln -s $out $out/Applications/Xcode.app/Contents/Developer
 
+  # The native xcodebuild command supports an invocation like "xcodebuild -version -sdk" without specifying the specific SDK, so we simulate this by
+  # detecting this case and simulating the output; printing the header and appending the normal output via appending the sdk version to the positional
+  # arguments we pass through to the wrapped xcodebuild.
   makeWrapper ${xcbuild}/bin/xcodebuild $out/bin/xcodebuild \
     --add-flags "-xcconfig ${xcconfig}" \
     --add-flags "DERIVED_DATA_DIR=." \
     --set DEVELOPER_DIR "$out" \
     --set SDKROOT ${sdkName} \
+    --run '[ "$#" -eq 2 ] && [ "$1" = "-version" ] && [ "$2" = "-sdk" ] && echo ${sdkName}.sdk - macOS ${sdkVer} \(macosx${sdkVer}\) && set -- "$@" "${sdkName}"' \
     --run '[ "$1" = "-version" ] && [ "$#" -eq 1 ] && (echo Xcode ${xcodeVer}; echo Build version ${sdkBuildVersion}) && exit 0' \
     --run '[ "$1" = "-license" ] && exit 0'