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
9 # cotire breaks sqlite3 on builders: https://github.com/facebook/hhvm/issues/4524
10 %bcond_with cotire # cotire (compile time reducer): Speed up the build by precompiling headers
16 # - system LIBAFDT_LIBRARY
19 # - hphp/runtime/base/runtime-option.cpp evalJitDefault enables jit if /.hhvm-jit exists (yes, in filesystem root)
21 # must be in sync with source. extra check ensuring that it is so is done in %%build
22 %define hhvm_api_version 20140829
23 # hphp/system/idl/constants.idl.json defines it as 5.6.99-hhvm, but use some saner value
24 %define php_version 5.6.0
27 %define githash 54b5f51c3670fe55852b6dab17a47c67b2271116
28 # these hashes are git submodules (be sure to check them on proper branch)
29 # GIT_DIR=third-party/.git git log -1
30 %define thirdparty bf581f8
31 # 6e46d468cf2876dd59c7a4dddcb4e37abf070b7a
32 # GIT_DIR=third-party/folly/src/.git git log -1
34 Summary: Virtual Machine, Runtime, and JIT for PHP
36 # we prefer LTS versions
37 # see http://hhvm.com/blog/6083/hhvm-long-term-support
40 License: PHP 3.01 and BSD
41 Group: Development/Languages
42 Source0: https://github.com/facebook/hhvm/archive/HHVM-%{version}.tar.gz
43 # Source0-md5: 89c620e2df253530a4f6f1a185ec913a
44 Source2: https://github.com/facebook/folly/archive/%{folly}/folly-3.2-%{folly}.tar.gz
45 # Source2-md5: c4bdbea4c0ffe0650d12d9ff370b8255
46 Source3: https://github.com/hhvm/hhvm-third-party/archive/%{thirdparty}/third_party-%{thirdparty}.tar.gz
47 # Source3-md5: 17210db0b2211c63d911076e02aab487
48 Source5: %{name}-fcgi.init
49 Source6: %{name}-fcgi.sysconfig
51 Source100: get-source.sh
52 Patch1: no-debug.patch
55 Patch4: system-thirdparty.patch
57 URL: https://github.com/facebook/hhvm/wiki
58 BuildRequires: ImageMagick-devel
59 BuildRequires: a52dec-libs-devel
60 BuildRequires: apr-devel
61 BuildRequires: autoconf
62 BuildRequires: binutils-devel
63 # CMake/HPHPFindLibs.cmake:364 - FIND_LIBRARY (BFD_LIB libbfd.a)
64 BuildRequires: binutils-static
65 BuildRequires: boost-devel >= 1.50
66 BuildRequires: cmake >= 2.8.5
67 BuildRequires: curl-devel >= 7.29.0
68 %{?with_system_dconv:BuildRequires: double-conversion-devel >= 1.1.1}
69 BuildRequires: elfutils-devel
70 BuildRequires: expat-devel
71 %{?with_system_fastlz:BuildRequires: fastlz-devel >= 0.1.0-0.r12}
72 BuildRequires: gcc >= 6:4.6.0
73 BuildRequires: gd-devel
74 BuildRequires: glog-devel >= 0.3.2
75 BuildRequires: imap-devel >= 1:2007
76 #BuildRequires: jemalloc-devel >= 3.0.0
77 %{?with_system_libafdt:BuildRequires: libafdt-devel >= 0.1.0}
78 %{?with_system_libzip:BuildRequires: libzip-devel >= 0.11.2}
79 BuildRequires: libcap-devel
80 BuildRequires: libdwarf-devel >= 20130729
81 BuildRequires: libicu-devel >= 4.2
82 #BuildRequires: libmbfl-devel
83 BuildRequires: libmcrypt-devel
84 BuildRequires: libmemcached-devel >= 1.0.4
85 BuildRequires: libstdc++-devel >= 6:4.8
86 BuildRequires: libunwind-devel
87 BuildRequires: libxml2-devel
88 BuildRequires: libxslt-devel
89 %{?with_system_lz4:BuildRequires: lz4-devel >= 0.0-1.r119}
90 BuildRequires: mysql-devel
91 BuildRequires: ocaml-findlib
92 BuildRequires: oniguruma-devel
93 BuildRequires: openssl-devel
94 BuildRequires: pcre-devel >= 8.32
95 #BuildRequires: php-xhp-devel >= 1.3.9-6
96 BuildRequires: readline-devel
97 BuildRequires: rpmbuild(macros) >= 1.675
98 %{?with_system_sqlite:BuildRequires: sqlite3-devel >= 3.7.15.2}
99 BuildRequires: tbb-devel >= 4.0.6000
100 BuildRequires: zlib-devel
101 # check later, seem unused
102 #BuildRequires: bison >= 2.3
103 #BuildRequires: flex >= 2.5.35
104 #BuildRequires: libafdt-devel >= 0.1.0
105 #BuildRequires: re2c >= 0.13.0
106 Provides: %{name}(api) = %{hhvm_api_version}
107 Provides: php(core) = %{php_version}
108 # foreach (get_loaded_extensions() as $ext) printf("Provides:\tphp(%s)\n", strtolower($ext));
110 Provides: php(bcmath)
112 Provides: php(calendar)
116 Provides: php(debugger)
121 Provides: php(fileinfo)
122 Provides: php(filter)
125 Provides: php(gettext)
129 Provides: php(hhvm.debugger)
130 Provides: php(hhvm.ini)
131 Provides: php(hotprofiler)
134 Provides: php(imagick)
139 Provides: php(libxml)
141 Provides: php(mailparse)
142 Provides: php(mbstring)
143 Provides: php(mcrypt)
144 Provides: php(memcache)
145 Provides: php(memcached)
147 Provides: php(mysqli)
149 Provides: php(openssl)
152 Provides: php(pcre_zend_compat)
154 Provides: php(pdo_mysql)
155 Provides: php(pdo_sqlite)
159 Provides: php(reflection)
160 Provides: php(server)
161 Provides: php(session)
162 Provides: php(simplexml)
164 Provides: php(sockets)
166 Provides: php(sqlite3)
167 Provides: php(standard)
168 Provides: php(standard_zend_compat)
169 Provides: php(stream)
170 Provides: php(sysvmsg)
171 Provides: php(sysvsem)
172 Provides: php(sysvshm)
173 Provides: php(thread)
174 Provides: php(thrift_protocol)
175 Provides: php(tokenizer)
179 Provides: php(xhprof)
181 Provides: php(xmlreader)
182 Provides: php(xmlwriter)
187 Obsoletes: hiphop-php < 2.3.2-0.2
188 ExclusiveArch: %{x8664}
189 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
192 %define hhvm_extensiondir %{_libdir}/hhvm
195 HHVM (aka the HipHop Virtual Machine) is a new open-source virtual
196 machine designed for executing programs written in PHP. HHVM uses a
197 just-in-time compilation approach to achieve superior performance
198 while maintaining the flexibility that PHP developers are accustomed
199 to. To date, HHVM (and its predecessor HPHPc before it) has realized
200 over a 9x increase in web request throughput and over a 5x reduction
201 in memory consumption for Facebook compared with the Zend PHP 5.2
204 HHVM can be run as a standalone webserver (i.e. without the Apache
205 webserver and the "mod_php" extension). HHVM can also be used together
206 with a FastCGI-based webserver, and work is in progress to make HHVM
207 work smoothly with Apache.
210 Summary: Init script to start HHVM as FastCGI daemon
211 Group: Development/Languages/PHP
212 Requires: %{name} = %{version}-%{release}
214 Requires(post,preun): /sbin/chkconfig
218 Init script to start HHVM as FastCGI daemon
221 Summary: /usr/bin/php symlink
222 Summary(pl.UTF-8): Dowiązanie symboliczne /usr/bin/php
223 Group: Development/Languages/PHP
224 Requires: %{name} = %{version}-%{release}
225 Obsoletes: /usr/bin/php
228 Package providing /usr/bin/php symlink to PHP CLI.
230 %description program -l pl.UTF-8
231 Pakiet dostarczający dowiązanie symboliczne /usr/bin/php do PHP CLI.
234 Summary: Files for HHVM modules development
235 Group: Development/Languages/PHP
236 URL: https://github.com/facebook/hhvm/wiki/Extension-API
237 Requires: boost-devel >= 1.50
238 Requires: cmake >= 2.8.5
239 Requires: glog-devel >= 0.3.2
240 Requires: libstdc++-devel >= 6:4.3
241 Requires: tbb-devel >= 4.0.6000
245 HHVM provides a set of APIs for adding built-in functionality to the
246 runtime either by way of pure PHP code, or a combination of PHP and
250 %setup -q -n %{name}-HHVM-%{version} -a2 -a3
252 # handle git submodules
254 mv hhvm-third-party-* third-party
255 rmdir third-party/folly/src
256 mv folly-* third-party/folly/src
264 # prefer ones from system
265 rm CMake/FindBISON.cmake
266 rm CMake/FindFLEX.cmake
267 rm CMake/FindFreetype.cmake
269 # ensure system libs get used
270 # NOTE: keep sqlite dir, build breaks with 3.8.5.0
274 %{?with_system_lz4:lz4} \
275 %{?with_system_dconv:double-conversion} \
276 %{?with_system_fastlz:fastlz} \
277 %{?with_system_libafdt:libafdt} \
278 %{?with_system_libzip:libzip} \
282 # also in: hphp/tools/hphpize/hphpize.cmake
283 API=$(awk '/#define HHVM_API_VERSION/{v=$3; sub(/L$/, "", v); print v}' hphp/runtime/ext/extension.h)
285 if [ $API != %{hhvm_api_version} ]; then
286 echo "Set %%define hhvm_api_version to $API and re-run."
290 # out of dir build broken (can't find it's tools, or headers)
294 # handle cmake & ccache
295 # http://stackoverflow.com/questions/1815688/how-to-use-ccache-with-cmake
296 # ASM fix: http://lists.busybox.net/pipermail/buildroot/2013-March/069436.html
297 if [[ "%{__cc}" = *ccache* ]]; then
301 -DCMAKE_C_COMPILER="ccache" -DCMAKE_C_COMPILER_ARG1="${cc#ccache }" \
302 -DCMAKE_CXX_COMPILER="ccache" -DCMAKE_CXX_COMPILER_ARG1="${cxx#ccache }" \
303 -DCMAKE_ASM_COMPILER="${cc#ccache }" \
309 -DCMAKE_PREFIX_PATH=%{_prefix} \
310 -DHHVM_DYNAMIC_EXTENSION_DIR=%{hhvm_extensiondir} \
315 %{?with_system_sqlite:-DLIBSQLITE3_LIBRARY=OFF} \
316 %{?with_system_lz4:-DLZ4_LIBRARY=OFF} \
317 %{?with_system_dconv:-DDOUBLE_CONVERSION_LIBRARY=OFF} \
318 %{?with_system_fastlz:-DFASTLZ_LIBRARY=OFF} \
319 %{?with_system_libafdt:-DSYSTEM_LIBAFDT=ON} \
320 %{?with_system_libzip:-DLIBZIP_LIBRARY=OFF} \
321 -DENABLE_COTIRE=%{!?with_cotire:OFF}%{?with_cotire:ON} \
324 # setup COMPILER_ID/HHVM_REPO_SCHEMA so it doesn't look it up from our package git repo
325 # see hphp/util/generate-buildinfo.sh
326 export COMPILER_ID=HHVM-%{version}-%{release}-g%{githash}
327 export HHVM_REPO_SCHEMA=$(date +%N_%s)
332 # make install relinks all outputs which is very slow,
333 # so to speedup rebuild, use timestamps to record states
334 #test %{_specdir}/%{name}.spec -nt makeinstall.stamp && %{__rm} -f makeinstall.stamp
335 if [ ! -f makeinstall.stamp -o ! -d $RPM_BUILD_ROOT ]; then
336 rm -rf makeinstall.stamp installed.stamp $RPM_BUILD_ROOT
339 DESTDIR=$RPM_BUILD_ROOT
341 touch makeinstall.stamp
344 rm -rf $RPM_BUILD_ROOT%{_docdir}
345 if [ ! -f installed.stamp ]; then
346 # begin install block
348 # fix broken cmake rules
349 # TODO: fix cmake rules
350 if [ -d $RPM_BUILD_ROOT%{_prefix}/usr ]; then
351 cp -a $RPM_BUILD_ROOT%{_prefix}/usr/* $RPM_BUILD_ROOT%{_prefix}
352 rm -rf $RPM_BUILD_ROOT%{_prefix}/usr
355 install -d $RPM_BUILD_ROOT{%{_sysconfdir}/%{name},%{_libdir}/%{name}}
356 cp -p %{SOURCE7} $RPM_BUILD_ROOT%{_sysconfdir}/%{name}
358 ln -s hhvm $RPM_BUILD_ROOT%{_bindir}/php
359 ln -s hhvm $RPM_BUILD_ROOT%{_bindir}/hphp
361 install -d $RPM_BUILD_ROOT%{_datadir}/%{name}/hdf
362 cp -p hphp/doc/mime.hdf $RPM_BUILD_ROOT%{_datadir}/%{name}/hdf/static.mime-types.hdf
364 # install fastcgi initscript
365 install -d $RPM_BUILD_ROOT/etc/{sysconfig,rc.d/init.d}
366 cp -p %{SOURCE5} $RPM_BUILD_ROOT/etc/rc.d/init.d/%{name}-fcgi
367 cp -p %{SOURCE6} $RPM_BUILD_ROOT/etc/sysconfig/%{name}-fcgi
369 install -p hphp/hack/bin/hh_{server,client} $RPM_BUILD_ROOT%{_bindir}
371 # end of install block
372 touch installed.stamp; fi
375 rm -rf $RPM_BUILD_ROOT
377 %post -p /sbin/ldconfig
378 %postun -p /sbin/ldconfig
381 /sbin/chkconfig --add %{name}-fcgi
382 %service %{name}-fcgi restart
385 if [ "$1" = "0" ]; then
386 %service -q %{name}-fcgi stop
387 /sbin/chkconfig --del %{name}-fcgi
391 %defattr(644,root,root,755)
392 %doc README.md hphp/NEWS
393 %dir %{_sysconfdir}/%{name}
394 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/%{name}/php.ini
395 %attr(755,root,root) %{_bindir}/hhvm
396 %attr(755,root,root) %{_bindir}/hphp
397 %attr(755,root,root) %{_bindir}/hh_client
398 %attr(755,root,root) %{_bindir}/hh_server
400 %dir %{_datadir}/%{name}
401 %dir %{_datadir}/%{name}/hdf
402 %{_datadir}/%{name}/hdf/static.mime-types.hdf
405 %dir %{_libdir}/%{name}
408 %defattr(644,root,root,755)
409 %attr(754,root,root) /etc/rc.d/init.d/%{name}-fcgi
410 %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/%{name}-fcgi
413 %defattr(644,root,root,755)
414 %attr(755,root,root) %{_bindir}/php
417 %defattr(644,root,root,755)
418 %attr(755,root,root) %{_bindir}/hphpize
421 %{_libdir}/hhvm/CMake
422 %{_libdir}/hhvm/hphpize