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
8 %bcond_without system_libzip # system libzip
16 # - hphp/runtime/base/runtime-option.cpp evalJitDefault enables jit if /.hhvm-jit exists (yes, in filesystem root)
18 # must be in sync with source. extra check ensuring that it is so is done in %%build
19 %define hhvm_api_version 20140829
20 # hphp/system/idl/constants.idl.json defines it as 5.6.99-hhvm, but use some saner value
21 %define php_version 5.6.0
24 %define githash e0c98e21167b425dddf1fc9efe78c9f7a36db268
25 # these hashes are git submodules (be sure to check them on proper branch)
26 %define thirdparty fdef620
28 Summary: Virtual Machine, Runtime, and JIT for PHP
32 License: PHP 3.01 and BSD
33 Group: Development/Languages
34 Source0: https://github.com/facebook/hhvm/archive/HHVM-%{version}.tar.gz
35 # Source0-md5: bab9490837ff4f54f295bbcf428d7a1c
36 Source2: https://github.com/facebook/folly/archive/%{folly}/folly-3.2-%{folly}.tar.gz
37 # Source2-md5: c4bdbea4c0ffe0650d12d9ff370b8255
38 Source3: https://github.com/hhvm/hhvm-third-party/archive/%{thirdparty}/third_party-%{thirdparty}.tar.gz
39 # Source3-md5: 63858096c50c172d6c45ddb3d9b6d721
40 Source5: %{name}-fcgi.init
41 Source6: %{name}-fcgi.sysconfig
43 Source100: get-source.sh
44 Patch1: no-debug.patch
47 Patch4: system-thirdparty.patch
48 URL: https://github.com/facebook/hhvm/wiki
49 BuildRequires: ImageMagick-devel
50 BuildRequires: a52dec-libs-devel
51 BuildRequires: apr-devel
52 BuildRequires: autoconf
53 BuildRequires: binutils-devel
54 # CMake/HPHPFindLibs.cmake:364 - FIND_LIBRARY (BFD_LIB libbfd.a)
55 BuildRequires: binutils-static
56 BuildRequires: boost-devel >= 1.50
57 BuildRequires: cmake >= 2.8.5
58 BuildRequires: curl-devel >= 7.29.0
59 %{?with_system_dconv:BuildRequires: double-conversion-devel >= 1.1.1}
60 BuildRequires: elfutils-devel
61 BuildRequires: expat-devel
62 %{?with_system_fastlz:BuildRequires: fastlz-devel >= 0.1.0-0.r12}
63 BuildRequires: gcc >= 6:4.6.0
64 BuildRequires: gd-devel
65 BuildRequires: glog-devel >= 0.3.2
66 BuildRequires: imap-devel >= 1:2007
67 #BuildRequires: jemalloc-devel >= 3.0.0
68 %{?with_system_libafdt:BuildRequires: libafdt-devel >= 0.1.0}
69 %{?with_system_libzip:BuildRequires: libzip-devel >= 0.11.2}
70 BuildRequires: libcap-devel
71 BuildRequires: libdwarf-devel >= 20130729
72 BuildRequires: libicu-devel >= 4.2
73 #BuildRequires: libmbfl-devel
74 BuildRequires: libmcrypt-devel
75 BuildRequires: libmemcached-devel >= 1.0.4
76 BuildRequires: libstdc++-devel >= 6:4.8
77 BuildRequires: libunwind-devel
78 BuildRequires: libxml2-devel
79 BuildRequires: libxslt-devel
80 %{?with_system_lz4:BuildRequires: lz4-devel >= 0.0-1.r119}
81 BuildRequires: mysql-devel
82 BuildRequires: ocaml-findlib
83 BuildRequires: oniguruma-devel
84 BuildRequires: openssl-devel
85 BuildRequires: pcre-devel >= 8.32
86 #BuildRequires: php-xhp-devel >= 1.3.9-6
87 BuildRequires: readline-devel
88 BuildRequires: rpmbuild(macros) >= 1.675
89 %{?with_system_sqlite:BuildRequires: sqlite3-devel >= 3.7.15.2}
90 BuildRequires: tbb-devel >= 4.0.6000
91 BuildRequires: zlib-devel
92 # check later, seem unused
93 #BuildRequires: bison >= 2.3
94 #BuildRequires: flex >= 2.5.35
95 #BuildRequires: libafdt-devel >= 0.1.0
96 #BuildRequires: re2c >= 0.13.0
97 Provides: %{name}(api) = %{hhvm_api_version}
98 Provides: php(core) = %{php_version}
99 # foreach (get_loaded_extensions() as $ext) printf("Provides:\tphp(%s)\n", strtolower($ext));
101 Provides: php(bcmath)
103 Provides: php(calendar)
107 Provides: php(debugger)
112 Provides: php(fileinfo)
113 Provides: php(filter)
116 Provides: php(gettext)
120 Provides: php(hhvm.debugger)
121 Provides: php(hhvm.ini)
122 Provides: php(hotprofiler)
125 Provides: php(imagick)
130 Provides: php(libxml)
132 Provides: php(mailparse)
133 Provides: php(mbstring)
134 Provides: php(mcrypt)
135 Provides: php(memcache)
136 Provides: php(memcached)
138 Provides: php(mysqli)
140 Provides: php(openssl)
143 Provides: php(pcre_zend_compat)
145 Provides: php(pdo_mysql)
146 Provides: php(pdo_sqlite)
150 Provides: php(reflection)
151 Provides: php(server)
152 Provides: php(session)
153 Provides: php(simplexml)
155 Provides: php(sockets)
157 Provides: php(sqlite3)
158 Provides: php(standard)
159 Provides: php(standard_zend_compat)
160 Provides: php(stream)
161 Provides: php(sysvmsg)
162 Provides: php(sysvsem)
163 Provides: php(sysvshm)
164 Provides: php(thread)
165 Provides: php(thrift_protocol)
166 Provides: php(tokenizer)
170 Provides: php(xhprof)
172 Provides: php(xmlreader)
173 Provides: php(xmlwriter)
178 Obsoletes: hiphop-php < 2.3.2-0.2
179 ExclusiveArch: %{x8664}
180 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
183 %define hhvm_extensiondir %{_libdir}/hhvm
186 HHVM (aka the HipHop Virtual Machine) is a new open-source virtual
187 machine designed for executing programs written in PHP. HHVM uses a
188 just-in-time compilation approach to achieve superior performance
189 while maintaining the flexibility that PHP developers are accustomed
190 to. To date, HHVM (and its predecessor HPHPc before it) has realized
191 over a 9x increase in web request throughput and over a 5x reduction
192 in memory consumption for Facebook compared with the Zend PHP 5.2
195 HHVM can be run as a standalone webserver (i.e. without the Apache
196 webserver and the "mod_php" extension). HHVM can also be used together
197 with a FastCGI-based webserver, and work is in progress to make HHVM
198 work smoothly with Apache.
201 Summary: Init script to start HHVM as FastCGI daemon
202 Group: Development/Languages/PHP
203 Requires: %{name} = %{version}-%{release}
205 Requires(post,preun): /sbin/chkconfig
209 Init script to start HHVM as FastCGI daemon
212 Summary: /usr/bin/php symlink
213 Summary(pl.UTF-8): Dowiązanie symboliczne /usr/bin/php
214 Group: Development/Languages/PHP
215 Requires: %{name} = %{version}-%{release}
216 Obsoletes: /usr/bin/php
219 Package providing /usr/bin/php symlink to PHP CLI.
221 %description program -l pl.UTF-8
222 Pakiet dostarczający dowiązanie symboliczne /usr/bin/php do PHP CLI.
225 Summary: Files for HHVM modules development
226 Group: Development/Languages/PHP
227 URL: https://github.com/facebook/hhvm/wiki/Extension-API
228 Requires: boost-devel >= 1.50
229 Requires: cmake >= 2.8.5
230 Requires: glog-devel >= 0.3.2
231 Requires: libstdc++-devel >= 6:4.3
232 Requires: tbb-devel >= 4.0.6000
236 HHVM provides a set of APIs for adding built-in functionality to the
237 runtime either by way of pure PHP code, or a combination of PHP and
241 %setup -q -n %{name}-HHVM-%{version} -a2 -a3
243 # handle git submodules
245 mv hhvm-third-party-* third-party
246 rmdir third-party/folly/src
247 mv folly-* third-party/folly/src
254 # prefer ones from system
255 rm CMake/FindBISON.cmake
256 rm CMake/FindFLEX.cmake
257 rm CMake/FindFreetype.cmake
259 # ensure system libs get used
260 # NOTE: keep sqlite dir, build breaks with 3.8.5.0
264 %{?with_system_lz4:lz4} \
265 %{?with_system_dconv:double-conversion} \
266 %{?with_system_fastlz:fastlz} \
267 %{?with_system_libafdt:libafdt} \
268 %{?with_system_libzip:libzip} \
272 # also in: hphp/tools/hphpize/hphpize.cmake
273 API=$(awk '/#define HHVM_API_VERSION/{v=$3; sub(/L$/, "", v); print v}' hphp/runtime/ext/extension.h)
275 if [ $API != %{hhvm_api_version} ]; then
276 echo "Set %%define hhvm_api_version to $API and re-run."
280 # out of dir build broken (can't find it's tools, or headers)
284 # handle cmake & ccache
285 # http://stackoverflow.com/questions/1815688/how-to-use-ccache-with-cmake
286 # ASM fix: http://lists.busybox.net/pipermail/buildroot/2013-March/069436.html
287 if [[ "%{__cc}" = *ccache* ]]; then
291 -DCMAKE_C_COMPILER="ccache" -DCMAKE_C_COMPILER_ARG1="${cc#ccache }" \
292 -DCMAKE_CXX_COMPILER="ccache" -DCMAKE_CXX_COMPILER_ARG1="${cxx#ccache }" \
293 -DCMAKE_ASM_COMPILER="${cc#ccache }" \
299 -DCMAKE_PREFIX_PATH=%{_prefix} \
300 -DHHVM_DYNAMIC_EXTENSION_DIR=%{hhvm_extensiondir} \
305 %{?with_system_sqlite:-DSYSTEM_SQLITE3=ON} \
306 %{?with_system_lz4:-DSYSTEM_LZ4=ON} \
307 %{?with_system_dconv:-DSYSTEM_DOUBLE_CONVERSION=ON} \
308 %{?with_system_fastlz:-DSYSTEM_FASTLZ=ON} \
309 %{?with_system_libafdt:-DSYSTEM_LIBAFDT=ON} \
310 %{?with_system_libzip:-DSYSTEM_LIBZIP=ON} \
314 # setup COMPILER_ID/HHVM_REPO_SCHEMA so it doesn't look it up from our package git repo
315 # see hphp/util/generate-buildinfo.sh
316 export COMPILER_ID=HHVM-%{version}-%{release}-g%{githash}
317 export HHVM_REPO_SCHEMA=$(date +%N_%s)
322 # make install relinks all outputs which is very slow,
323 # so to speedup rebuild, use timestamps to record states
324 #test %{_specdir}/%{name}.spec -nt makeinstall.stamp && %{__rm} -f makeinstall.stamp
325 if [ ! -f makeinstall.stamp -o ! -d $RPM_BUILD_ROOT ]; then
326 rm -rf makeinstall.stamp installed.stamp $RPM_BUILD_ROOT
329 DESTDIR=$RPM_BUILD_ROOT
331 touch makeinstall.stamp
334 rm -rf $RPM_BUILD_ROOT%{_docdir}
335 if [ ! -f installed.stamp ]; then
336 # begin install block
338 install -d $RPM_BUILD_ROOT{%{_sysconfdir}/%{name},%{_libdir}/%{name}}
339 cp -p %{SOURCE7} $RPM_BUILD_ROOT%{_sysconfdir}/%{name}
341 ln -s hhvm $RPM_BUILD_ROOT%{_bindir}/php
342 ln -s hhvm $RPM_BUILD_ROOT%{_bindir}/hphp
344 install -d $RPM_BUILD_ROOT%{_datadir}/%{name}/hdf
345 cp -p hphp/doc/mime.hdf $RPM_BUILD_ROOT%{_datadir}/%{name}/hdf/static.mime-types.hdf
347 # install fastcgi initscript
348 install -d $RPM_BUILD_ROOT/etc/{sysconfig,rc.d/init.d}
349 cp -p %{SOURCE5} $RPM_BUILD_ROOT/etc/rc.d/init.d/%{name}-fcgi
350 cp -p %{SOURCE6} $RPM_BUILD_ROOT/etc/sysconfig/%{name}-fcgi
352 install -p hphp/hack/bin/hh_{server,client} $RPM_BUILD_ROOT%{_bindir}
356 install -d $RPM_BUILD_ROOT%{_datadir}/cmake/Modules
357 cp -p CMake/*.cmake $RPM_BUILD_ROOT%{_datadir}/cmake/Modules
361 /HHVM_INCLUDE_DIRS/ s,$HPHP_HOME,%{_includedir},g
362 " hphp/tools/hphpize/hphpize.cmake > $RPM_BUILD_ROOT%{_datadir}/cmake/Modules/hphpize.cmake
366 set -- $(sed -ne 's/set(HHVM_INCLUDE_DIRS "\(.*\)")/\1/p' hphp/tools/hphpize/hphpize.cmake)
370 [[ "$dir" = $HPHP_HOME/hphp/* ]] && echo $dir
376 $HPHP_HOME/hphp/runtime \
377 $HPHP_HOME/hphp/util \
378 $HPHP_HOME/hphp/neo \
379 $HPHP_HOME/hphp/system \
380 $HPHP_HOME/hphp/parser \
382 echo "D %{_includedir}${dir#$HPHP_HOME}"
383 find $dir -name '*.h' | while read path; do
384 file=%{_includedir}${path#$HPHP_HOME}
386 install -Dp $path $RPM_BUILD_ROOT$file
392 # end of install block
393 touch installed.stamp; fi
396 rm -rf $RPM_BUILD_ROOT
398 %post -p /sbin/ldconfig
399 %postun -p /sbin/ldconfig
402 /sbin/chkconfig --add %{name}-fcgi
403 %service %{name}-fcgi restart
406 if [ "$1" = "0" ]; then
407 %service -q %{name}-fcgi stop
408 /sbin/chkconfig --del %{name}-fcgi
412 %defattr(644,root,root,755)
413 %doc README.md hphp/NEWS
414 %dir %{_sysconfdir}/%{name}
415 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/%{name}/php.ini
416 %attr(755,root,root) %{_bindir}/hhvm
417 %attr(755,root,root) %{_bindir}/hphp
418 %attr(755,root,root) %{_bindir}/hh_client
419 %attr(755,root,root) %{_bindir}/hh_server
421 %dir %{_datadir}/%{name}
422 %dir %{_datadir}/%{name}/hdf
423 %{_datadir}/%{name}/hdf/static.mime-types.hdf
426 %dir %{_libdir}/%{name}
429 %defattr(644,root,root,755)
430 %attr(754,root,root) /etc/rc.d/init.d/%{name}-fcgi
431 %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/%{name}-fcgi
434 %defattr(644,root,root,755)
435 %attr(755,root,root) %{_bindir}/php
438 %defattr(644,root,root,755)
439 %attr(755,root,root) %{_bindir}/hphpize
442 %{_libdir}/hhvm/CMake
443 %{_libdir}/hhvm/hphpize