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
10 # - hphp/runtime/base/runtime-option.cpp evalJitDefault enables jit if /.hhvm-jit exists (yes, in filesystem root)
11 # - patch /usr/lib/hphp/CMake/HPHPIZEFunctions.cmake for %{_libdir}/hhvm as extension dir
13 # - system libmbfl, system xhp
15 %define githash e0c98e21167b425dddf1fc9efe78c9f7a36db268
16 # these hashes are git submodules
18 %define thirdparty fdef620
19 Summary: Virtual Machine, Runtime, and JIT for PHP
23 License: PHP 3.01 and BSD
24 Group: Development/Languages
25 Source0: https://github.com/facebook/hhvm/archive/HHVM-%{version}.tar.gz
26 # Source0-md5: bab9490837ff4f54f295bbcf428d7a1c
27 Source2: https://github.com/facebook/folly/archive/%{folly}/folly-3.2-%{folly}.tar.gz
28 # Source2-md5: c4bdbea4c0ffe0650d12d9ff370b8255
29 Source3: https://github.com/hhvm/hhvm-third-party/archive/%{thirdparty}/third_party-%{thirdparty}.tar.gz
30 # Source3-md5: 63858096c50c172d6c45ddb3d9b6d721
31 Source5: %{name}-fcgi.init
32 Source6: %{name}-fcgi.sysconfig
34 Source100: get-source.sh
35 Patch1: no-debug.patch
38 Patch4: system-thirdparty.patch
39 URL: https://github.com/facebook/hhvm/wiki
40 BuildRequires: ImageMagick-devel
41 BuildRequires: a52dec-libs-devel
42 BuildRequires: apr-devel
43 BuildRequires: autoconf
44 BuildRequires: binutils-devel
45 # CMake/HPHPFindLibs.cmake:364 - FIND_LIBRARY (BFD_LIB libbfd.a)
46 BuildRequires: binutils-static
47 BuildRequires: boost-devel >= 1.50
48 BuildRequires: cmake >= 2.8.5
49 BuildRequires: curl-devel >= 7.29.0
50 %{?with_system_dconv:BuildRequires: double-conversion-devel >= 1.1.1}
51 BuildRequires: elfutils-devel
52 BuildRequires: expat-devel
53 %{?with_system_fastlz:BuildRequires: fastlz-devel >= 0.1.0-0.r12}
54 BuildRequires: gcc >= 6:4.6.0
55 BuildRequires: gd-devel
56 BuildRequires: glog-devel >= 0.3.2
57 BuildRequires: imap-devel >= 1:2007
58 #BuildRequires: jemalloc-devel >= 3.0.0
59 %{?with_system_libafdt:BuildRequires: libafdt-devel >= 0.1.0}
60 BuildRequires: libcap-devel
61 BuildRequires: libdwarf-devel >= 20130729
62 BuildRequires: libicu-devel >= 4.2
63 #BuildRequires: libmbfl-devel
64 BuildRequires: libmcrypt-devel
65 BuildRequires: libmemcached-devel >= 1.0.4
66 BuildRequires: libstdc++-devel >= 6:4.8
67 BuildRequires: libunwind-devel
68 BuildRequires: libxml2-devel
69 BuildRequires: libxslt-devel
70 %{?with_system_lz4:BuildRequires: lz4-devel >= 0.0-1.r119}
71 BuildRequires: mysql-devel
72 BuildRequires: ocaml-findlib
73 BuildRequires: oniguruma-devel
74 BuildRequires: openssl-devel
75 BuildRequires: pcre-devel >= 8.32
76 #BuildRequires: php-xhp-devel >= 1.3.9-6
77 BuildRequires: readline-devel
78 BuildRequires: rpmbuild(macros) >= 1.675
79 %{?with_system_sqlite:BuildRequires: sqlite3-devel >= 3.7.15.2}
80 BuildRequires: tbb-devel >= 4.0.6000
81 BuildRequires: zlib-devel
82 # check later, seem unused
83 #BuildRequires: bison >= 2.3
84 #BuildRequires: flex >= 2.5.35
85 #BuildRequires: libafdt-devel >= 0.1.0
86 #BuildRequires: re2c >= 0.13.0
87 Provides: %{name}(api) = %{hhvm_api_version}
88 Provides: php(core) = %{php_version}
89 # foreach (get_loaded_extensions() as $ext) printf("Provides:\tphp(%s)\n", strtolower($ext));
93 Provides: php(calendar)
97 Provides: php(debugger)
102 Provides: php(fileinfo)
103 Provides: php(filter)
106 Provides: php(gettext)
110 Provides: php(hhvm.debugger)
111 Provides: php(hhvm.ini)
112 Provides: php(hotprofiler)
115 Provides: php(imagick)
120 Provides: php(libxml)
122 Provides: php(mailparse)
123 Provides: php(mbstring)
124 Provides: php(mcrypt)
125 Provides: php(memcache)
126 Provides: php(memcached)
128 Provides: php(mysqli)
130 Provides: php(openssl)
133 Provides: php(pcre_zend_compat)
135 Provides: php(pdo_mysql)
136 Provides: php(pdo_sqlite)
140 Provides: php(reflection)
141 Provides: php(server)
142 Provides: php(session)
143 Provides: php(simplexml)
145 Provides: php(sockets)
147 Provides: php(sqlite3)
148 Provides: php(standard)
149 Provides: php(standard_zend_compat)
150 Provides: php(stream)
151 Provides: php(sysvmsg)
152 Provides: php(sysvsem)
153 Provides: php(sysvshm)
154 Provides: php(thread)
155 Provides: php(thrift_protocol)
156 Provides: php(tokenizer)
160 Provides: php(xhprof)
162 Provides: php(xmlreader)
163 Provides: php(xmlwriter)
168 Obsoletes: hiphop-php < 2.3.2-0.2
169 ExclusiveArch: %{x8664}
170 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
172 # must be in sync with source. extra check ensuring that it is so is done in %%build
173 %define hhvm_api_version 20140829
174 # hphp/system/idl/constants.idl.json defines it as 5.6.99-hhvm, but use some saner value
175 %define php_version 5.6.0
177 %define hhvm_extensiondir %{_libdir}/hhvm
180 HHVM (aka the HipHop Virtual Machine) is a new open-source virtual
181 machine designed for executing programs written in PHP. HHVM uses a
182 just-in-time compilation approach to achieve superior performance
183 while maintaining the flexibility that PHP developers are accustomed
184 to. To date, HHVM (and its predecessor HPHPc before it) has realized
185 over a 9x increase in web request throughput and over a 5x reduction
186 in memory consumption for Facebook compared with the Zend PHP 5.2
189 HHVM can be run as a standalone webserver (i.e. without the Apache
190 webserver and the "mod_php" extension). HHVM can also be used together
191 with a FastCGI-based webserver, and work is in progress to make HHVM
192 work smoothly with Apache.
195 Summary: Init script to start HHVM as FastCGI daemon
196 Group: Development/Languages/PHP
197 Requires: %{name} = %{version}-%{release}
199 Requires(post,preun): /sbin/chkconfig
203 Init script to start HHVM as FastCGI daemon
206 Summary: /usr/bin/php symlink
207 Summary(pl.UTF-8): Dowiązanie symboliczne /usr/bin/php
208 Group: Development/Languages/PHP
209 Requires: %{name} = %{version}-%{release}
210 Obsoletes: /usr/bin/php
213 Package providing /usr/bin/php symlink to PHP CLI.
215 %description program -l pl.UTF-8
216 Pakiet dostarczający dowiązanie symboliczne /usr/bin/php do PHP CLI.
219 Summary: Files for HHVM modules development
220 Group: Development/Languages/PHP
221 URL: https://github.com/facebook/hhvm/wiki/Extension-API
222 Requires: boost-devel >= 1.50
223 Requires: cmake >= 2.8.5
224 Requires: glog-devel >= 0.3.2
225 Requires: libstdc++-devel >= 6:4.3
226 Requires: tbb-devel >= 4.0.6000
230 HHVM provides a set of APIs for adding built-in functionality to the
231 runtime either by way of pure PHP code, or a combination of PHP and
235 %setup -q -n %{name}-HHVM-%{version} -a2 -a3
237 # handle git submodules
239 mv hhvm-third-party-* third-party
240 rmdir third-party/folly/src
241 mv folly-* third-party/folly/src
248 # prefer ones from system
249 rm CMake/FindBISON.cmake
250 rm CMake/FindFLEX.cmake
251 rm CMake/FindFreetype.cmake
254 # also in: hphp/tools/hphpize/hphpize.cmake
255 API=$(awk '/#define HHVM_API_VERSION/{v=$3; sub(/L$/, "", v); print v}' hphp/runtime/ext/extension.h)
257 if [ $API != %{hhvm_api_version} ]; then
258 echo "Set %%define hhvm_api_version to $API and re-run."
262 # out of dir build broken (can't find it's tools, or headers)
266 # handle cmake & ccache
267 # http://stackoverflow.com/questions/1815688/how-to-use-ccache-with-cmake
268 # ASM fix: http://lists.busybox.net/pipermail/buildroot/2013-March/069436.html
269 if [[ "%{__cc}" = *ccache* ]]; then
273 -DCMAKE_C_COMPILER="ccache" -DCMAKE_C_COMPILER_ARG1="${cc#ccache }" \
274 -DCMAKE_CXX_COMPILER="ccache" -DCMAKE_CXX_COMPILER_ARG1="${cxx#ccache }" \
275 -DCMAKE_ASM_COMPILER="${cc#ccache }" \
281 -DCMAKE_PREFIX_PATH=%{_prefix} \
282 -DHHVM_DYNAMIC_EXTENSION_DIR=%{hhvm_extensiondir} \
287 %{?with_system_sqlite:-DSYSTEM_SQLITE3=ON} \
288 %{?with_system_lz4:-DSYSTEM_LZ4=ON} \
289 %{?with_system_dconv:-DSYSTEM_DOUBLE_CONVERSION=ON} \
290 %{?with_system_fastlz:-DSYSTEM_FASTLZ=ON} \
291 %{?with_system_libafdt:-DSYSTEM_LIBAFDT=ON} \
295 # setup COMPILER_ID/HHVM_REPO_SCHEMA so it doesn't look it up from our package git repo
296 # see hphp/util/generate-buildinfo.sh
297 export COMPILER_ID=HHVM-%{version}-%{release}-g%{githash}
298 export HHVM_REPO_SCHEMA=$(date +%N_%s)
303 # make install relinks all outputs which is very slow,
304 # so to speedup rebuild, use timestamps to record states
305 #test %{_specdir}/%{name}.spec -nt makeinstall.stamp && %{__rm} -f makeinstall.stamp
306 if [ ! -f makeinstall.stamp -o ! -d $RPM_BUILD_ROOT ]; then
307 rm -rf makeinstall.stamp installed.stamp $RPM_BUILD_ROOT
310 DESTDIR=$RPM_BUILD_ROOT
312 touch makeinstall.stamp
315 rm -rf $RPM_BUILD_ROOT%{_docdir}
316 if [ ! -f installed.stamp ]; then
317 # begin install block
319 install -d $RPM_BUILD_ROOT{%{_sysconfdir}/%{name},%{_libdir}/%{name}}
320 cp -p %{SOURCE7} $RPM_BUILD_ROOT%{_sysconfdir}/%{name}
322 ln -s hhvm $RPM_BUILD_ROOT%{_bindir}/php
323 ln -s hhvm $RPM_BUILD_ROOT%{_bindir}/hphp
325 install -d $RPM_BUILD_ROOT%{_datadir}/%{name}/hdf
326 cp -p hphp/doc/mime.hdf $RPM_BUILD_ROOT%{_datadir}/%{name}/hdf/static.mime-types.hdf
328 # install fastcgi initscript
329 install -d $RPM_BUILD_ROOT/etc/{sysconfig,rc.d/init.d}
330 cp -p %{SOURCE5} $RPM_BUILD_ROOT/etc/rc.d/init.d/%{name}-fcgi
331 cp -p %{SOURCE6} $RPM_BUILD_ROOT/etc/sysconfig/%{name}-fcgi
333 install -p hphp/hack/bin/hh_{server,client} $RPM_BUILD_ROOT%{_bindir}
337 install -d $RPM_BUILD_ROOT%{_datadir}/cmake/Modules
338 cp -p CMake/*.cmake $RPM_BUILD_ROOT%{_datadir}/cmake/Modules
342 /HHVM_INCLUDE_DIRS/ s,$HPHP_HOME,%{_includedir},g
343 " hphp/tools/hphpize/hphpize.cmake > $RPM_BUILD_ROOT%{_datadir}/cmake/Modules/hphpize.cmake
347 set -- $(sed -ne 's/set(HHVM_INCLUDE_DIRS "\(.*\)")/\1/p' hphp/tools/hphpize/hphpize.cmake)
351 [[ "$dir" = $HPHP_HOME/hphp/* ]] && echo $dir
357 $HPHP_HOME/hphp/runtime \
358 $HPHP_HOME/hphp/util \
359 $HPHP_HOME/hphp/neo \
360 $HPHP_HOME/hphp/system \
361 $HPHP_HOME/hphp/parser \
363 echo "D %{_includedir}${dir#$HPHP_HOME}"
364 find $dir -name '*.h' | while read path; do
365 file=%{_includedir}${path#$HPHP_HOME}
367 install -Dp $path $RPM_BUILD_ROOT$file
373 # end of install block
374 touch installed.stamp; fi
377 rm -rf $RPM_BUILD_ROOT
379 %post -p /sbin/ldconfig
380 %postun -p /sbin/ldconfig
383 /sbin/chkconfig --add %{name}-fcgi
384 %service %{name}-fcgi restart
387 if [ "$1" = "0" ]; then
388 %service -q %{name}-fcgi stop
389 /sbin/chkconfig --del %{name}-fcgi
393 %defattr(644,root,root,755)
394 %doc README.md hphp/NEWS
395 %dir %{_sysconfdir}/%{name}
396 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/%{name}/php.ini
397 %attr(755,root,root) %{_bindir}/hhvm
398 %attr(755,root,root) %{_bindir}/hphp
399 %attr(755,root,root) %{_bindir}/hh_client
400 %attr(755,root,root) %{_bindir}/hh_server
402 %dir %{_datadir}/%{name}
403 %dir %{_datadir}/%{name}/hdf
404 %{_datadir}/%{name}/hdf/static.mime-types.hdf
407 %dir %{_libdir}/%{name}
410 %defattr(644,root,root,755)
411 %attr(754,root,root) /etc/rc.d/init.d/%{name}-fcgi
412 %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/%{name}-fcgi
415 %defattr(644,root,root,755)
416 %attr(755,root,root) %{_bindir}/php
419 %defattr(644,root,root,755)
420 %attr(755,root,root) %{_bindir}/hphpize
423 %{_libdir}/hhvm/CMake
424 %{_libdir}/hhvm/hphpize