Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 20 Jun 2018 17:42:35 +0000 (UTC)
From:      John Baldwin <jhb@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r472890 - head/Mk
Message-ID:  <201806201742.w5KHgZiD000351@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201806201742.w5KHgZiD000351>