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 0a3cfb87b8a353fc7e1d15374f4adc413e37aba9
8 # these hashes are git submodules
10 %define thrift 378e954
11 %define thirdparty 12acbba
12 Summary: Virtual Machine, Runtime, and JIT for PHP
16 License: PHP 3.01 and BSD
17 Group: Development/Languages
18 Source0: https://github.com/facebook/hhvm/archive/HHVM-%{version}.tar.gz
19 # Source0-md5: ca42861748d0ddace763ed20bafe7116
20 Source2: https://github.com/facebook/folly/archive/%{folly}/folly-0.1-%{folly}.tar.gz
21 # Source2-md5: b9d32bbccffc260cfc6752152ddf06a9
22 Source3: https://github.com/hhvm/hhvm-third-party/archive/%{thirdparty}/third_party-%{thirdparty}.tar.gz
23 # Source3-md5: b2c28724e4ec5e4d2ea7e87f29690da2
24 Source4: https://github.com/facebook/fbthrift/archive/%{thrift}/thrift-%{thrift}.tar.gz
25 # Source4-md5: 872f84f6ec0cc3d4f6c8471d99fcc7df
26 Source5: %{name}-fcgi.init
27 Source6: %{name}-fcgi.sysconfig
29 Source100: get-source.sh
30 Patch1: no-debug.patch
32 URL: https://github.com/facebook/hhvm/wiki
33 BuildRequires: ImageMagick-devel
34 BuildRequires: a52dec-libs-devel
35 BuildRequires: apr-devel
36 BuildRequires: autoconf
37 BuildRequires: binutils-devel
38 # CMake/HPHPFindLibs.cmake:364 - FIND_LIBRARY (BFD_LIB libbfd.a)
39 BuildRequires: binutils-static
40 BuildRequires: boost-devel >= 1.50
41 BuildRequires: cmake >= 2.8.5
42 BuildRequires: curl-devel >= 7.29.0
43 BuildRequires: elfutils-devel
44 BuildRequires: expat-devel
45 BuildRequires: gcc >= 6:4.6.0
46 BuildRequires: gd-devel
47 BuildRequires: glog-devel >= 0.3.2
48 BuildRequires: imap-devel >= 1:2007
49 #BuildRequires: jemalloc-devel >= 3.0.0
50 BuildRequires: libcap-devel
51 BuildRequires: libdwarf-devel >= 20130729
52 BuildRequires: libicu-devel >= 4.2
53 #BuildRequires: libmbfl-devel
54 BuildRequires: libmcrypt-devel
55 BuildRequires: libmemcached-devel >= 1.0.4
56 BuildRequires: libstdc++-devel >= 6:4.8
57 BuildRequires: libunwind-devel
58 BuildRequires: libxml2-devel
59 BuildRequires: libxslt-devel
60 BuildRequires: mysql-devel
61 BuildRequires: ocaml-findlib
62 BuildRequires: oniguruma-devel
63 BuildRequires: openssl-devel
64 BuildRequires: pcre-devel
65 #BuildRequires: php-xhp-devel >= 1.3.9-6
66 BuildRequires: readline-devel
67 BuildRequires: rpmbuild(macros) >= 1.675
68 BuildRequires: tbb-devel >= 4.0.6000
69 BuildRequires: zlib-devel
70 # check later, seem unused
71 #BuildRequires: bison >= 2.3
72 #BuildRequires: flex >= 2.5.35
73 #BuildRequires: libafdt-devel >= 0.1.0
74 #BuildRequires: re2c >= 0.13.0
75 # foreach (get_loaded_extensions() as $ext) printf("Provides:\tphp(%s)\n", strtolower($ext));
76 Provides: %{name}(api) = %{hhvm_api_version}
81 Provides: php(calendar)
82 Provides: php(core) = %{php_version}
86 Provides: php(debugger)
90 Provides: php(fileinfo)
94 Provides: php(gettext)
97 Provides: php(hhvm.debugger)
98 Provides: php(hhvm.ini)
99 Provides: php(hotprofiler)
102 Provides: php(imagick)
107 Provides: php(libxml)
108 Provides: php(mbstring)
109 Provides: php(mcrypt)
110 Provides: php(memcache)
111 Provides: php(memcached)
114 Provides: php(mysqli)
116 Provides: php(openssl)
119 Provides: php(pcre_zend_compat)
121 Provides: php(pdo_mysql)
122 Provides: php(pdo_sqlite)
126 Provides: php(reflection)
127 Provides: php(server)
128 Provides: php(session)
129 Provides: php(simplexml)
131 Provides: php(sockets)
133 Provides: php(sqlite3)
134 Provides: php(standard)
135 Provides: php(standard_zend_compat)
136 Provides: php(stream)
137 Provides: php(sysvmsg)
138 Provides: php(sysvsem)
139 Provides: php(sysvshm)
140 Provides: php(thread)
141 Provides: php(thrift_protocol)
142 Provides: php(tokenizer)
146 Provides: php(xhprof)
148 Provides: php(xmlreader)
149 Provides: php(xmlwriter)
154 Obsoletes: hiphop-php < 2.3.2-0.2
155 ExclusiveArch: %{x8664}
156 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
158 # must be in sync with source. extra check ensuring that it is so is done in %%build
159 %define hhvm_api_version 20140829
160 # hphp/system/idl/constants.idl.json defines it as 5.6.99-hhvm, but use some saner value
161 %define php_version 5.6.0
163 %define hhvm_extensiondir %{_libdir}/hhvm
166 HHVM (aka the HipHop Virtual Machine) is a new open-source virtual
167 machine designed for executing programs written in PHP. HHVM uses a
168 just-in-time compilation approach to achieve superior performance
169 while maintaining the flexibility that PHP developers are accustomed
170 to. To date, HHVM (and its predecessor HPHPc before it) has realized
171 over a 9x increase in web request throughput and over a 5x reduction
172 in memory consumption for Facebook compared with the Zend PHP 5.2
175 HHVM can be run as a standalone webserver (i.e. without the Apache
176 webserver and the "mod_php" extension). HHVM can also be used together
177 with a FastCGI-based webserver, and work is in progress to make HHVM
178 work smoothly with Apache.
181 Summary: Init script to start HHVM as FastCGI daemon
182 Group: Development/Languages/PHP
183 Requires: %{name} = %{version}-%{release}
185 Requires(post,preun): /sbin/chkconfig
189 Init script to start HHVM as FastCGI daemon
192 Summary: /usr/bin/php symlink
193 Summary(pl.UTF-8): Dowiązanie symboliczne /usr/bin/php
194 Group: Development/Languages/PHP
195 Requires: %{name} = %{version}-%{release}
196 Obsoletes: /usr/bin/php
199 Package providing /usr/bin/php symlink to PHP CLI.
201 %description program -l pl.UTF-8
202 Pakiet dostarczający dowiązanie symboliczne /usr/bin/php do PHP CLI.
205 Summary: Files for HHVM modules development
206 Group: Development/Languages/PHP
207 URL: https://github.com/facebook/hhvm/wiki/Extension-API
208 Requires: boost-devel >= 1.50
209 Requires: cmake >= 2.8.5
210 Requires: glog-devel >= 0.3.2
211 Requires: libstdc++-devel >= 6:4.3
212 Requires: tbb-devel >= 4.0.6000
216 HHVM provides a set of APIs for adding built-in functionality to the
217 runtime either by way of pure PHP code, or a combination of PHP and
221 %setup -q -n %{name}-HHVM-%{version} -a2 -a3 -a4
223 # handle git submodules
225 mv hhvm-third-party-* third-party
226 rmdir third-party/folly/src
227 mv folly-* third-party/folly/src
228 rmdir third-party/thrift/src
229 mv fbthrift-* third-party/thrift/src
234 # prefer ones from system
235 rm CMake/FindBISON.cmake
236 rm CMake/FindFLEX.cmake
237 rm CMake/FindFreetype.cmake
240 # also in: hphp/tools/hphpize/hphpize.cmake
241 API=$(awk '/#define HHVM_API_VERSION/{v=$3; sub(/L$/, "", v); print v}' hphp/runtime/ext/extension.h)
243 if [ $API != %{hhvm_api_version} ]; then
244 echo "Set %%define hhvm_api_version to $API and re-run."
248 # out of dir build broken (can't find it's tools)
252 # handle cmake & ccache
253 # http://stackoverflow.com/questions/1815688/how-to-use-ccache-with-cmakec
254 # ASM fix: http://lists.busybox.net/pipermail/buildroot/2013-March/069436.html
255 if [[ "%{__cc}" = *ccache* ]]; then
259 -DCMAKE_C_COMPILER="ccache" -DCMAKE_C_COMPILER_ARG1="${cc#ccache }" \
260 -DCMAKE_CXX_COMPILER="ccache" -DCMAKE_CXX_COMPILER_ARG1="${cxx#ccache }" \
261 -DCMAKE_ASM_COMPILER="${cc#ccache }" \
267 -DCMAKE_PREFIX_PATH=%{_prefix} \
268 -DHHVM_DYNAMIC_EXTENSION_DIR=%{hhvm_extensiondir} \
276 # setup COMPILER_ID/HHVM_REPO_SCHEMA so it doesn't look it up from our package git repo
277 # see hphp/util/generate-buildinfo.sh
278 export COMPILER_ID=HHVM-%{version}-%{release}-g%{githash}
279 export HHVM_REPO_SCHEMA=$(date +%N_%s)
284 # make install relinks all outputs which is very slow,
285 # so to speedup rebuild, use timestamps to record states
286 #test %{_specdir}/%{name}.spec -nt makeinstall.stamp && %{__rm} -f makeinstall.stamp
287 if [ ! -f makeinstall.stamp -o ! -d $RPM_BUILD_ROOT ]; then
288 rm -rf makeinstall.stamp installed.stamp $RPM_BUILD_ROOT
290 %{__make} install -C build \
292 DESTDIR=$RPM_BUILD_ROOT
294 touch makeinstall.stamp
297 rm -rf $RPM_BUILD_ROOT%{_docdir}
298 if [ ! -f installed.stamp ]; then
299 # begin install block
301 install -d $RPM_BUILD_ROOT{%{_sysconfdir}/%{name},%{_libdir}/%{name}}
302 cp -p %{SOURCE7} $RPM_BUILD_ROOT%{_sysconfdir}/%{name}
304 ln -s hhvm $RPM_BUILD_ROOT%{_bindir}/php
305 ln -s hhvm $RPM_BUILD_ROOT%{_bindir}/hphp
307 install -d $RPM_BUILD_ROOT%{_datadir}/%{name}/hdf
308 cp -p hphp/doc/mime.hdf $RPM_BUILD_ROOT%{_datadir}/%{name}/hdf/static.mime-types.hdf
310 # install fastcgi initscript
311 install -d $RPM_BUILD_ROOT/etc/{sysconfig,rc.d/init.d}
312 cp -p %{SOURCE5} $RPM_BUILD_ROOT/etc/rc.d/init.d/%{name}-fcgi
313 cp -p %{SOURCE6} $RPM_BUILD_ROOT/etc/sysconfig/%{name}-fcgi
315 install -p hphp/hack/bin/hh_{server,client} $RPM_BUILD_ROOT%{_bindir}
319 install -d $RPM_BUILD_ROOT%{_datadir}/cmake/Modules
320 cp -p CMake/*.cmake $RPM_BUILD_ROOT%{_datadir}/cmake/Modules
324 /HHVM_INCLUDE_DIRS/ s,$HPHP_HOME,%{_includedir},g
325 " hphp/tools/hphpize/hphpize.cmake > $RPM_BUILD_ROOT%{_datadir}/cmake/Modules/hphpize.cmake
329 set -- $(sed -ne 's/set(HHVM_INCLUDE_DIRS "\(.*\)")/\1/p' hphp/tools/hphpize/hphpize.cmake)
333 [[ "$dir" = $HPHP_HOME/hphp/* ]] && echo $dir
339 $HPHP_HOME/hphp/runtime \
340 $HPHP_HOME/hphp/util \
341 $HPHP_HOME/hphp/neo \
342 $HPHP_HOME/hphp/system \
343 $HPHP_HOME/hphp/parser \
345 echo "D %{_includedir}${dir#$HPHP_HOME}"
346 find $dir -name '*.h' | while read path; do
347 file=%{_includedir}${path#$HPHP_HOME}
349 install -Dp $path $RPM_BUILD_ROOT$file
355 # end of install block
356 touch installed.stamp; fi
359 rm -rf $RPM_BUILD_ROOT
361 %post -p /sbin/ldconfig
362 %postun -p /sbin/ldconfig
365 /sbin/chkconfig --add %{name}-fcgi
366 %service %{name}-fcgi restart
369 if [ "$1" = "0" ]; then
370 %service -q %{name}-fcgi stop
371 /sbin/chkconfig --del %{name}-fcgi
375 %defattr(644,root,root,755)
376 %doc README.md hphp/NEWS
377 %dir %{_sysconfdir}/%{name}
378 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/%{name}/php.ini
379 %attr(755,root,root) %{_bindir}/hhvm
380 %attr(755,root,root) %{_bindir}/hphp
381 %attr(755,root,root) %{_bindir}/hh_client
382 %attr(755,root,root) %{_bindir}/hh_server
384 %dir %{_datadir}/%{name}
385 %dir %{_datadir}/%{name}/hdf
386 %{_datadir}/%{name}/hdf/static.mime-types.hdf
389 %dir %{_libdir}/%{name}
392 %defattr(644,root,root,755)
393 %attr(754,root,root) /etc/rc.d/init.d/%{name}-fcgi
394 %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/%{name}-fcgi
397 %defattr(644,root,root,755)
398 %attr(755,root,root) %{_bindir}/php
401 %defattr(644,root,root,755)
402 %attr(755,root,root) %{_bindir}/hphpize
404 %dir %{_prefix}/lib/hphp
405 %{_prefix}/lib/hphp/CMake
406 %{_prefix}/lib/hphp/hphpize