3 %bcond_without system_dconv # system double-conversion
4 %bcond_without system_sqlite # system sqlite3
5 %bcond_without system_lz4 # system lz4
6 %bcond_without system_fastlz # system fastlz
7 %bcond_without system_libafdt # system libafdt
15 # - hphp/runtime/base/runtime-option.cpp evalJitDefault enables jit if /.hhvm-jit exists (yes, in filesystem root)
18 %define githash e0c98e21167b425dddf1fc9efe78c9f7a36db268
19 # these hashes are git submodules (be sure to check them on proper branch)
20 %define thirdparty fdef620
22 Summary: Virtual Machine, Runtime, and JIT for PHP
26 License: PHP 3.01 and BSD
27 Group: Development/Languages
28 Source0: https://github.com/facebook/hhvm/archive/HHVM-%{version}.tar.gz
29 # Source0-md5: bab9490837ff4f54f295bbcf428d7a1c
30 Source2: https://github.com/facebook/folly/archive/%{folly}/folly-3.2-%{folly}.tar.gz
31 # Source2-md5: c4bdbea4c0ffe0650d12d9ff370b8255
32 Source3: https://github.com/hhvm/hhvm-third-party/archive/%{thirdparty}/third_party-%{thirdparty}.tar.gz
33 # Source3-md5: 63858096c50c172d6c45ddb3d9b6d721
34 Source5: %{name}-fcgi.init
35 Source6: %{name}-fcgi.sysconfig
37 Source100: get-source.sh
38 Patch1: no-debug.patch
41 Patch4: system-thirdparty.patch
42 URL: https://github.com/facebook/hhvm/wiki
43 BuildRequires: ImageMagick-devel
44 BuildRequires: a52dec-libs-devel
45 BuildRequires: apr-devel
46 BuildRequires: autoconf
47 BuildRequires: binutils-devel
48 # CMake/HPHPFindLibs.cmake:364 - FIND_LIBRARY (BFD_LIB libbfd.a)
49 BuildRequires: binutils-static
50 BuildRequires: boost-devel >= 1.50
51 BuildRequires: cmake >= 2.8.5
52 BuildRequires: curl-devel >= 7.29.0
53 %{?with_system_dconv:BuildRequires: double-conversion-devel >= 1.1.1}
54 BuildRequires: elfutils-devel
55 BuildRequires: expat-devel
56 %{?with_system_fastlz:BuildRequires: fastlz-devel >= 0.1.0-0.r12}
57 BuildRequires: gcc >= 6:4.6.0
58 BuildRequires: gd-devel
59 BuildRequires: glog-devel >= 0.3.2
60 BuildRequires: imap-devel >= 1:2007
61 #BuildRequires: jemalloc-devel >= 3.0.0
62 %{?with_system_libafdt:BuildRequires: libafdt-devel >= 0.1.0}
63 BuildRequires: libcap-devel
64 BuildRequires: libdwarf-devel >= 20130729
65 BuildRequires: libicu-devel >= 4.2
66 #BuildRequires: libmbfl-devel
67 BuildRequires: libmcrypt-devel
68 BuildRequires: libmemcached-devel >= 1.0.4
69 BuildRequires: libstdc++-devel >= 6:4.8
70 BuildRequires: libunwind-devel
71 BuildRequires: libxml2-devel
72 BuildRequires: libxslt-devel
73 %{?with_system_lz4:BuildRequires: lz4-devel >= 0.0-1.r119}
74 BuildRequires: mysql-devel
75 BuildRequires: ocaml-findlib
76 BuildRequires: oniguruma-devel
77 BuildRequires: openssl-devel
78 BuildRequires: pcre-devel >= 8.32
79 #BuildRequires: php-xhp-devel >= 1.3.9-6
80 BuildRequires: readline-devel
81 BuildRequires: rpmbuild(macros) >= 1.675
82 %{?with_system_sqlite:BuildRequires: sqlite3-devel >= 3.7.15.2}
83 BuildRequires: tbb-devel >= 4.0.6000
84 BuildRequires: zlib-devel
85 # check later, seem unused
86 #BuildRequires: bison >= 2.3
87 #BuildRequires: flex >= 2.5.35
88 #BuildRequires: libafdt-devel >= 0.1.0
89 #BuildRequires: re2c >= 0.13.0
90 Provides: %{name}(api) = %{hhvm_api_version}
91 Provides: php(core) = %{php_version}
92 # foreach (get_loaded_extensions() as $ext) printf("Provides:\tphp(%s)\n", strtolower($ext));
96 Provides: php(calendar)
100 Provides: php(debugger)
105 Provides: php(fileinfo)
106 Provides: php(filter)
109 Provides: php(gettext)
113 Provides: php(hhvm.debugger)
114 Provides: php(hhvm.ini)
115 Provides: php(hotprofiler)
118 Provides: php(imagick)
123 Provides: php(libxml)
125 Provides: php(mailparse)
126 Provides: php(mbstring)
127 Provides: php(mcrypt)
128 Provides: php(memcache)
129 Provides: php(memcached)
131 Provides: php(mysqli)
133 Provides: php(openssl)
136 Provides: php(pcre_zend_compat)
138 Provides: php(pdo_mysql)
139 Provides: php(pdo_sqlite)
143 Provides: php(reflection)
144 Provides: php(server)
145 Provides: php(session)
146 Provides: php(simplexml)
148 Provides: php(sockets)
150 Provides: php(sqlite3)
151 Provides: php(standard)
152 Provides: php(standard_zend_compat)
153 Provides: php(stream)
154 Provides: php(sysvmsg)
155 Provides: php(sysvsem)
156 Provides: php(sysvshm)
157 Provides: php(thread)
158 Provides: php(thrift_protocol)
159 Provides: php(tokenizer)
163 Provides: php(xhprof)
165 Provides: php(xmlreader)
166 Provides: php(xmlwriter)
171 Obsoletes: hiphop-php < 2.3.2-0.2
172 ExclusiveArch: %{x8664}
173 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
175 # must be in sync with source. extra check ensuring that it is so is done in %%build
176 %define hhvm_api_version 20140829
177 # hphp/system/idl/constants.idl.json defines it as 5.6.99-hhvm, but use some saner value
178 %define php_version 5.6.0
180 %define hhvm_extensiondir %{_libdir}/hhvm
183 HHVM (aka the HipHop Virtual Machine) is a new open-source virtual
184 machine designed for executing programs written in PHP. HHVM uses a
185 just-in-time compilation approach to achieve superior performance
186 while maintaining the flexibility that PHP developers are accustomed
187 to. To date, HHVM (and its predecessor HPHPc before it) has realized
188 over a 9x increase in web request throughput and over a 5x reduction
189 in memory consumption for Facebook compared with the Zend PHP 5.2
192 HHVM can be run as a standalone webserver (i.e. without the Apache
193 webserver and the "mod_php" extension). HHVM can also be used together
194 with a FastCGI-based webserver, and work is in progress to make HHVM
195 work smoothly with Apache.
198 Summary: Init script to start HHVM as FastCGI daemon
199 Group: Development/Languages/PHP
200 Requires: %{name} = %{version}-%{release}
202 Requires(post,preun): /sbin/chkconfig
206 Init script to start HHVM as FastCGI daemon
209 Summary: /usr/bin/php symlink
210 Summary(pl.UTF-8): Dowiązanie symboliczne /usr/bin/php
211 Group: Development/Languages/PHP
212 Requires: %{name} = %{version}-%{release}
213 Obsoletes: /usr/bin/php
216 Package providing /usr/bin/php symlink to PHP CLI.
218 %description program -l pl.UTF-8
219 Pakiet dostarczający dowiązanie symboliczne /usr/bin/php do PHP CLI.
222 Summary: Files for HHVM modules development
223 Group: Development/Languages/PHP
224 URL: https://github.com/facebook/hhvm/wiki/Extension-API
225 Requires: boost-devel >= 1.50
226 Requires: cmake >= 2.8.5
227 Requires: glog-devel >= 0.3.2
228 Requires: libstdc++-devel >= 6:4.3
229 Requires: tbb-devel >= 4.0.6000
233 HHVM provides a set of APIs for adding built-in functionality to the
234 runtime either by way of pure PHP code, or a combination of PHP and
238 %setup -q -n %{name}-HHVM-%{version} -a2 -a3
240 # handle git submodules
242 mv hhvm-third-party-* third-party
243 rmdir third-party/folly/src
244 mv folly-* third-party/folly/src
251 # prefer ones from system
252 rm CMake/FindBISON.cmake
253 rm CMake/FindFLEX.cmake
254 rm CMake/FindFreetype.cmake
256 # ensure system libs get used
259 %{?with_system_sqlite:libsqlite3} \
260 %{?with_system_lz4:lz4} \
261 %{?with_system_dconv:double-conversion} \
262 %{?with_system_fastlz:fastlz} \
263 %{?with_system_libafdt:libafdt} \
267 # also in: hphp/tools/hphpize/hphpize.cmake
268 API=$(awk '/#define HHVM_API_VERSION/{v=$3; sub(/L$/, "", v); print v}' hphp/runtime/ext/extension.h)
270 if [ $API != %{hhvm_api_version} ]; then
271 echo "Set %%define hhvm_api_version to $API and re-run."
275 # out of dir build broken (can't find it's tools, or headers)
279 # handle cmake & ccache
280 # http://stackoverflow.com/questions/1815688/how-to-use-ccache-with-cmake
281 # ASM fix: http://lists.busybox.net/pipermail/buildroot/2013-March/069436.html
282 if [[ "%{__cc}" = *ccache* ]]; then
286 -DCMAKE_C_COMPILER="ccache" -DCMAKE_C_COMPILER_ARG1="${cc#ccache }" \
287 -DCMAKE_CXX_COMPILER="ccache" -DCMAKE_CXX_COMPILER_ARG1="${cxx#ccache }" \
288 -DCMAKE_ASM_COMPILER="${cc#ccache }" \
294 -DCMAKE_PREFIX_PATH=%{_prefix} \
295 -DHHVM_DYNAMIC_EXTENSION_DIR=%{hhvm_extensiondir} \
300 %{?with_system_sqlite:-DSYSTEM_SQLITE3=ON} \
301 %{?with_system_lz4:-DSYSTEM_LZ4=ON} \
302 %{?with_system_dconv:-DSYSTEM_DOUBLE_CONVERSION=ON} \
303 %{?with_system_fastlz:-DSYSTEM_FASTLZ=ON} \
304 %{?with_system_libafdt:-DSYSTEM_LIBAFDT=ON} \
308 # setup COMPILER_ID/HHVM_REPO_SCHEMA so it doesn't look it up from our package git repo
309 # see hphp/util/generate-buildinfo.sh
310 export COMPILER_ID=HHVM-%{version}-%{release}-g%{githash}
311 export HHVM_REPO_SCHEMA=$(date +%N_%s)
316 # make install relinks all outputs which is very slow,
317 # so to speedup rebuild, use timestamps to record states
318 #test %{_specdir}/%{name}.spec -nt makeinstall.stamp && %{__rm} -f makeinstall.stamp
319 if [ ! -f makeinstall.stamp -o ! -d $RPM_BUILD_ROOT ]; then
320 rm -rf makeinstall.stamp installed.stamp $RPM_BUILD_ROOT
323 DESTDIR=$RPM_BUILD_ROOT
325 touch makeinstall.stamp
328 rm -rf $RPM_BUILD_ROOT%{_docdir}
329 if [ ! -f installed.stamp ]; then
330 # begin install block
332 install -d $RPM_BUILD_ROOT{%{_sysconfdir}/%{name},%{_libdir}/%{name}}
333 cp -p %{SOURCE7} $RPM_BUILD_ROOT%{_sysconfdir}/%{name}
335 ln -s hhvm $RPM_BUILD_ROOT%{_bindir}/php
336 ln -s hhvm $RPM_BUILD_ROOT%{_bindir}/hphp
338 install -d $RPM_BUILD_ROOT%{_datadir}/%{name}/hdf
339 cp -p hphp/doc/mime.hdf $RPM_BUILD_ROOT%{_datadir}/%{name}/hdf/static.mime-types.hdf
341 # install fastcgi initscript
342 install -d $RPM_BUILD_ROOT/etc/{sysconfig,rc.d/init.d}
343 cp -p %{SOURCE5} $RPM_BUILD_ROOT/etc/rc.d/init.d/%{name}-fcgi
344 cp -p %{SOURCE6} $RPM_BUILD_ROOT/etc/sysconfig/%{name}-fcgi
346 install -p hphp/hack/bin/hh_{server,client} $RPM_BUILD_ROOT%{_bindir}
350 install -d $RPM_BUILD_ROOT%{_datadir}/cmake/Modules
351 cp -p CMake/*.cmake $RPM_BUILD_ROOT%{_datadir}/cmake/Modules
355 /HHVM_INCLUDE_DIRS/ s,$HPHP_HOME,%{_includedir},g
356 " hphp/tools/hphpize/hphpize.cmake > $RPM_BUILD_ROOT%{_datadir}/cmake/Modules/hphpize.cmake
360 set -- $(sed -ne 's/set(HHVM_INCLUDE_DIRS "\(.*\)")/\1/p' hphp/tools/hphpize/hphpize.cmake)
364 [[ "$dir" = $HPHP_HOME/hphp/* ]] && echo $dir
370 $HPHP_HOME/hphp/runtime \
371 $HPHP_HOME/hphp/util \
372 $HPHP_HOME/hphp/neo \
373 $HPHP_HOME/hphp/system \
374 $HPHP_HOME/hphp/parser \
376 echo "D %{_includedir}${dir#$HPHP_HOME}"
377 find $dir -name '*.h' | while read path; do
378 file=%{_includedir}${path#$HPHP_HOME}
380 install -Dp $path $RPM_BUILD_ROOT$file
386 # end of install block
387 touch installed.stamp; fi
390 rm -rf $RPM_BUILD_ROOT
392 %post -p /sbin/ldconfig
393 %postun -p /sbin/ldconfig
396 /sbin/chkconfig --add %{name}-fcgi
397 %service %{name}-fcgi restart
400 if [ "$1" = "0" ]; then
401 %service -q %{name}-fcgi stop
402 /sbin/chkconfig --del %{name}-fcgi
406 %defattr(644,root,root,755)
407 %doc README.md hphp/NEWS
408 %dir %{_sysconfdir}/%{name}
409 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/%{name}/php.ini
410 %attr(755,root,root) %{_bindir}/hhvm
411 %attr(755,root,root) %{_bindir}/hphp
412 %attr(755,root,root) %{_bindir}/hh_client
413 %attr(755,root,root) %{_bindir}/hh_server
415 %dir %{_datadir}/%{name}
416 %dir %{_datadir}/%{name}/hdf
417 %{_datadir}/%{name}/hdf/static.mime-types.hdf
420 %dir %{_libdir}/%{name}
423 %defattr(644,root,root,755)
424 %attr(754,root,root) /etc/rc.d/init.d/%{name}-fcgi
425 %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/%{name}-fcgi
428 %defattr(644,root,root,755)
429 %attr(755,root,root) %{_bindir}/php
432 %defattr(644,root,root,755)
433 %attr(755,root,root) %{_bindir}/hphpize
436 %{_libdir}/hhvm/CMake
437 %{_libdir}/hhvm/hphpize