Skip to content

Commit

Permalink
mk: Hardcode expensive variables.
Browse files Browse the repository at this point in the history
Avoids many calls to calculate these at runtime, especially during the
bulk build scan phase, providing a decent performance improvement.

These variables are only suitable for the current 20210826 trunk branch!
  • Loading branch information
jperkin committed Jan 27, 2023
1 parent 30c1500 commit 702ba19
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions mk/bsd.prefs.mk
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,32 @@ UNAME=/run/current-system/sw/bin/uname
UNAME=echo Unknown
.endif

#
# Set some known variables early, as they are expensively computed before
# bsd.own.mk (and thus mk.conf) are pulled in. Clearly these are specific
# to each build!
#
# These variables are suitable for current 20210826 trunk builds only!
#
OPSYS= SunOS
OS_VERSION= 5.11
OPSYS_VERSION= 051100
_UNAME_V= joyent_20210826T002459Z
_GCC_VERSION= 12.2.0
_GCC_REQD= 12.2.0
_NEED_NEWER_GCC= NO
USE_NATIVE_GCC= yes
PKGTOOLS_VERSION= 20211115
UNPRIVILEGED_USER= pbulk
UNPRIVILEGED_GROUP= pbulk
UNPRIVILEGED_GROUPS= pbulk
.for var in OPSYS OS_VERSION OPSYS_VERSION \
PKGTOOLS_VERSION _UNAME_V \
_GCC_VERSION _GCC_REQD _NEED_NEWER_GCC \
UNPRIVILEGED_USER UNPRIVILEGED_GROUP UNPRIVILEGED_GROUPS
MAKEFLAGS+= ${var}=${${var}:Q}
.endfor

.if !defined(OPSYS)
OPSYS:= ${:!${UNAME} -s!:S/-//g:S/\///g:C/^CYGWIN_.*$/Cygwin/}
MAKEFLAGS+= OPSYS=${OPSYS:Q}
Expand Down

0 comments on commit 702ba19

Please sign in to comment.