aboutsummaryrefslogtreecommitdiff
path: root/Mk/bsd.port.mk
diff options
context:
space:
mode:
authorBryan Drewery <bdrewery@FreeBSD.org>2014-09-30 16:22:05 +0000
committerBryan Drewery <bdrewery@FreeBSD.org>2014-09-30 16:22:05 +0000
commit9576bda6137e0b862682abb07840ea1da57f104b (patch)
tree7d8babfa14cfeff32d5fe0bcb1ca2735cecd0652 /Mk/bsd.port.mk
parent04b3cf366b9858a3f23aee1b6323bd40d4521871 (diff)
downloadports-9576bda6137e0b862682abb07840ea1da57f104b.tar.gz
ports-9576bda6137e0b862682abb07840ea1da57f104b.zip
Notes
Diffstat (limited to 'Mk/bsd.port.mk')
-rw-r--r--Mk/bsd.port.mk17
1 files changed, 13 insertions, 4 deletions
diff --git a/Mk/bsd.port.mk b/Mk/bsd.port.mk
index 06e8f3521332..1fc5d258ea9c 100644
--- a/Mk/bsd.port.mk
+++ b/Mk/bsd.port.mk
@@ -1186,10 +1186,10 @@ ARCH!= ${UNAME} -p
OPSYS!= ${UNAME} -s
.endif
+UNAMER!=${UNAME} -r
+
# Get the operating system revision
-.if !defined(OSREL)
-OSREL!= ${UNAME} -r | ${SED} -e 's/[-(].*//'
-.endif
+OSREL?= ${UNAMER:C/-.*//}
# Get __FreeBSD_version
.if !defined(OSVERSION)
@@ -1198,10 +1198,19 @@ OSVERSION!= ${AWK} '/^\#define[[:blank:]]__FreeBSD_version/ {print $$3}' < /usr/
.elif exists(${SRC_BASE}/sys/sys/param.h)
OSVERSION!= ${AWK} '/^\#define[[:blank:]]__FreeBSD_version/ {print $$3}' < ${SRC_BASE}/sys/sys/param.h
.else
-OSVERSION!= ${SYSCTL} -n kern.osreldate
+.error Unable to determine OS version. Either define OSVERSION, install /usr/include/sys/param.h or define SRC_BASE.
.endif
.endif
+# Convert OSVERSION to major release number
+_OSVERSION_MAJOR= ${OSVERSION:C/([0-9]?[0-9])([0-9][0-9])[0-9]{3}/\1/}
+# Sanity checks for chroot/jail building.
+.if ${_OSVERSION_MAJOR} != ${UNAMER:R}
+.error UNAME_r (${UNAMER}) and OSVERSION (${OSVERSION}) do not agree on major version number.
+.elif ${_OSVERSION_MAJOR} != ${OSREL:R}
+.error OSREL (${OSREL}) and OSVERSION (${OSVERSION}) do not agree on major version number.
+.endif
+
# Enable new xorg for FreeBSD versions after Radeon KMS was imported unless
# WITHOUT_NEW_XORG is set.
.if (${OSVERSION} >= 902510 && ${OSVERSION} < 1000000) || ${OSVERSION} >= 1000704