[packages/hhvm] fix ccache enabled build, use separate build dir; cleanups

glen glen at pld-linux.org
Mon Aug 11 08:45:29 CEST 2014


commit 449902dcd36f79167585ad9279888ccd65971ef7
Author: Elan Ruusamäe <glen at delfi.ee>
Date:   Mon Aug 11 09:36:43 2014 +0300

    fix ccache enabled build, use separate build dir; cleanups

 ccache.patch | 14 ++++++++++++
 hhvm.spec    | 69 ++++++++++++++++++------------------------------------------
 2 files changed, 34 insertions(+), 49 deletions(-)
---
diff --git a/hhvm.spec b/hhvm.spec
index 1ed44dc..4b4c9c0 100644
--- a/hhvm.spec
+++ b/hhvm.spec
@@ -21,11 +21,8 @@ Source3:	https://github.com/hhvm/hhvm-third-party/archive/%{thirdparty}/third_pa
 Source4:	%{name}-fcgi.init
 Source5:	%{name}-fcgi.sysconfig
 Source100:	get-source.sh
-Patch0:		cmake-missing-library.patch
-Patch3:		system-xhp.patch
-Patch4:		system-libafdt.patch
-Patch5:		system-folly.patch
-Patch10:	no-debug.patch
+Patch0:		ccache.patch
+Patch1:		no-debug.patch
 URL:		https://github.com/facebook/hhvm/wiki
 BuildRequires:	ImageMagick-devel
 BuildRequires:	a52dec-libs-devel
@@ -219,27 +216,14 @@ mv hhvm-third-party-* third-party
 rmdir third-party/folly/src
 mv folly-* third-party/folly/src
 
-%patch10 -p1
-#%patch5 -p1
+%patch0 -p1
+%patch1 -p1
 
 # prefer ones from system
 rm CMake/FindBISON.cmake
 rm CMake/FindFLEX.cmake
 rm CMake/FindFreetype.cmake
 
-%if 0
-%patch0 -p1
-%patch1 -p1
-#%patch3 -p1
-%patch4 -p1
-
-#rm -rf src/third_party/libmbfl
-#sed -i -e '/add_subdirectory(third_party\/libmbfl)/d' src/CMakeLists.txt
-
-rm -rf src/third_party/xhp
-rm -rf src/third_party/libafdt
-%endif
-
 %build
 # also in: hphp/tools/hphpize/hphpize.cmake
 API=$(awk '/#define HHVM_API_VERSION/{v=$3; sub(/L$/, "", v); print v}' hphp/runtime/ext/extension.h)
@@ -249,43 +233,30 @@ if [ $API != %{hhvm_api_version} ]; then
 	exit 1
 fi
 
-export HPHP_HOME=$(pwd)
-export HPHP_LIB=$HPHP_HOME/bin
-install -d $HPHP_LIB
-
-%undefine	with_ccache
-
-# asm linking breaks on $CC containing spaces
-if [[ "%{__cc}" = *ccache* ]]; then
-	cat <<-'EOF' > $HPHP_LIB/gcc
-	#!/bin/sh
-	exec %{__cc} "$@"
-	EOF
-	chmod +x $HPHP_LIB/gcc
-	CC=$HPHP_LIB/gcc
-fi
-
-if [[ "%{__cxx}" = *ccache* ]]; then
-	cat <<-'EOF' > $HPHP_LIB/g++
-	#!/bin/sh
-	exec %{__cxx} "$@"
-	EOF
-	chmod +x $HPHP_LIB/g++
-	CXX=$HPHP_LIB/g++
-fi
-
-%if 0
 # out of dir build broken (can't find it's tools)
 install -d build
 cd build
-%endif
+
+# handle cmake & ccache
+# http://stackoverflow.com/questions/1815688/how-to-use-ccache-with-cmakec
+# ASM fix: http://lists.busybox.net/pipermail/buildroot/2013-March/069436.html
+if [[ "%{__cc}" = *ccache* ]]; then
+	cc="%{__cc}"
+	cxx="%{__cxx}"
+	ccache="
+	-DCMAKE_C_COMPILER="ccache" -DCMAKE_C_COMPILER_ARG1="${cc#ccache }" \
+	-DCMAKE_CXX_COMPILER="ccache" -DCMAKE_CXX_COMPILER_ARG1="${cxx#ccache }" \
+	-DCMAKE_ASM_COMPILER="${cc#ccache }" \
+	"
+fi
 
 %cmake \
+	$ccache \
 	-DCMAKE_PREFIX_PATH=%{_prefix} \
 	-DUSE_JEMALLOC=OFF \
 	-DUSE_TCMALLOC=OFF \
 	-DHPHP_NOTEST=ON \
-	./
+	../
 
 # setup COMPILER_ID/HHVM_REPO_SCHEMA so it doesn't look it up from our package git repo
 # see hphp/util/generate-buildinfo.sh
@@ -301,7 +272,7 @@ export HHVM_REPO_SCHEMA=$(date +%N_%s)
 if [ ! -f makeinstall.stamp -o ! -d $RPM_BUILD_ROOT ]; then
 	rm -rf makeinstall.stamp installed.stamp $RPM_BUILD_ROOT
 
-	%{__make} install \
+	%{__make} install -C build \
 		HPHP_HOME__=$(pwd) \
 		DESTDIR=$RPM_BUILD_ROOT
 
diff --git a/ccache.patch b/ccache.patch
new file mode 100644
index 0000000..5300097
--- /dev/null
+++ b/ccache.patch
@@ -0,0 +1,14 @@
+handle cmake & ccache
+http://stackoverflow.com/questions/1815688/how-to-use-ccache-with-cmake
+
+--- hhvm-HHVM-3.2.0/CMake/HPHPCompiler.cmake~	2014-07-18 03:12:10.000000000 +0300
++++ hhvm-HHVM-3.2.0/CMake/HPHPCompiler.cmake	2014-08-10 23:40:37.972367254 +0300
+@@ -22,7 +22,7 @@
+   set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -g")
+ # using GCC
+ elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
+-  execute_process(COMMAND ${CMAKE_CXX_COMPILER} -dumpversion OUTPUT_VARIABLE GCC_VERSION)
++  execute_process(COMMAND ${CMAKE_CXX_COMPILER} ${CMAKE_CXX_COMPILER_ARG1} -dumpversion OUTPUT_VARIABLE GCC_VERSION)
+   set(GNUCC49_OPT "")
+   if (NOT (GCC_VERSION VERSION_GREATER 4.8 OR GCC_VERSION VERSION_EQUAL 4.8))
+     message(FATAL_ERROR "${PROJECT_NAME} requires g++ 4.8 or greater.")
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/hhvm.git/commitdiff/449902dcd36f79167585ad9279888ccd65971ef7



More information about the pld-cvs-commit mailing list