Skip to content

Commit a1fefa0

Browse files
committed
[Runner] Updated xcrun executable to handle --sdk, --show-sdk-path and --show-sdk-version.
Also, added SDKROOT env. var.
1 parent 36a94b7 commit a1fefa0

File tree

1 file changed

+38
-1
lines changed

1 file changed

+38
-1
lines changed

src/Runner.jl

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -999,10 +999,46 @@ function generate_compiler_wrappers!(platform::AbstractPlatform; bin_path::Abstr
999999
# `xcrun` is another macOS-specific tool, which is occasionally needed to run some
10001000
# commands, for example for the CGO linker. Ref:
10011001
# <https://github.com/JuliaPackaging/Yggdrasil/pull/2962>.
1002+
# Cf. <https://www.unix.com/man-page/osx/1/xcrun/>
10021003
xcrun_path = joinpath(bin_path, triplet(platform), "xcrun")
10031004
write(xcrun_path, """
10041005
#!/bin/sh
1005-
exec "\${@}"
1006+
1007+
sdk_path=\$SDKROOT
1008+
1009+
show_sdk_path() {
1010+
echo "\$1"
1011+
}
1012+
1013+
show_sdk_version() {
1014+
grep -A1 '<key>Version</key>' \$1/SDKSettings.plist \
1015+
| tail -n1 \
1016+
| sed -E -e 's/\\s*<string>([^<]+)<\\/string>\\s*/\\1/'
1017+
}
1018+
1019+
while [ \$# -gt 0 ]; do
1020+
case "\$1" in
1021+
--sdk)
1022+
sdk_path=\$2
1023+
shift 2
1024+
;;
1025+
--show-sdk-path)
1026+
show_sdk_path \$sdk_path
1027+
shift
1028+
;;
1029+
--show-sdk-version)
1030+
show_sdk_version \$sdk_path
1031+
shift
1032+
;;
1033+
*)
1034+
break
1035+
;;
1036+
esac
1037+
done
1038+
1039+
if [ \$# -gt 0 ]; then
1040+
"\$@"
1041+
fi
10061042
""")
10071043
chmod(xcrun_path, 0o775)
10081044
end
@@ -1255,6 +1291,7 @@ function platform_envs(platform::AbstractPlatform, src_name::AbstractString;
12551291
if Sys.isapple(platform)
12561292
mapping["LD"] = "/opt/bin/$(triplet(platform))/ld"
12571293
mapping["MACOSX_DEPLOYMENT_TARGET"] = macos_version(platform)
1294+
mapping["SDKROOT"] = "/opt/$(aatriplet(platform))/$(aatriplet(platform))/sys-root"
12581295
end
12591296

12601297
# There is no broad agreement on what host compilers should be called,

0 commit comments

Comments
 (0)