svn commit: r472890 - head/Mk

John Baldwin jhb at FreeBSD.org
Wed Jun 20 17:42:36 UTC 2018


Author: jhb (src,doc committer)
Date: Wed Jun 20 17:42:35 2018
New Revision: 472890
URL: https://svnweb.freebsd.org/changeset/ports/472890

Log:
  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

Modified:
  head/Mk/bsd.port.mk

Modified: head/Mk/bsd.port.mk
==============================================================================
--- head/Mk/bsd.port.mk	Wed Jun 20 17:31:27 2018	(r472889)
+++ head/Mk/bsd.port.mk	Wed Jun 20 17:42:35 2018	(r472890)
@@ -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


More information about the svn-ports-all mailing list