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