[PC-BSD Commits] r14079 - pcbsd/current/src-sh/pbi-manager

svn at pcbsd.org svn at pcbsd.org
Wed Nov 30 09:12:28 PST 2011


Author: kris
Date: 2011-11-30 09:12:28 -0800 (Wed, 30 Nov 2011)
New Revision: 14079

Modified:
   pcbsd/current/src-sh/pbi-manager/pbi-manager
Log:

Add experimental support for ccache on the host system



Modified: pcbsd/current/src-sh/pbi-manager/pbi-manager
===================================================================
--- pcbsd/current/src-sh/pbi-manager/pbi-manager	2011-11-30 15:55:53 UTC (rev 14078)
+++ pcbsd/current/src-sh/pbi-manager/pbi-manager	2011-11-30 17:12:28 UTC (rev 14079)
@@ -1606,6 +1606,26 @@
 	# Make sure ldconfig is primed
 	/etc/rc.d/ldconfig start
 
+	# Check if using ccache directory
+	if [ -d "/.ccache" ] ; then
+		echo "Enabling ccache..."
+		cd /usr/ports/devel/ccache && make install clean >/dev/null 2>/dev/null
+
+		# Setup environment variables
+		CCACHE_PATH="/usr/bin:/usr/local/bin"
+		export CCACHE_PATH
+		CCACHE_DIR="/.ccache"
+		export CCACHE_DIR
+		PATH="/usr/local/libexec/ccache:${PATH}"
+		export PATH
+
+		# Setup make configuration
+		echo ".if !defined(NO_CCACHE)" >> ${MAKE_CONF}
+		echo "  CC=/usr/local/libexec/ccache/world-cc" >> ${MAKE_CONF}
+		echo "  CXX=/usr/local/libexec/ccache/world-c++" >> ${MAKE_CONF}
+		echo ".endif" >> ${MAKE_CONF}
+	fi
+
 	PATH="${PATH}:/usr/local/bin:/usr/local/sbin:${LOCALBASE}/bin:${LOCALBASE}/sbin"
 	export PATH
 
@@ -6075,6 +6095,7 @@
 	umount -f ${PBI_CHROOTDIR}/compat/linux/proc >/dev/null 2>/dev/null
 	umount -f ${PBI_CHROOTDIR}/usr/ports >/dev/null 2>/dev/null
 	umount -f ${PBI_CHROOTDIR}/tmpfs >/dev/null 2>/dev/null
+	umount -f ${PBI_CHROOTDIR}/.ccache >/dev/null 2>/dev/null
 	rm -rf "${PBI_CHROOTDIR}" >/dev/null 2>/dev/null
 	chflags -R noschg ${PBI_CHROOTDIR} >/dev/null 2>/dev/null
 	rm -rf "${PBI_CHROOTDIR}" >/dev/null 2>/dev/null
@@ -6162,6 +6183,13 @@
 
 	# Make sure the outgoing dir exists
 	mkdir -p ${PBI_CHROOTDIR}${PBI_CREATE_OUTDIR} >/dev/null 2>/dev/null
+
+	# Check for ccache being enabled on the host and nullfs mount it to the chroot
+	if [ ! -z "${CCACHE_DIR}" -a -d "${CCACHE_DIR}" ] ; then
+		mkdir ${PBI_CHROOTDIR}/.ccache
+		mount_nullfs ${CCACHE_DIR} ${PBI_CHROOTDIR}/.ccache	
+	fi
+
 }
 
 # No chroot environment tar file exists yet, lets build or extract



More information about the Commits mailing list