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
30 URL: https://github.com/facebook/hhvm/wiki
31 BuildRequires: ImageMagick-devel
32 BuildRequires: a52dec-libs-devel
33 BuildRequires: apr-devel
34 BuildRequires: autoconf
35 BuildRequires: binutils-devel
36 # CMake/HPHPFindLibs.cmake:364 - FIND_LIBRARY (BFD_LIB libbfd.a)
37 BuildRequires: binutils-static
38 BuildRequires: boost-devel >= 1.50
39 BuildRequires: cmake >= 2.8.5
40 BuildRequires: curl-devel >= 7.29.0
41 BuildRequires: elfutils-devel
42 BuildRequires: expat-devel
43 BuildRequires: gcc >= 6:4.6.0
44 BuildRequires: gd-devel
45 BuildRequires: glog-devel >= 0.3.2
46 BuildRequires: imap-devel >= 1:2007
47 #BuildRequires: jemalloc-devel >= 3.0.0
48 BuildRequires: libcap-devel
49 BuildRequires: libdwarf-devel >= 20130729
50 BuildRequires: libicu-devel >= 4.2
51 #BuildRequires: libmbfl-devel
52 BuildRequires: libmcrypt-devel
53 BuildRequires: libmemcached-devel >= 1.0.4
54 BuildRequires: libstdc++-devel >= 6:4.8
55 BuildRequires: libunwind-devel
56 BuildRequires: libxml2-devel
57 BuildRequires: libxslt-devel
58 BuildRequires: mysql-devel
59 BuildRequires: ocaml-findlib
60 BuildRequires: oniguruma-devel
61 BuildRequires: openssl-devel
62 BuildRequires: pcre-devel
63 #BuildRequires: php-xhp-devel >= 1.3.9-6
64 BuildRequires: readline-devel
65 BuildRequires: rpmbuild(macros) >= 1.675
66 BuildRequires: tbb-devel >= 4.0.6000
67 BuildRequires: zlib-devel
68 # check later, seem unused
69 #BuildRequires: bison >= 2.3
70 #BuildRequires: flex >= 2.5.35
71 #BuildRequires: libafdt-devel >= 0.1.0
72 #BuildRequires: re2c >= 0.13.0
73 # foreach (get_loaded_extensions() as $ext) printf("Provides:\tphp(%s)\n", strtolower($ext));
74 Provides: %{name}(api) = %{hhvm_api_version}
79 Provides: php(calendar)
80 Provides: php(core) = %{php_version}
84 Provides: php(debugger)
88 Provides: php(fileinfo)
92 Provides: php(gettext)
95 Provides: php(hhvm.debugger)
96 Provides: php(hhvm.ini)
97 Provides: php(hotprofiler)
100 Provides: php(imagick)
105 Provides: php(libxml)
106 Provides: php(mbstring)
107 Provides: php(mcrypt)
108 Provides: php(memcache)
109 Provides: php(memcached)
112 Provides: php(mysqli)
114 Provides: php(openssl)
117 Provides: php(pcre_zend_compat)
119 Provides: php(pdo_mysql)
120 Provides: php(pdo_sqlite)
124 Provides: php(reflection)
125 Provides: php(server)
126 Provides: php(session)
127 Provides: php(simplexml)
129 Provides: php(sockets)
131 Provides: php(sqlite3)
132 Provides: php(standard)
133 Provides: php(standard_zend_compat)
134 Provides: php(stream)
135 Provides: php(sysvmsg)
136 Provides: php(sysvsem)
137 Provides: php(sysvshm)
138 Provides: php(thread)
139 Provides: php(thrift_protocol)
140 Provides: php(tokenizer)
144 Provides: php(xhprof)
146 Provides: php(xmlreader)
147 Provides: php(xmlwriter)
152 Obsoletes: hiphop-php < 2.3.2-0.2
153 ExclusiveArch: %{x8664}
154 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
156 # must be in sync with source. extra check ensuring that it is so is done in %%build
157 %define hhvm_api_version 20140829
158 # hphp/system/idl/constants.idl.json defines it as 5.6.99-hhvm, but use some saner value
159 %define php_version 5.6.0
161 %define hhvm_extensiondir %{_libdir}/hhvm
164 HHVM (aka the HipHop Virtual Machine) is a new open-source virtual
165 machine designed for executing programs written in PHP. HHVM uses a
166 just-in-time compilation approach to achieve superior performance
167 while maintaining the flexibility that PHP developers are accustomed
168 to. To date, HHVM (and its predecessor HPHPc before it) has realized
169 over a 9x increase in web request throughput and over a 5x reduction
170 in memory consumption for Facebook compared with the Zend PHP 5.2
173 HHVM can be run as a standalone webserver (i.e. without the Apache
174 webserver and the "mod_php" extension). HHVM can also be used together
175 with a FastCGI-based webserver, and work is in progress to make HHVM
176 work smoothly with Apache.
179 Summary: Init script to start HHVM as FastCGI daemon
180 Group: Development/Languages/PHP
181 Requires: %{name} = %{version}-%{release}
183 Requires(post,preun): /sbin/chkconfig
187 Init script to start HHVM as FastCGI daemon
190 Summary: /usr/bin/php symlink
191 Summary(pl.UTF-8): Dowiązanie symboliczne /usr/bin/php
192 Group: Development/Languages/PHP
193 Requires: %{name} = %{version}-%{release}
194 Obsoletes: /usr/bin/php
197 Package providing /usr/bin/php symlink to PHP CLI.
199 %description program -l pl.UTF-8
200 Pakiet dostarczający dowiązanie symboliczne /usr/bin/php do PHP CLI.
203 Summary: Files for HHVM modules development
204 Group: Development/Languages/PHP
205 URL: https://github.com/facebook/hhvm/wiki/Extension-API
206 Requires: boost-devel >= 1.50
207 Requires: cmake >= 2.8.5
208 Requires: glog-devel >= 0.3.2
209 Requires: libstdc++-devel >= 6:4.3
210 Requires: tbb-devel >= 4.0.6000
214 HHVM provides a set of APIs for adding built-in functionality to the
215 runtime either by way of pure PHP code, or a combination of PHP and
219 %setup -q -n %{name}-HHVM-%{version} -a2 -a3
221 # handle git submodules
223 mv hhvm-third-party-* third-party
224 rmdir third-party/folly/src
225 mv folly-* third-party/folly/src
231 # prefer ones from system
232 rm CMake/FindBISON.cmake
233 rm CMake/FindFLEX.cmake
234 rm CMake/FindFreetype.cmake
237 # also in: hphp/tools/hphpize/hphpize.cmake
238 API=$(awk '/#define HHVM_API_VERSION/{v=$3; sub(/L$/, "", v); print v}' hphp/runtime/ext/extension.h)
240 if [ $API != %{hhvm_api_version} ]; then
241 echo "Set %%define hhvm_api_version to $API and re-run."
245 # out of dir build broken (can't find it's tools, or headers)
249 # handle cmake & ccache
250 # http://stackoverflow.com/questions/1815688/how-to-use-ccache-with-cmakec
251 # ASM fix: http://lists.busybox.net/pipermail/buildroot/2013-March/069436.html
252 if [[ "%{__cc}" = *ccache* ]]; then
256 -DCMAKE_C_COMPILER="ccache" -DCMAKE_C_COMPILER_ARG1="${cc#ccache }" \
257 -DCMAKE_CXX_COMPILER="ccache" -DCMAKE_CXX_COMPILER_ARG1="${cxx#ccache }" \
258 -DCMAKE_ASM_COMPILER="${cc#ccache }" \
264 -DCMAKE_PREFIX_PATH=%{_prefix} \
265 -DHHVM_DYNAMIC_EXTENSION_DIR=%{hhvm_extensiondir} \
272 # setup COMPILER_ID/HHVM_REPO_SCHEMA so it doesn't look it up from our package git repo
273 # see hphp/util/generate-buildinfo.sh
274 export COMPILER_ID=HHVM-%{version}-%{release}-g%{githash}
275 export HHVM_REPO_SCHEMA=$(date +%N_%s)
280 # make install relinks all outputs which is very slow,
281 # so to speedup rebuild, use timestamps to record states
282 #test %{_specdir}/%{name}.spec -nt makeinstall.stamp && %{__rm} -f makeinstall.stamp
283 if [ ! -f makeinstall.stamp -o ! -d $RPM_BUILD_ROOT ]; then
284 rm -rf makeinstall.stamp installed.stamp $RPM_BUILD_ROOT
286 %{__make} install -C build \
288 DESTDIR=$RPM_BUILD_ROOT
290 touch makeinstall.stamp
293 rm -rf $RPM_BUILD_ROOT%{_docdir}
294 if [ ! -f installed.stamp ]; then
295 # begin install block
297 install -d $RPM_BUILD_ROOT{%{_sysconfdir}/%{name},%{_libdir}/%{name}}
298 cp -p %{SOURCE7} $RPM_BUILD_ROOT%{_sysconfdir}/%{name}
300 ln -s hhvm $RPM_BUILD_ROOT%{_bindir}/php
301 ln -s hhvm $RPM_BUILD_ROOT%{_bindir}/hphp
303 install -d $RPM_BUILD_ROOT%{_datadir}/%{name}/hdf
304 cp -p hphp/doc/mime.hdf $RPM_BUILD_ROOT%{_datadir}/%{name}/hdf/static.mime-types.hdf
306 # install fastcgi initscript
307 install -d $RPM_BUILD_ROOT/etc/{sysconfig,rc.d/init.d}
308 cp -p %{SOURCE5} $RPM_BUILD_ROOT/etc/rc.d/init.d/%{name}-fcgi
309 cp -p %{SOURCE6} $RPM_BUILD_ROOT/etc/sysconfig/%{name}-fcgi
311 install -p hphp/hack/bin/hh_{server,client} $RPM_BUILD_ROOT%{_bindir}
315 install -d $RPM_BUILD_ROOT%{_datadir}/cmake/Modules
316 cp -p CMake/*.cmake $RPM_BUILD_ROOT%{_datadir}/cmake/Modules
320 /HHVM_INCLUDE_DIRS/ s,$HPHP_HOME,%{_includedir},g
321 " hphp/tools/hphpize/hphpize.cmake > $RPM_BUILD_ROOT%{_datadir}/cmake/Modules/hphpize.cmake
325 set -- $(sed -ne 's/set(HHVM_INCLUDE_DIRS "\(.*\)")/\1/p' hphp/tools/hphpize/hphpize.cmake)
329 [[ "$dir" = $HPHP_HOME/hphp/* ]] && echo $dir
335 $HPHP_HOME/hphp/runtime \
336 $HPHP_HOME/hphp/util \
337 $HPHP_HOME/hphp/neo \
338 $HPHP_HOME/hphp/system \
339 $HPHP_HOME/hphp/parser \
341 echo "D %{_includedir}${dir#$HPHP_HOME}"
342 find $dir -name '*.h' | while read path; do
343 file=%{_includedir}${path#$HPHP_HOME}
345 install -Dp $path $RPM_BUILD_ROOT$file
351 # end of install block
352 touch installed.stamp; fi
355 rm -rf $RPM_BUILD_ROOT
357 %post -p /sbin/ldconfig
358 %postun -p /sbin/ldconfig
361 /sbin/chkconfig --add %{name}-fcgi
362 %service %{name}-fcgi restart
365 if [ "$1" = "0" ]; then
366 %service -q %{name}-fcgi stop
367 /sbin/chkconfig --del %{name}-fcgi
371 %defattr(644,root,root,755)
372 %doc README.md hphp/NEWS
373 %dir %{_sysconfdir}/%{name}
374 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/%{name}/php.ini
375 %attr(755,root,root) %{_bindir}/hhvm
376 %attr(755,root,root) %{_bindir}/hphp
377 %attr(755,root,root) %{_bindir}/hh_client
378 %attr(755,root,root) %{_bindir}/hh_server
380 %dir %{_datadir}/%{name}
381 %dir %{_datadir}/%{name}/hdf
382 %{_datadir}/%{name}/hdf/static.mime-types.hdf
385 %dir %{_libdir}/%{name}
388 %defattr(644,root,root,755)
389 %attr(754,root,root) /etc/rc.d/init.d/%{name}-fcgi
390 %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/%{name}-fcgi
393 %defattr(644,root,root,755)
394 %attr(755,root,root) %{_bindir}/php
397 %defattr(644,root,root,755)
398 %attr(755,root,root) %{_bindir}/hphpize
400 %dir %{_prefix}/lib/hphp
401 %{_prefix}/lib/hphp/CMake
402 %{_prefix}/lib/hphp/hphpize