+#
+# Conditional build:
+%bcond_without system_dconv # system double-conversion
+%bcond_without system_sqlite # system sqlite3
+%bcond_without system_lz4 # system lz4
+%bcond_without system_fastlz # system fastlz
+%bcond_with system_libafdt # system libafdt
+%bcond_without system_libzip # system libzip
+# cotire breaks sqlite3 on builders: https://github.com/facebook/hhvm/issues/4524
+%bcond_with cotire # cotire (compile time reducer): Speed up the build by precompiling headers
+
+# TODO
+# - system xhp
+# - system proxygen
+# - system thrift
+
# NOTES:
# - hphp/runtime/base/runtime-option.cpp evalJitDefault enables jit if /.hhvm-jit exists (yes, in filesystem root)
-# TODO
-# - system libmbfl, system xhp, sqlite3
-# git show HHVM-3.2.0
-%define githash 01228273b8cf709aacbd3df1c51b1e690ecebac8
-%define folly 09a81a9
-%define thirdparty 2234d64
+
+# must be in sync with source. extra check ensuring that it is so is done in %%build
+%define hhvm_api_version 20140829
+# hphp/system/idl/constants.idl.json defines it as 5.6.99-hhvm, but use some saner value
+%define php_version 5.6.0
+
+# git show HHVM-3.3.3
+%define githash 54b5f51c3670fe55852b6dab17a47c67b2271116
+# these hashes are git submodules (be sure to check them on proper branch)
+# GIT_DIR=third-party/.git git log -1
+%define thirdparty bf581f8
+# 6e46d468cf2876dd59c7a4dddcb4e37abf070b7a
+# GIT_DIR=third-party/folly/src/.git git log -1
+%define folly 6e46d46
Summary: Virtual Machine, Runtime, and JIT for PHP
Name: hhvm
-Version: 3.2.0
+# we prefer LTS versions
+# see http://hhvm.com/blog/6083/hhvm-long-term-support
+Version: 3.3.3
Release: 1
-License: PHP 3.01
+License: PHP 3.01 and BSD
Group: Development/Languages
Source0: https://github.com/facebook/hhvm/archive/HHVM-%{version}.tar.gz
-# Source0-md5: 791ca8c56d155a71f948387de8859f98
-Source2: https://github.com/facebook/folly/archive/%{folly}/folly-0.1-%{folly}.tar.gz
-# Source2-md5: 17bc7ee76939cd6a26755588d80313c9
+# Source0-md5: 89c620e2df253530a4f6f1a185ec913a
+Source2: https://github.com/facebook/folly/archive/%{folly}/folly-3.2-%{folly}.tar.gz
+# Source2-md5: c4bdbea4c0ffe0650d12d9ff370b8255
Source3: https://github.com/hhvm/hhvm-third-party/archive/%{thirdparty}/third_party-%{thirdparty}.tar.gz
-# Source3-md5: 9d40c3fbf1394bb1f03648d7046f8b9c
-Source4: %{name}-fcgi.init
-Source5: %{name}-fcgi.sysconfig
+# Source3-md5: 17210db0b2211c63d911076e02aab487
+Source5: %{name}-fcgi.init
+Source6: %{name}-fcgi.sysconfig
+Source7: php.ini
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
+Patch1: no-debug.patch
+Patch2: hphpize.patch
+Patch3: MAX.patch
+Patch4: system-thirdparty.patch
+Patch5: cmake.patch
+Patch6: system-fastlz.patch
URL: https://github.com/facebook/hhvm/wiki
BuildRequires: ImageMagick-devel
BuildRequires: a52dec-libs-devel
BuildRequires: apr-devel
BuildRequires: autoconf
BuildRequires: binutils-devel
+# CMake/HPHPFindLibs.cmake:364 - FIND_LIBRARY (BFD_LIB libbfd.a)
+BuildRequires: binutils-static
BuildRequires: boost-devel >= 1.50
BuildRequires: cmake >= 2.8.5
BuildRequires: curl-devel >= 7.29.0
+%{?with_system_dconv:BuildRequires: double-conversion-devel >= 1.1.1}
BuildRequires: elfutils-devel
BuildRequires: expat-devel
+%{?with_system_fastlz:BuildRequires: fastlz-devel >= 0.1.0-0.r12}
BuildRequires: gcc >= 6:4.6.0
BuildRequires: gd-devel
BuildRequires: glog-devel >= 0.3.2
BuildRequires: imap-devel >= 1:2007
#BuildRequires: jemalloc-devel >= 3.0.0
+%{?with_system_libafdt:BuildRequires: libafdt-devel >= 0.1.0}
BuildRequires: libcap-devel
BuildRequires: libdwarf-devel >= 20130729
BuildRequires: libicu-devel >= 4.2
BuildRequires: libunwind-devel
BuildRequires: libxml2-devel
BuildRequires: libxslt-devel
+%{?with_system_libzip:BuildRequires: libzip-devel >= 0.11.2}
+%{?with_system_lz4:BuildRequires: lz4-devel >= 0.0-1.r119}
BuildRequires: mysql-devel
BuildRequires: ocaml-findlib
BuildRequires: oniguruma-devel
BuildRequires: openssl-devel
-BuildRequires: pcre-devel
+BuildRequires: pcre-devel >= 8.32
#BuildRequires: php-xhp-devel >= 1.3.9-6
BuildRequires: readline-devel
BuildRequires: rpmbuild(macros) >= 1.675
+%{?with_system_sqlite:BuildRequires: sqlite3-devel >= 3.7.15.2}
BuildRequires: tbb-devel >= 4.0.6000
BuildRequires: zlib-devel
# check later, seem unused
#BuildRequires: bison >= 2.3
#BuildRequires: flex >= 2.5.35
-#BuildRequires: libafdt-devel >= 0.1.0
+BuildRequires: libafdt-devel >= 0.1.0
#BuildRequires: re2c >= 0.13.0
Provides: %{name}(api) = %{hhvm_api_version}
+Provides: php(core) = %{php_version}
# foreach (get_loaded_extensions() as $ext) printf("Provides:\tphp(%s)\n", strtolower($ext));
-Provides: php(apache)
Provides: php(apc)
Provides: php(bcmath)
Provides: php(bz2)
Provides: php(date)
Provides: php(debugger)
Provides: php(dom)
+Provides: php(enum)
Provides: php(exif)
Provides: php(fb)
Provides: php(fileinfo)
Provides: php(ftp)
Provides: php(gd)
Provides: php(gettext)
+Provides: php(gmp)
Provides: php(hash)
Provides: php(hh)
Provides: php(hhvm.debugger)
Provides: php(json)
Provides: php(ldap)
Provides: php(libxml)
+Provides: php(mail)
+Provides: php(mailparse)
Provides: php(mbstring)
Provides: php(mcrypt)
Provides: php(memcache)
Provides: php(memcached)
-Provides: php(misc)
Provides: php(mysql)
Provides: php(mysqli)
Provides: php(oauth)
ExclusiveArch: %{x8664}
BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
-# must be in sync with source. extra check ensuring that it is so is done in %%build
-%define hhvm_api_version 20140702
+
+%define hhvm_extensiondir %{_libdir}/hhvm
%description
HHVM (aka the HipHop Virtual Machine) is a new open-source virtual
rmdir third-party/folly/src
mv folly-* third-party/folly/src
-%patch10 -p1
+%patch1 -p1
+%patch2 -p1
+%patch3 -p1
+%patch4 -p1
#%patch5 -p1
+%patch6 -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
+# ensure system libs get used
+cd third-party
+rm -r pcre \
+ %{?with_system_sqlite:libsqlite3} \
+ %{?with_system_lz4:lz4} \
+ %{?with_system_dconv:double-conversion} \
+ %{?with_system_fastlz:fastlz} \
+ %{?with_system_libafdt:libafdt} \
+ %{?with_system_libzip:libzip} \
+ %{nil}
%build
# also in: hphp/tools/hphpize/hphpize.cmake
exit 1
fi
-export HPHP_HOME=$(pwd)
-export HPHP_LIB=$HPHP_HOME/bin
-install -d $HPHP_LIB
-
-%undefine with_ccache
+# out of dir build broken (can't find it's tools, or headers)
+#install -d build
+#cd build
-# asm linking breaks on $CC containing spaces
+# handle cmake & ccache
+# http://stackoverflow.com/questions/1815688/how-to-use-ccache-with-cmake
+# ASM fix: http://lists.busybox.net/pipermail/buildroot/2013-March/069436.html
if [[ "%{__cc}" = *ccache* ]]; then
- cat <<-'EOF' > $HPHP_LIB/gcc
- #!/bin/sh
- exec %{__cc} "$@"
- EOF
- chmod +x $HPHP_LIB/gcc
- CC=$HPHP_LIB/gcc
+ 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
-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
-
%cmake \
+ $ccache \
-DCMAKE_PREFIX_PATH=%{_prefix} \
+ -DHHVM_DYNAMIC_EXTENSION_DIR=%{hhvm_extensiondir} \
-DUSE_JEMALLOC=OFF \
-DUSE_TCMALLOC=OFF \
- -DHPHP_NOTEST=ON \
- ./
+ -DTEST_BIN=OFF \
+ -DENABLE_COTIRE=%{!?with_cotire:OFF}%{?with_cotire: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
-export COMPILER_ID=HHVM-%{version}-%{release}-%{githash}
+export COMPILER_ID=HHVM-%{version}-%{release}-g%{githash}
export HHVM_REPO_SCHEMA=$(date +%N_%s)
%{__make}
rm -rf makeinstall.stamp installed.stamp $RPM_BUILD_ROOT
%{__make} install \
- HPHP_HOME__=$(pwd) \
DESTDIR=$RPM_BUILD_ROOT
touch makeinstall.stamp
rm -rf $RPM_BUILD_ROOT%{_docdir}
if [ ! -f installed.stamp ]; then
-install -d $RPM_BUILD_ROOT%{_sysconfdir}/%{name}
# begin install block
+# fix broken cmake rules
+# TODO: fix cmake rules
+if [ -d $RPM_BUILD_ROOT%{_prefix}/usr ]; then
+ cp -a $RPM_BUILD_ROOT%{_prefix}/usr/* $RPM_BUILD_ROOT%{_prefix}
+ rm -rf $RPM_BUILD_ROOT%{_prefix}/usr
+fi
+
+install -d $RPM_BUILD_ROOT{%{_sysconfdir}/%{name},%{_libdir}/%{name}}
+cp -p %{SOURCE7} $RPM_BUILD_ROOT%{_sysconfdir}/%{name}
+
ln -s hhvm $RPM_BUILD_ROOT%{_bindir}/php
ln -s hhvm $RPM_BUILD_ROOT%{_bindir}/hphp
# install fastcgi initscript
install -d $RPM_BUILD_ROOT/etc/{sysconfig,rc.d/init.d}
-cp -p %{SOURCE4} $RPM_BUILD_ROOT/etc/rc.d/init.d/%{name}-fcgi
-cp -p %{SOURCE5} $RPM_BUILD_ROOT/etc/sysconfig/%{name}-fcgi
-
-%if 0
-# setup -devel
-install -d $RPM_BUILD_ROOT%{_datadir}/cmake/Modules
-cp -p CMake/*.cmake $RPM_BUILD_ROOT%{_datadir}/cmake/Modules
-
-HPHP_HOME=$(pwd)
-sed -e "
- /HHVM_INCLUDE_DIRS/ s,$HPHP_HOME,%{_includedir},g
-" hphp/tools/hphpize/hphpize.cmake > $RPM_BUILD_ROOT%{_datadir}/cmake/Modules/hphpize.cmake
-
-oIFS=$IFS
-IFS=";"
-set -- $(sed -ne 's/set(HHVM_INCLUDE_DIRS "\(.*\)")/\1/p' hphp/tools/hphpize/hphpize.cmake)
-IFS=$oIFS
-set -- $(
- for dir in "$@"; do
- [[ "$dir" = $HPHP_HOME/hphp/* ]] && echo $dir
- done
-)
-
-set +x
-for dir in "$@" \
- $HPHP_HOME/hphp/runtime \
- $HPHP_HOME/hphp/util \
- $HPHP_HOME/hphp/neo \
- $HPHP_HOME/hphp/system \
- $HPHP_HOME/hphp/parser \
-; do
- echo "D %{_includedir}${dir#$HPHP_HOME}"
- find $dir -name '*.h' | while read path; do
- file=%{_includedir}${path#$HPHP_HOME}
- echo "F $file"
- install -Dp $path $RPM_BUILD_ROOT$file
- done
-done
-set -x
-%endif
+cp -p %{SOURCE5} $RPM_BUILD_ROOT/etc/rc.d/init.d/%{name}-fcgi
+cp -p %{SOURCE6} $RPM_BUILD_ROOT/etc/sysconfig/%{name}-fcgi
+
+install -p hphp/hack/bin/hh_{server,client} $RPM_BUILD_ROOT%{_bindir}
# end of install block
touch installed.stamp; fi
%defattr(644,root,root,755)
%doc README.md hphp/NEWS
%dir %{_sysconfdir}/%{name}
+%config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/%{name}/php.ini
%attr(755,root,root) %{_bindir}/hhvm
%attr(755,root,root) %{_bindir}/hphp
+%attr(755,root,root) %{_bindir}/hh_client
+%attr(755,root,root) %{_bindir}/hh_server
%dir %{_datadir}/%{name}
%dir %{_datadir}/%{name}/hdf
%{_datadir}/%{name}/hdf/static.mime-types.hdf
+# dir for extensions
+%dir %{_libdir}/%{name}
+
%files fcgi
%defattr(644,root,root,755)
%attr(754,root,root) /etc/rc.d/init.d/%{name}-fcgi
%defattr(644,root,root,755)
%attr(755,root,root) %{_bindir}/hphpize
%{_includedir}/hphp
-%dir %{_prefix}/lib/hphp
-%{_prefix}/lib/hphp/CMake
-%{_prefix}/lib/hphp/hphpize
+%dir %{_libdir}/hhvm
+%{_libdir}/hhvm/CMake
+%{_libdir}/hhvm/hphpize