diff options
author | jhb <jhb@FreeBSD.org> | 2018-06-21 01:42:35 +0800 |
---|---|---|
committer | jhb <jhb@FreeBSD.org> | 2018-06-21 01:42:35 +0800 |
commit | 7d5b991a8ac0ae067a25fa0be3aca3c40285e2f9 (patch) | |
tree | dfaf2867319736e1130ed42d07de79ca309a227a /Mk | |
parent | 32473038dadfcbb0f7af8349f27af9048fc9ae1d (diff) | |
download | freebsd-ports-gnome-7d5b991a8ac0ae067a25fa0be3aca3c40285e2f9.tar.gz freebsd-ports-gnome-7d5b991a8ac0ae067a25fa0be3aca3c40285e2f9.tar.zst freebsd-ports-gnome-7d5b991a8ac0ae067a25fa0be3aca3c40285e2f9.zip |
Set OS versions to target system versions for CROSS_SYSROOT.
When cross-building a package via a CROSS_SYSROOT, set OSVERSION,
_OSRELEASE, and OSREL to the target OS version. OSVERSION is derived
from the <sys/param.h> header in the sysroot. _OSRELEASE cannot be
easily derived from a sysroot as it is a property of a kernel, so
instead generate a "fake" _OSRELEASE from the OSVERSION, but use a
"-CROSS" branch name that will hopefully fail in any places that make
assumptions about branch names.
Approved by: portmgr (bapt)
Differential Revision: https://reviews.freebsd.org/D15812
Diffstat (limited to 'Mk')
-rw-r--r-- | Mk/bsd.port.mk | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/Mk/bsd.port.mk b/Mk/bsd.port.mk index 6121c91e3210..1c416d8a1521 100644 --- a/Mk/bsd.port.mk +++ b/Mk/bsd.port.mk @@ -1148,6 +1148,15 @@ ARCH= ${CROSS_TOOLCHAIN:C,-.*$,,} .endif _EXPORTED_VARS+= ARCH +# Get operating system versions for a cross build +.if defined(CROSS_SYSROOT) +.if !exists(${CROSS_SYSROOT}/usr/include/sys/param.h) +.error CROSS_SYSROOT does not include /usr/include/sys/param.h. +.endif +OSVERSION!= ${AWK} '/^\#define[[:blank:]]__FreeBSD_version/ {print $$3}' < ${CROSS_SYSROOT}/usr/include/sys/param.h +_OSRELEASE!= ${AWK} -v version=${OSVERSION} 'END { printf("%d.%d-CROSS", version / 100000, version / 1000 % 100) }' < /dev/null +.endif + # Get the operating system type .if !defined(OPSYS) OPSYS!= ${UNAME} -s |