Skip to content

Commit 6cc82e7

Browse files
authored
autotools: return darwin as os instead of cmake in xcompile (#1258)
1 parent 979172f commit 6cc82e7

File tree

1 file changed

+18
-5
lines changed

1 file changed

+18
-5
lines changed

foreign_cc/private/framework/platform.bzl

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -190,12 +190,25 @@ def triplet_name(os, arch):
190190

191191
elif os == "macos":
192192
# These are _not_ what config.guess would return for darwin;
193-
# config.guess puts the release version in the field, e.g.
194-
# darwin23.4.0. We can't correctly guess the darwin version, so we use
195-
# macos instead, which is also recognized/honored by autotools
193+
# config.guess puts the release version (the result of uname -r) in the
194+
# field, e.g. darwin23.4.0.
195+
#
196+
# The OS field is unnormalized and any dev can write a check that does
197+
# arbitrary inspection of it. Examples of these:
198+
# - libffi has a custom macro
199+
# (https://github.com/libffi/libffi/blob/8e3ef965c2d0015ed129a06d0f11f30c2120a413/acinclude.m4#L40)
200+
# that doesn't handle macos, just darwin, so that's unsafe
201+
# - some versions of libtool (like this version in the gcc tree:
202+
# https://github.com/gcc-mirror/gcc/blob/3f1e15e885185ad63a67c7fe423d2a0b4d8da101/libtool.m4#L1071)
203+
# check for darwin2*, not just darwin, so returning it without the version isn't good either.
204+
#
205+
# Currently, this returns darwin21, which is Monterey, the current
206+
# oldest non-eol version of darwin. (You can look that up here:
207+
# https://en.wikipedia.org/wiki/Darwin_(operating_system)
208+
196209
if arch == "aarch64":
197-
return "aarch64-apple-macos"
210+
return "aarch64-apple-darwin21"
198211
elif arch == "x86_64":
199-
return "x86_64-apple-macos"
212+
return "x86_64-apple-darwin21"
200213

201214
return "unknown"

0 commit comments

Comments
 (0)