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
7 %define githash e0c98e21167b425dddf1fc9efe78c9f7a36db268
8 # these hashes are git submodules
10 %define thirdparty fdef620
11 Summary: Virtual Machine, Runtime, and JIT for PHP
15 License: PHP 3.01 and BSD
16 Group: Development/Languages
17 Source0: https://github.com/facebook/hhvm/archive/HHVM-%{version}.tar.gz
18 # Source0-md5: bab9490837ff4f54f295bbcf428d7a1c
19 Source2: https://github.com/facebook/folly/archive/%{folly}/folly-3.2-%{folly}.tar.gz
20 # Source2-md5: c4bdbea4c0ffe0650d12d9ff370b8255
21 Source3: https://github.com/hhvm/hhvm-third-party/archive/%{thirdparty}/third_party-%{thirdparty}.tar.gz
22 # Source3-md5: 63858096c50c172d6c45ddb3d9b6d721
23 Source5: %{name}-fcgi.init
24 Source6: %{name}-fcgi.sysconfig
26 Source100: get-source.sh
27 Patch1: no-debug.patch
29 URL: https://github.com/facebook/hhvm/wiki
30 BuildRequires: ImageMagick-devel
31 BuildRequires: a52dec-libs-devel
32 BuildRequires: apr-devel
33 BuildRequires: autoconf
34 BuildRequires: binutils-devel
35 # CMake/HPHPFindLibs.cmake:364 - FIND_LIBRARY (BFD_LIB libbfd.a)
36 BuildRequires: binutils-static
37 BuildRequires: boost-devel >= 1.50
38 BuildRequires: cmake >= 2.8.5
39 BuildRequires: curl-devel >= 7.29.0
40 BuildRequires: elfutils-devel
41 BuildRequires: expat-devel
42 BuildRequires: gcc >= 6:4.6.0
43 BuildRequires: gd-devel
44 BuildRequires: glog-devel >= 0.3.2
45 BuildRequires: imap-devel >= 1:2007
46 #BuildRequires: jemalloc-devel >= 3.0.0
47 BuildRequires: libcap-devel
48 BuildRequires: libdwarf-devel >= 20130729
49 BuildRequires: libicu-devel >= 4.2
50 #BuildRequires: libmbfl-devel
51 BuildRequires: libmcrypt-devel
52 BuildRequires: libmemcached-devel >= 1.0.4
53 BuildRequires: libstdc++-devel >= 6:4.8
54 BuildRequires: libunwind-devel
55 BuildRequires: libxml2-devel
56 BuildRequires: libxslt-devel
57 BuildRequires: mysql-devel
58 BuildRequires: ocaml-findlib
59 BuildRequires: oniguruma-devel
60 BuildRequires: openssl-devel
61 BuildRequires: pcre-devel
62 #BuildRequires: php-xhp-devel >= 1.3.9-6
63 BuildRequires: readline-devel
64 BuildRequires: rpmbuild(macros) >= 1.675
65 BuildRequires: tbb-devel >= 4.0.6000
66 BuildRequires: zlib-devel
67 # check later, seem unused
68 #BuildRequires: bison >= 2.3
69 #BuildRequires: flex >= 2.5.35
70 #BuildRequires: libafdt-devel >= 0.1.0
71 #BuildRequires: re2c >= 0.13.0
72 # foreach (get_loaded_extensions() as $ext) printf("Provides:\tphp(%s)\n", strtolower($ext));
73 Provides: %{name}(api) = %{hhvm_api_version}
78 Provides: php(calendar)
79 Provides: php(core) = %{php_version}
83 Provides: php(debugger)
87 Provides: php(fileinfo)
91 Provides: php(gettext)
94 Provides: php(hhvm.debugger)
95 Provides: php(hhvm.ini)
96 Provides: php(hotprofiler)
99 Provides: php(imagick)
104 Provides: php(libxml)
105 Provides: php(mbstring)
106 Provides: php(mcrypt)
107 Provides: php(memcache)
108 Provides: php(memcached)
111 Provides: php(mysqli)
113 Provides: php(openssl)
116 Provides: php(pcre_zend_compat)
118 Provides: php(pdo_mysql)
119 Provides: php(pdo_sqlite)
123 Provides: php(reflection)
124 Provides: php(server)
125 Provides: php(session)
126 Provides: php(simplexml)
128 Provides: php(sockets)
130 Provides: php(sqlite3)
131 Provides: php(standard)
132 Provides: php(standard_zend_compat)
133 Provides: php(stream)
134 Provides: php(sysvmsg)
135 Provides: php(sysvsem)
136 Provides: php(sysvshm)
137 Provides: php(thread)
138 Provides: php(thrift_protocol)
139 Provides: php(tokenizer)
143 Provides: php(xhprof)
145 Provides: php(xmlreader)
146 Provides: php(xmlwriter)
151 Obsoletes: hiphop-php < 2.3.2-0.2
152 ExclusiveArch: %{x8664}
153 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
155 # must be in sync with source. extra check ensuring that it is so is done in %%build
156 %define hhvm_api_version 20140829
157 # hphp/system/idl/constants.idl.json defines it as 5.6.99-hhvm, but use some saner value
158 %define php_version 5.6.0
160 %define hhvm_extensiondir %{_libdir}/hhvm
163 HHVM (aka the HipHop Virtual Machine) is a new open-source virtual
164 machine designed for executing programs written in PHP. HHVM uses a
165 just-in-time compilation approach to achieve superior performance
166 while maintaining the flexibility that PHP developers are accustomed
167 to. To date, HHVM (and its predecessor HPHPc before it) has realized
168 over a 9x increase in web request throughput and over a 5x reduction
169 in memory consumption for Facebook compared with the Zend PHP 5.2
172 HHVM can be run as a standalone webserver (i.e. without the Apache
173 webserver and the "mod_php" extension). HHVM can also be used together
174 with a FastCGI-based webserver, and work is in progress to make HHVM
175 work smoothly with Apache.
178 Summary: Init script to start HHVM as FastCGI daemon
179 Group: Development/Languages/PHP
180 Requires: %{name} = %{version}-%{release}
182 Requires(post,preun): /sbin/chkconfig
186 Init script to start HHVM as FastCGI daemon
189 Summary: /usr/bin/php symlink
190 Summary(pl.UTF-8): Dowiązanie symboliczne /usr/bin/php
191 Group: Development/Languages/PHP
192 Requires: %{name} = %{version}-%{release}
193 Obsoletes: /usr/bin/php
196 Package providing /usr/bin/php symlink to PHP CLI.
198 %description program -l pl.UTF-8
199 Pakiet dostarczający dowiązanie symboliczne /usr/bin/php do PHP CLI.
202 Summary: Files for HHVM modules development
203 Group: Development/Languages/PHP
204 URL: https://github.com/facebook/hhvm/wiki/Extension-API
205 Requires: boost-devel >= 1.50
206 Requires: cmake >= 2.8.5
207 Requires: glog-devel >= 0.3.2
208 Requires: libstdc++-devel >= 6:4.3
209 Requires: tbb-devel >= 4.0.6000
213 HHVM provides a set of APIs for adding built-in functionality to the
214 runtime either by way of pure PHP code, or a combination of PHP and
218 %setup -q -n %{name}-HHVM-%{version} -a2 -a3
220 # handle git submodules
222 mv hhvm-third-party-* third-party
223 rmdir third-party/folly/src
224 mv folly-* third-party/folly/src
229 # prefer ones from system
230 rm CMake/FindBISON.cmake
231 rm CMake/FindFLEX.cmake
232 rm CMake/FindFreetype.cmake
235 # also in: hphp/tools/hphpize/hphpize.cmake
236 API=$(awk '/#define HHVM_API_VERSION/{v=$3; sub(/L$/, "", v); print v}' hphp/runtime/ext/extension.h)
238 if [ $API != %{hhvm_api_version} ]; then
239 echo "Set %%define hhvm_api_version to $API and re-run."
243 # out of dir build broken (can't find it's tools, or headers)
247 # handle cmake & ccache
248 # http://stackoverflow.com/questions/1815688/how-to-use-ccache-with-cmakec
249 # ASM fix: http://lists.busybox.net/pipermail/buildroot/2013-March/069436.html
250 if [[ "%{__cc}" = *ccache* ]]; then
254 -DCMAKE_C_COMPILER="ccache" -DCMAKE_C_COMPILER_ARG1="${cc#ccache }" \
255 -DCMAKE_CXX_COMPILER="ccache" -DCMAKE_CXX_COMPILER_ARG1="${cxx#ccache }" \
256 -DCMAKE_ASM_COMPILER="${cc#ccache }" \
262 -DCMAKE_PREFIX_PATH=%{_prefix} \
263 -DHHVM_DYNAMIC_EXTENSION_DIR=%{hhvm_extensiondir} \
270 # setup COMPILER_ID/HHVM_REPO_SCHEMA so it doesn't look it up from our package git repo
271 # see hphp/util/generate-buildinfo.sh
272 export COMPILER_ID=HHVM-%{version}-%{release}-g%{githash}
273 export HHVM_REPO_SCHEMA=$(date +%N_%s)
278 # make install relinks all outputs which is very slow,
279 # so to speedup rebuild, use timestamps to record states
280 #test %{_specdir}/%{name}.spec -nt makeinstall.stamp && %{__rm} -f makeinstall.stamp
281 if [ ! -f makeinstall.stamp -o ! -d $RPM_BUILD_ROOT ]; then
282 rm -rf makeinstall.stamp installed.stamp $RPM_BUILD_ROOT
284 %{__make} install -C build \
286 DESTDIR=$RPM_BUILD_ROOT
288 touch makeinstall.stamp
291 rm -rf $RPM_BUILD_ROOT%{_docdir}
292 if [ ! -f installed.stamp ]; then
293 # begin install block
295 install -d $RPM_BUILD_ROOT{%{_sysconfdir}/%{name},%{_libdir}/%{name}}
296 cp -p %{SOURCE7} $RPM_BUILD_ROOT%{_sysconfdir}/%{name}
298 ln -s hhvm $RPM_BUILD_ROOT%{_bindir}/php
299 ln -s hhvm $RPM_BUILD_ROOT%{_bindir}/hphp
301 install -d $RPM_BUILD_ROOT%{_datadir}/%{name}/hdf
302 cp -p hphp/doc/mime.hdf $RPM_BUILD_ROOT%{_datadir}/%{name}/hdf/static.mime-types.hdf
304 # install fastcgi initscript
305 install -d $RPM_BUILD_ROOT/etc/{sysconfig,rc.d/init.d}
306 cp -p %{SOURCE5} $RPM_BUILD_ROOT/etc/rc.d/init.d/%{name}-fcgi
307 cp -p %{SOURCE6} $RPM_BUILD_ROOT/etc/sysconfig/%{name}-fcgi
309 install -p hphp/hack/bin/hh_{server,client} $RPM_BUILD_ROOT%{_bindir}
313 install -d $RPM_BUILD_ROOT%{_datadir}/cmake/Modules
314 cp -p CMake/*.cmake $RPM_BUILD_ROOT%{_datadir}/cmake/Modules
318 /HHVM_INCLUDE_DIRS/ s,$HPHP_HOME,%{_includedir},g
319 " hphp/tools/hphpize/hphpize.cmake > $RPM_BUILD_ROOT%{_datadir}/cmake/Modules/hphpize.cmake
323 set -- $(sed -ne 's/set(HHVM_INCLUDE_DIRS "\(.*\)")/\1/p' hphp/tools/hphpize/hphpize.cmake)
327 [[ "$dir" = $HPHP_HOME/hphp/* ]] && echo $dir
333 $HPHP_HOME/hphp/runtime \
334 $HPHP_HOME/hphp/util \
335 $HPHP_HOME/hphp/neo \
336 $HPHP_HOME/hphp/system \
337 $HPHP_HOME/hphp/parser \
339 echo "D %{_includedir}${dir#$HPHP_HOME}"
340 find $dir -name '*.h' | while read path; do
341 file=%{_includedir}${path#$HPHP_HOME}
343 install -Dp $path $RPM_BUILD_ROOT$file
349 # end of install block
350 touch installed.stamp; fi
353 rm -rf $RPM_BUILD_ROOT
355 %post -p /sbin/ldconfig
356 %postun -p /sbin/ldconfig
359 /sbin/chkconfig --add %{name}-fcgi
360 %service %{name}-fcgi restart
363 if [ "$1" = "0" ]; then
364 %service -q %{name}-fcgi stop
365 /sbin/chkconfig --del %{name}-fcgi
369 %defattr(644,root,root,755)
370 %doc README.md hphp/NEWS
371 %dir %{_sysconfdir}/%{name}
372 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/%{name}/php.ini
373 %attr(755,root,root) %{_bindir}/hhvm
374 %attr(755,root,root) %{_bindir}/hphp
375 %attr(755,root,root) %{_bindir}/hh_client
376 %attr(755,root,root) %{_bindir}/hh_server
378 %dir %{_datadir}/%{name}
379 %dir %{_datadir}/%{name}/hdf
380 %{_datadir}/%{name}/hdf/static.mime-types.hdf
383 %dir %{_libdir}/%{name}
386 %defattr(644,root,root,755)
387 %attr(754,root,root) /etc/rc.d/init.d/%{name}-fcgi
388 %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/%{name}-fcgi
391 %defattr(644,root,root,755)
392 %attr(755,root,root) %{_bindir}/php
395 %defattr(644,root,root,755)
396 %attr(755,root,root) %{_bindir}/hphpize
398 %dir %{_prefix}/lib/hphp
399 %{_prefix}/lib/hphp/CMake
400 %{_prefix}/lib/hphp/hphpize