pkgsrc-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: GO on macOS Monterrey

Am 05.03.2022 um 22:35 schrieb Jason Bacon:
I don't think there's a problem here.  ${OPSYS} == "Darwin" is checked
first, and if that's false, ${OSX_VERSION:R} >= 12 need not be
evaluated, so it doesn't matter if OSX_VERSION is empty.  I just tested
on NetBSD and it works as expected (builds go14).

The bmake from pkgsrc is from 2020-05-24, which means that it always
evaluates ${OSX_VERSION}, even if ${OPSYS} is not "Darwin".  This has
been fixed in NetBSD 10's make.

To demonstrate this:

$ cat <<'EOF' >
.if ${OPSYS} == Darwin && ${OSX_VERSION:U0.0:R} >= 12

$ OPSYS=NetBSD bmake -r -f -dcv
lhs = "NetBSD", rhs = "Darwin", op = ==
Applying[OSX_VERSION] :U to ""
Result[OSX_VERSION] of :U is "0.0"
Applying[OSX_VERSION] :R to "0.0"
Result[OSX_VERSION] of :R is "0"
left = 0.000000, right = 12.000000, op = >=

On NetBSD 10, the debug log has a different format but is still roughly

$ OPSYS=NetBSD /usr/bin/make -r -f -dcv
CondParser_Eval: ${OPSYS} == Darwin && ${OSX_VERSION:U0.0:R} >= 12
Var_Parse: ${OPSYS} == Darwin && ${OSX_VERSION:U0.0:R} >= 12 (eval-defined)
Comparing "NetBSD" == "Darwin"
Var_Parse: ${OSX_VERSION:U0.0:R} >= 12 (parse-only)
Parsing modifier ${OSX_VERSION:U...}
Result of ${OSX_VERSION:U0.0} is "" (parse-only, defined)
Parsing modifier ${OSX_VERSION:R}
Result of ${OSX_VERSION:R} is "" (parse-only, defined)

The log output does not have a line for "Comparing 12.000000" now.
Furthermore, it clearly says that the second condition is parse-only, it
is not evaluated.

Be careful though if OSX_VERSION can have three parts, for example
12.0.0.  In such a case, the modifier ':R' would only strip the last
component, leaving 12.0.  This can be compared numerically, and in the
edge case of having version numbers like 12.10.3, this number would be
less than 12.2.3, simply because 12.100000 < 12.200000.  When comparing
with 12.0, this is no problem though.

To get only the major version even in case of three-part version
numbers, use ':R' twice, resulting in ${OSX_VERSION:R:R}.


Home | Main Index | Thread Index | Old Index