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 01228273b8cf709aacbd3df1c51b1e690ecebac8
9 %define thirdparty 2234d64
10 Summary: Virtual Machine, Runtime, and JIT for PHP
15 Group: Development/Languages
16 Source0: https://github.com/facebook/hhvm/archive/HHVM-%{version}.tar.gz
17 # Source0-md5: 791ca8c56d155a71f948387de8859f98
18 Source2: https://github.com/facebook/folly/archive/%{folly}/folly-0.1-%{folly}.tar.gz
19 # Source2-md5: 17bc7ee76939cd6a26755588d80313c9
20 Source3: https://github.com/hhvm/hhvm-third-party/archive/%{thirdparty}/third_party-%{thirdparty}.tar.gz
21 # Source3-md5: 9d40c3fbf1394bb1f03648d7046f8b9c
22 Source4: %{name}-fcgi.init
23 Source5: %{name}-fcgi.sysconfig
25 Source100: get-source.sh
27 Patch1: no-debug.patch
28 URL: https://github.com/facebook/hhvm/wiki
29 BuildRequires: ImageMagick-devel
30 BuildRequires: a52dec-libs-devel
31 BuildRequires: apr-devel
32 BuildRequires: autoconf
33 BuildRequires: binutils-devel
34 BuildRequires: boost-devel >= 1.50
35 BuildRequires: cmake >= 2.8.5
36 BuildRequires: curl-devel >= 7.29.0
37 BuildRequires: elfutils-devel
38 BuildRequires: expat-devel
39 BuildRequires: gcc >= 6:4.6.0
40 BuildRequires: gd-devel
41 BuildRequires: glog-devel >= 0.3.2
42 BuildRequires: imap-devel >= 1:2007
43 #BuildRequires: jemalloc-devel >= 3.0.0
44 BuildRequires: libcap-devel
45 BuildRequires: libdwarf-devel >= 20130729
46 BuildRequires: libicu-devel >= 4.2
47 #BuildRequires: libmbfl-devel
48 BuildRequires: libmcrypt-devel
49 BuildRequires: libmemcached-devel >= 1.0.4
50 BuildRequires: libstdc++-devel >= 6:4.8
51 BuildRequires: libunwind-devel
52 BuildRequires: libxml2-devel
53 BuildRequires: libxslt-devel
54 BuildRequires: mysql-devel
55 BuildRequires: ocaml-findlib
56 BuildRequires: oniguruma-devel
57 BuildRequires: openssl-devel
58 BuildRequires: pcre-devel
59 #BuildRequires: php-xhp-devel >= 1.3.9-6
60 BuildRequires: readline-devel
61 BuildRequires: rpmbuild(macros) >= 1.675
62 BuildRequires: tbb-devel >= 4.0.6000
63 BuildRequires: zlib-devel
64 # check later, seem unused
65 #BuildRequires: bison >= 2.3
66 #BuildRequires: flex >= 2.5.35
67 #BuildRequires: libafdt-devel >= 0.1.0
68 #BuildRequires: re2c >= 0.13.0
69 # foreach (get_loaded_extensions() as $ext) printf("Provides:\tphp(%s)\n", strtolower($ext));
70 Provides: %{name}(api) = %{hhvm_api_version}
75 Provides: php(calendar)
76 Provides: php(core) = %{php_version}
80 Provides: php(debugger)
84 Provides: php(fileinfo)
88 Provides: php(gettext)
91 Provides: php(hhvm.debugger)
92 Provides: php(hhvm.ini)
93 Provides: php(hotprofiler)
96 Provides: php(imagick)
101 Provides: php(libxml)
102 Provides: php(mbstring)
103 Provides: php(mcrypt)
104 Provides: php(memcache)
105 Provides: php(memcached)
108 Provides: php(mysqli)
110 Provides: php(openssl)
113 Provides: php(pcre_zend_compat)
115 Provides: php(pdo_mysql)
116 Provides: php(pdo_sqlite)
120 Provides: php(reflection)
121 Provides: php(server)
122 Provides: php(session)
123 Provides: php(simplexml)
125 Provides: php(sockets)
127 Provides: php(sqlite3)
128 Provides: php(standard)
129 Provides: php(standard_zend_compat)
130 Provides: php(stream)
131 Provides: php(sysvmsg)
132 Provides: php(sysvsem)
133 Provides: php(sysvshm)
134 Provides: php(thread)
135 Provides: php(thrift_protocol)
136 Provides: php(tokenizer)
140 Provides: php(xhprof)
142 Provides: php(xmlreader)
143 Provides: php(xmlwriter)
148 Obsoletes: hiphop-php < 2.3.2-0.2
149 ExclusiveArch: %{x8664}
150 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
152 # must be in sync with source. extra check ensuring that it is so is done in %%build
153 %define hhvm_api_version 20140702
154 # hphp/system/idl/constants.idl.json defines it as 5.6.99-hhvm, but use some saner value
155 %define php_version 5.6.0
158 HHVM (aka the HipHop Virtual Machine) is a new open-source virtual
159 machine designed for executing programs written in PHP. HHVM uses a
160 just-in-time compilation approach to achieve superior performance
161 while maintaining the flexibility that PHP developers are accustomed
162 to. To date, HHVM (and its predecessor HPHPc before it) has realized
163 over a 9x increase in web request throughput and over a 5x reduction
164 in memory consumption for Facebook compared with the Zend PHP 5.2
167 HHVM can be run as a standalone webserver (i.e. without the Apache
168 webserver and the "mod_php" extension). HHVM can also be used together
169 with a FastCGI-based webserver, and work is in progress to make HHVM
170 work smoothly with Apache.
173 Summary: Init script to start HHVM as FastCGI daemon
174 Group: Development/Languages/PHP
175 Requires: %{name} = %{version}-%{release}
177 Requires(post,preun): /sbin/chkconfig
181 Init script to start HHVM as FastCGI daemon
184 Summary: /usr/bin/php symlink
185 Summary(pl.UTF-8): Dowiązanie symboliczne /usr/bin/php
186 Group: Development/Languages/PHP
187 Requires: %{name} = %{version}-%{release}
188 Obsoletes: /usr/bin/php
191 Package providing /usr/bin/php symlink to PHP CLI.
193 %description program -l pl.UTF-8
194 Pakiet dostarczający dowiązanie symboliczne /usr/bin/php do PHP CLI.
197 Summary: Files for HHVM modules development
198 Group: Development/Languages/PHP
199 URL: https://github.com/facebook/hhvm/wiki/Extension-API
200 Requires: boost-devel >= 1.50
201 Requires: cmake >= 2.8.5
202 Requires: glog-devel >= 0.3.2
203 Requires: libstdc++-devel >= 6:4.3
204 Requires: tbb-devel >= 4.0.6000
208 HHVM provides a set of APIs for adding built-in functionality to the
209 runtime either by way of pure PHP code, or a combination of PHP and
213 %setup -q -n %{name}-HHVM-%{version} -a2 -a3
215 # handle git submodules
217 mv hhvm-third-party-* third-party
218 rmdir third-party/folly/src
219 mv folly-* third-party/folly/src
224 # prefer ones from system
225 rm CMake/FindBISON.cmake
226 rm CMake/FindFLEX.cmake
227 rm CMake/FindFreetype.cmake
230 # also in: hphp/tools/hphpize/hphpize.cmake
231 API=$(awk '/#define HHVM_API_VERSION/{v=$3; sub(/L$/, "", v); print v}' hphp/runtime/ext/extension.h)
233 if [ $API != %{hhvm_api_version} ]; then
234 echo "Set %%define hhvm_api_version to $API and re-run."
238 # out of dir build broken (can't find it's tools)
242 # handle cmake & ccache
243 # http://stackoverflow.com/questions/1815688/how-to-use-ccache-with-cmakec
244 # ASM fix: http://lists.busybox.net/pipermail/buildroot/2013-March/069436.html
245 if [[ "%{__cc}" = *ccache* ]]; then
249 -DCMAKE_C_COMPILER="ccache" -DCMAKE_C_COMPILER_ARG1="${cc#ccache }" \
250 -DCMAKE_CXX_COMPILER="ccache" -DCMAKE_CXX_COMPILER_ARG1="${cxx#ccache }" \
251 -DCMAKE_ASM_COMPILER="${cc#ccache }" \
257 -DCMAKE_PREFIX_PATH=%{_prefix} \
265 # setup COMPILER_ID/HHVM_REPO_SCHEMA so it doesn't look it up from our package git repo
266 # see hphp/util/generate-buildinfo.sh
267 export COMPILER_ID=HHVM-%{version}-%{release}-g%{githash}
268 export HHVM_REPO_SCHEMA=$(date +%N_%s)
273 # make install relinks all outputs which is very slow,
274 # so to speedup rebuild, use timestamps to record states
275 #test %{_specdir}/%{name}.spec -nt makeinstall.stamp && %{__rm} -f makeinstall.stamp
276 if [ ! -f makeinstall.stamp -o ! -d $RPM_BUILD_ROOT ]; then
277 rm -rf makeinstall.stamp installed.stamp $RPM_BUILD_ROOT
279 %{__make} install -C build \
281 DESTDIR=$RPM_BUILD_ROOT
283 touch makeinstall.stamp
286 rm -rf $RPM_BUILD_ROOT%{_docdir}
287 if [ ! -f installed.stamp ]; then
288 # begin install block
290 install -d $RPM_BUILD_ROOT{%{_sysconfdir}/%{name},%{_libdir}/%{name}}
291 cp -p %{SOURCE6} $RPM_BUILD_ROOT%{_sysconfdir}/%{name}
293 ln -s hhvm $RPM_BUILD_ROOT%{_bindir}/php
294 ln -s hhvm $RPM_BUILD_ROOT%{_bindir}/hphp
296 install -d $RPM_BUILD_ROOT%{_datadir}/%{name}/hdf
297 cp -p hphp/doc/mime.hdf $RPM_BUILD_ROOT%{_datadir}/%{name}/hdf/static.mime-types.hdf
299 # install fastcgi initscript
300 install -d $RPM_BUILD_ROOT/etc/{sysconfig,rc.d/init.d}
301 cp -p %{SOURCE4} $RPM_BUILD_ROOT/etc/rc.d/init.d/%{name}-fcgi
302 cp -p %{SOURCE5} $RPM_BUILD_ROOT/etc/sysconfig/%{name}-fcgi
304 install -p hphp/hack/bin/hh_{server,client} $RPM_BUILD_ROOT%{_bindir}
308 install -d $RPM_BUILD_ROOT%{_datadir}/cmake/Modules
309 cp -p CMake/*.cmake $RPM_BUILD_ROOT%{_datadir}/cmake/Modules
313 /HHVM_INCLUDE_DIRS/ s,$HPHP_HOME,%{_includedir},g
314 " hphp/tools/hphpize/hphpize.cmake > $RPM_BUILD_ROOT%{_datadir}/cmake/Modules/hphpize.cmake
318 set -- $(sed -ne 's/set(HHVM_INCLUDE_DIRS "\(.*\)")/\1/p' hphp/tools/hphpize/hphpize.cmake)
322 [[ "$dir" = $HPHP_HOME/hphp/* ]] && echo $dir
328 $HPHP_HOME/hphp/runtime \
329 $HPHP_HOME/hphp/util \
330 $HPHP_HOME/hphp/neo \
331 $HPHP_HOME/hphp/system \
332 $HPHP_HOME/hphp/parser \
334 echo "D %{_includedir}${dir#$HPHP_HOME}"
335 find $dir -name '*.h' | while read path; do
336 file=%{_includedir}${path#$HPHP_HOME}
338 install -Dp $path $RPM_BUILD_ROOT$file
344 # end of install block
345 touch installed.stamp; fi
348 rm -rf $RPM_BUILD_ROOT
350 %post -p /sbin/ldconfig
351 %postun -p /sbin/ldconfig
354 /sbin/chkconfig --add %{name}-fcgi
355 %service %{name}-fcgi restart
358 if [ "$1" = "0" ]; then
359 %service -q %{name}-fcgi stop
360 /sbin/chkconfig --del %{name}-fcgi
364 %defattr(644,root,root,755)
365 %doc README.md hphp/NEWS
366 %dir %{_sysconfdir}/%{name}
367 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/%{name}/php.ini
368 %attr(755,root,root) %{_bindir}/hhvm
369 %attr(755,root,root) %{_bindir}/hphp
370 %attr(755,root,root) %{_bindir}/hh_client
371 %attr(755,root,root) %{_bindir}/hh_server
373 %dir %{_datadir}/%{name}
374 %dir %{_datadir}/%{name}/hdf
375 %{_datadir}/%{name}/hdf/static.mime-types.hdf
378 %dir %{_libdir}/%{name}
381 %defattr(644,root,root,755)
382 %attr(754,root,root) /etc/rc.d/init.d/%{name}-fcgi
383 %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/%{name}-fcgi
386 %defattr(644,root,root,755)
387 %attr(755,root,root) %{_bindir}/php
390 %defattr(644,root,root,755)
391 %attr(755,root,root) %{_bindir}/hphpize
393 %dir %{_prefix}/lib/hphp
394 %{_prefix}/lib/hphp/CMake
395 %{_prefix}/lib/hphp/hphpize