2 # - hphp/runtime/base/runtime-option.cpp evalJitDefault enables jit if /.hhvm-jit exists (yes, in filesystem root)
3 # - patch /usr/lib/hphp/CMake/HPHPIZEFunctions.cmake for %{_libdir}/hhvm as extension dir
5 # - system libmbfl, system xhp, sqlite3
8 %define githash e0c98e21167b425dddf1fc9efe78c9f7a36db268
9 # these hashes are git submodules
11 %define thirdparty fdef620
12 Summary: Virtual Machine, Runtime, and JIT for PHP
16 License: PHP 3.01 and BSD
17 Group: Development/Languages
18 Source0: https://github.com/facebook/hhvm/archive/HHVM-%{version}.tar.gz
19 # Source0-md5: bab9490837ff4f54f295bbcf428d7a1c
20 Source2: https://github.com/facebook/folly/archive/%{folly}/folly-3.2-%{folly}.tar.gz
21 # Source2-md5: c4bdbea4c0ffe0650d12d9ff370b8255
22 Source3: https://github.com/hhvm/hhvm-third-party/archive/%{thirdparty}/third_party-%{thirdparty}.tar.gz
23 # Source3-md5: 63858096c50c172d6c45ddb3d9b6d721
24 Source5: %{name}-fcgi.init
25 Source6: %{name}-fcgi.sysconfig
27 Source100: get-source.sh
28 Patch1: no-debug.patch
31 URL: https://github.com/facebook/hhvm/wiki
32 BuildRequires: ImageMagick-devel
33 BuildRequires: a52dec-libs-devel
34 BuildRequires: apr-devel
35 BuildRequires: autoconf
36 BuildRequires: binutils-devel
37 # CMake/HPHPFindLibs.cmake:364 - FIND_LIBRARY (BFD_LIB libbfd.a)
38 BuildRequires: binutils-static
39 BuildRequires: boost-devel >= 1.50
40 BuildRequires: cmake >= 2.8.5
41 BuildRequires: curl-devel >= 7.29.0
42 BuildRequires: elfutils-devel
43 BuildRequires: expat-devel
44 BuildRequires: gcc >= 6:4.6.0
45 BuildRequires: gd-devel
46 BuildRequires: glog-devel >= 0.3.2
47 BuildRequires: imap-devel >= 1:2007
48 #BuildRequires: jemalloc-devel >= 3.0.0
49 BuildRequires: libcap-devel
50 BuildRequires: libdwarf-devel >= 20130729
51 BuildRequires: libicu-devel >= 4.2
52 #BuildRequires: libmbfl-devel
53 BuildRequires: libmcrypt-devel
54 BuildRequires: libmemcached-devel >= 1.0.4
55 BuildRequires: libstdc++-devel >= 6:4.8
56 BuildRequires: libunwind-devel
57 BuildRequires: libxml2-devel
58 BuildRequires: libxslt-devel
59 BuildRequires: mysql-devel
60 BuildRequires: ocaml-findlib
61 BuildRequires: oniguruma-devel
62 BuildRequires: openssl-devel
63 BuildRequires: pcre-devel
64 #BuildRequires: php-xhp-devel >= 1.3.9-6
65 BuildRequires: readline-devel
66 BuildRequires: rpmbuild(macros) >= 1.675
67 BuildRequires: tbb-devel >= 4.0.6000
68 BuildRequires: zlib-devel
69 # check later, seem unused
70 #BuildRequires: bison >= 2.3
71 #BuildRequires: flex >= 2.5.35
72 #BuildRequires: libafdt-devel >= 0.1.0
73 #BuildRequires: re2c >= 0.13.0
74 # foreach (get_loaded_extensions() as $ext) printf("Provides:\tphp(%s)\n", strtolower($ext));
75 Provides: %{name}(api) = %{hhvm_api_version}
80 Provides: php(calendar)
81 Provides: php(core) = %{php_version}
85 Provides: php(debugger)
89 Provides: php(fileinfo)
93 Provides: php(gettext)
96 Provides: php(hhvm.debugger)
97 Provides: php(hhvm.ini)
98 Provides: php(hotprofiler)
101 Provides: php(imagick)
106 Provides: php(libxml)
107 Provides: php(mbstring)
108 Provides: php(mcrypt)
109 Provides: php(memcache)
110 Provides: php(memcached)
113 Provides: php(mysqli)
115 Provides: php(openssl)
118 Provides: php(pcre_zend_compat)
120 Provides: php(pdo_mysql)
121 Provides: php(pdo_sqlite)
125 Provides: php(reflection)
126 Provides: php(server)
127 Provides: php(session)
128 Provides: php(simplexml)
130 Provides: php(sockets)
132 Provides: php(sqlite3)
133 Provides: php(standard)
134 Provides: php(standard_zend_compat)
135 Provides: php(stream)
136 Provides: php(sysvmsg)
137 Provides: php(sysvsem)
138 Provides: php(sysvshm)
139 Provides: php(thread)
140 Provides: php(thrift_protocol)
141 Provides: php(tokenizer)
145 Provides: php(xhprof)
147 Provides: php(xmlreader)
148 Provides: php(xmlwriter)
153 Obsoletes: hiphop-php < 2.3.2-0.2
154 ExclusiveArch: %{x8664}
155 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
157 # must be in sync with source. extra check ensuring that it is so is done in %%build
158 %define hhvm_api_version 20140829
159 # hphp/system/idl/constants.idl.json defines it as 5.6.99-hhvm, but use some saner value
160 %define php_version 5.6.0
162 %define hhvm_extensiondir %{_libdir}/hhvm
165 HHVM (aka the HipHop Virtual Machine) is a new open-source virtual
166 machine designed for executing programs written in PHP. HHVM uses a
167 just-in-time compilation approach to achieve superior performance
168 while maintaining the flexibility that PHP developers are accustomed
169 to. To date, HHVM (and its predecessor HPHPc before it) has realized
170 over a 9x increase in web request throughput and over a 5x reduction
171 in memory consumption for Facebook compared with the Zend PHP 5.2
174 HHVM can be run as a standalone webserver (i.e. without the Apache
175 webserver and the "mod_php" extension). HHVM can also be used together
176 with a FastCGI-based webserver, and work is in progress to make HHVM
177 work smoothly with Apache.
180 Summary: Init script to start HHVM as FastCGI daemon
181 Group: Development/Languages/PHP
182 Requires: %{name} = %{version}-%{release}
184 Requires(post,preun): /sbin/chkconfig
188 Init script to start HHVM as FastCGI daemon
191 Summary: /usr/bin/php symlink
192 Summary(pl.UTF-8): Dowiązanie symboliczne /usr/bin/php
193 Group: Development/Languages/PHP
194 Requires: %{name} = %{version}-%{release}
195 Obsoletes: /usr/bin/php
198 Package providing /usr/bin/php symlink to PHP CLI.
200 %description program -l pl.UTF-8
201 Pakiet dostarczający dowiązanie symboliczne /usr/bin/php do PHP CLI.
204 Summary: Files for HHVM modules development
205 Group: Development/Languages/PHP
206 URL: https://github.com/facebook/hhvm/wiki/Extension-API
207 Requires: boost-devel >= 1.50
208 Requires: cmake >= 2.8.5
209 Requires: glog-devel >= 0.3.2
210 Requires: libstdc++-devel >= 6:4.3
211 Requires: tbb-devel >= 4.0.6000
215 HHVM provides a set of APIs for adding built-in functionality to the
216 runtime either by way of pure PHP code, or a combination of PHP and
220 %setup -q -n %{name}-HHVM-%{version} -a2 -a3
222 # handle git submodules
224 mv hhvm-third-party-* third-party
225 rmdir third-party/folly/src
226 mv folly-* third-party/folly/src
232 # prefer ones from system
233 rm CMake/FindBISON.cmake
234 rm CMake/FindFLEX.cmake
235 rm CMake/FindFreetype.cmake
238 # also in: hphp/tools/hphpize/hphpize.cmake
239 API=$(awk '/#define HHVM_API_VERSION/{v=$3; sub(/L$/, "", v); print v}' hphp/runtime/ext/extension.h)
241 if [ $API != %{hhvm_api_version} ]; then
242 echo "Set %%define hhvm_api_version to $API and re-run."
246 # out of dir build broken (can't find it's tools, or headers)
250 # handle cmake & ccache
251 # http://stackoverflow.com/questions/1815688/how-to-use-ccache-with-cmake
252 # ASM fix: http://lists.busybox.net/pipermail/buildroot/2013-March/069436.html
253 if [[ "%{__cc}" = *ccache* ]]; then
257 -DCMAKE_C_COMPILER="ccache" -DCMAKE_C_COMPILER_ARG1="${cc#ccache }" \
258 -DCMAKE_CXX_COMPILER="ccache" -DCMAKE_CXX_COMPILER_ARG1="${cxx#ccache }" \
259 -DCMAKE_ASM_COMPILER="${cc#ccache }" \
265 -DCMAKE_PREFIX_PATH=%{_prefix} \
266 -DHHVM_DYNAMIC_EXTENSION_DIR=%{hhvm_extensiondir} \
273 # setup COMPILER_ID/HHVM_REPO_SCHEMA so it doesn't look it up from our package git repo
274 # see hphp/util/generate-buildinfo.sh
275 export COMPILER_ID=HHVM-%{version}-%{release}-g%{githash}
276 export HHVM_REPO_SCHEMA=$(date +%N_%s)
281 # make install relinks all outputs which is very slow,
282 # so to speedup rebuild, use timestamps to record states
283 #test %{_specdir}/%{name}.spec -nt makeinstall.stamp && %{__rm} -f makeinstall.stamp
284 if [ ! -f makeinstall.stamp -o ! -d $RPM_BUILD_ROOT ]; then
285 rm -rf makeinstall.stamp installed.stamp $RPM_BUILD_ROOT
288 DESTDIR=$RPM_BUILD_ROOT
290 touch makeinstall.stamp
293 rm -rf $RPM_BUILD_ROOT%{_docdir}
294 if [ ! -f installed.stamp ]; then
295 # begin install block
297 install -d $RPM_BUILD_ROOT{%{_sysconfdir}/%{name},%{_libdir}/%{name}}
298 cp -p %{SOURCE7} $RPM_BUILD_ROOT%{_sysconfdir}/%{name}
300 ln -s hhvm $RPM_BUILD_ROOT%{_bindir}/php
301 ln -s hhvm $RPM_BUILD_ROOT%{_bindir}/hphp
303 install -d $RPM_BUILD_ROOT%{_datadir}/%{name}/hdf
304 cp -p hphp/doc/mime.hdf $RPM_BUILD_ROOT%{_datadir}/%{name}/hdf/static.mime-types.hdf
306 # install fastcgi initscript
307 install -d $RPM_BUILD_ROOT/etc/{sysconfig,rc.d/init.d}
308 cp -p %{SOURCE5} $RPM_BUILD_ROOT/etc/rc.d/init.d/%{name}-fcgi
309 cp -p %{SOURCE6} $RPM_BUILD_ROOT/etc/sysconfig/%{name}-fcgi
311 install -p hphp/hack/bin/hh_{server,client} $RPM_BUILD_ROOT%{_bindir}
315 install -d $RPM_BUILD_ROOT%{_datadir}/cmake/Modules
316 cp -p CMake/*.cmake $RPM_BUILD_ROOT%{_datadir}/cmake/Modules
320 /HHVM_INCLUDE_DIRS/ s,$HPHP_HOME,%{_includedir},g
321 " hphp/tools/hphpize/hphpize.cmake > $RPM_BUILD_ROOT%{_datadir}/cmake/Modules/hphpize.cmake
325 set -- $(sed -ne 's/set(HHVM_INCLUDE_DIRS "\(.*\)")/\1/p' hphp/tools/hphpize/hphpize.cmake)
329 [[ "$dir" = $HPHP_HOME/hphp/* ]] && echo $dir
335 $HPHP_HOME/hphp/runtime \
336 $HPHP_HOME/hphp/util \
337 $HPHP_HOME/hphp/neo \
338 $HPHP_HOME/hphp/system \
339 $HPHP_HOME/hphp/parser \
341 echo "D %{_includedir}${dir#$HPHP_HOME}"
342 find $dir -name '*.h' | while read path; do
343 file=%{_includedir}${path#$HPHP_HOME}
345 install -Dp $path $RPM_BUILD_ROOT$file
351 # end of install block
352 touch installed.stamp; fi
355 rm -rf $RPM_BUILD_ROOT
357 %post -p /sbin/ldconfig
358 %postun -p /sbin/ldconfig
361 /sbin/chkconfig --add %{name}-fcgi
362 %service %{name}-fcgi restart
365 if [ "$1" = "0" ]; then
366 %service -q %{name}-fcgi stop
367 /sbin/chkconfig --del %{name}-fcgi
371 %defattr(644,root,root,755)
372 %doc README.md hphp/NEWS
373 %dir %{_sysconfdir}/%{name}
374 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/%{name}/php.ini
375 %attr(755,root,root) %{_bindir}/hhvm
376 %attr(755,root,root) %{_bindir}/hphp
377 %attr(755,root,root) %{_bindir}/hh_client
378 %attr(755,root,root) %{_bindir}/hh_server
380 %dir %{_datadir}/%{name}
381 %dir %{_datadir}/%{name}/hdf
382 %{_datadir}/%{name}/hdf/static.mime-types.hdf
385 %dir %{_libdir}/%{name}
388 %defattr(644,root,root,755)
389 %attr(754,root,root) /etc/rc.d/init.d/%{name}-fcgi
390 %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/%{name}-fcgi
393 %defattr(644,root,root,755)
394 %attr(755,root,root) %{_bindir}/php
397 %defattr(644,root,root,755)
398 %attr(755,root,root) %{_bindir}/hphpize
401 %{_libdir}/hhvm/CMake
402 %{_libdir}/hhvm/hphpize