Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 9 Jun 2012 14:43:43 -0700 (PDT)
From:      Doug Barton <dougb@FreeBSD.org>
To:        Garrett Cooper <yanegomi@gmail.com>
Cc:        Chris Rees <crees@freebsd.org>, Matthew Seaman <m.seaman@infracaninophile.co.uk>, freebsd-current <freebsd-current@freebsd.org>
Subject:   Re: PORTS_MODULES fix
Message-ID:  <alpine.BSF.2.00.1206091442340.78301@bcgv.qbhto.arg>
In-Reply-To: <CAGH67wT9udEOyZwcgbgHMpZitVD0d6FoMfxUnXCgK-uBP817yg@mail.gmail.com>
References:  <4FD384B5.3050709@FreeBSD.org> <CADLo839AsqtRiDZt3HJatBy=0Peu6W2Bu7XrsfiMes3RewTtPg@mail.gmail.com> <4FD38A71.8070601@infracaninophile.co.uk> <4FD39099.3000208@FreeBSD.org> <CAGH67wT9udEOyZwcgbgHMpZitVD0d6FoMfxUnXCgK-uBP817yg@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help

[-- Attachment #1 --]
Ok, after reading your PR and discussion on IRC I have the following 
which incorporates all the suggestions so far. I haven't actually tested 
this yet, but if people agree that this is the right direction to go I 
will before I commit it of course.

Doug

-- 

 	It's always a long day; 86400 doesn't fit into a short.

 	Breadth of IT experience, and depth of knowledge in the DNS.
 	Yours for the right price.  :)  http://SupersetSolutions.com/

[-- Attachment #2 --]
Index: kern.post.mk
===================================================================
--- kern.post.mk	(revision 236818)
+++ kern.post.mk	(working copy)
@@ -36,9 +36,30 @@
 .endif
 .endfor
 
-# Handle out of tree ports 
+# Handle ports (as defined by the user) that build kernel modules
 .if !defined(NO_MODULES) && defined(PORTS_MODULES)
-PORTSMODULESENV=SYSDIR=${SYSDIR}
+#
+# The ports tree needs some environment variables defined to match the new kernel
+#
+# Ports search for some dependencies in PATH, so add the location of the installed files
+LOCALBASE?=	/usr/local
+# SRC_BASE is how the ports tree refers to the location of the base source files
+.if !defined(SRC_BASE)
+SRC_BASE!=	realpath "${SYSDIR:H}/"
+.endif
+# OSVERSION is used by some ports to determine build options
+.if !defined(OSRELDATE)
+# Definition copied from src/Makefile.inc1
+OSRELDATE!=	awk '/^\#define[[:space:]]*__FreeBSD_version/ { print $$3 }' \
+		    ${MAKEOBJDIRPREFIX}${SRC_BASE}/include/osreldate.h
+.endif
+# Keep the related ports builds in the obj directory so that they are only rebuilt once per kernel build
+WRKDIRPREFIX?=	${MAKEOBJDIRPREFIX}${SRC_BASE}/sys/${KERNCONF}/${__i}
+PORTSMODULESENV=\
+	PATH=		${PATH}:${LOCALBASE}/bin:${LOCALBASE}/sbin \
+	SRC_BASE=	${SRC_BASE} \
+	OSVERSION=	${OSRELDATE} \
+	WRKDIRPREFIX=	${WRKDIRPREFIX}
 .for __target in all install reinstall clean
 ${__target}: ports-${__target}
 ports-${__target}:

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