From 66e42e7b69fc0e7766651d37cf8f4823bdfcdb51 Mon Sep 17 00:00:00 2001
From: Danny Rawlins <monster.romster@gmail.com>
Date: Sat, 7 Jul 2012 11:52:18 +1000
Subject: [PATCH] boost: fix make jobs and add support for ccache

---
 boost/Pkgfile | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/boost/Pkgfile b/boost/Pkgfile
index 1c84bf195..21e68f2c1 100644
--- a/boost/Pkgfile
+++ b/boost/Pkgfile
@@ -12,12 +12,17 @@ source=(http://downloads.sourceforge.net/project/$name/$name/$version/${name}_${
 build() {
 	cd ${name}_${version//./_}
 
+	if [ -n "$(pkginfo -i | grep '^ccache ')" ]; then
+		echo "using gcc : : ccache g++ ;" >> \
+			tools/build/v2/user-config.jam
+	fi
+
 	./bootstrap.sh
 
 	sed -i -e "s|-O3|$CXXFLAGS -O3 -Wno-deprecated -fno-strict-aliasing|" \
 		tools/build/v2/tools/gcc.jam
 
-	local JOBS="$(sed -e 's/.*\(\-j[ 0-9]\+\) \{0,1\}.*/\1/' <<< $MAKEFLAGS)"
+	local JOBS="$(sed -e 's/.*\(-j *[0-9]\+\).*/\1/' <<< $MAKEFLAGS)"
 
 	pushd tools/bcp
 	../../bjam \