autotools: return darwin as os instead of cmake in xcompile (#1258)

This commit is contained in:
Mike Lundy 2024-08-13 04:02:06 -07:00 committed by GitHub
parent 979172f2fc
commit 6cc82e7528
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 18 additions and 5 deletions

View File

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