]> git.pld-linux.org Git - packages/hhvm.git/blame - hhvm.spec
rel 1
[packages/hhvm.git] / hhvm.spec
CommitLineData
fd4a736f
ER
1#
2# Conditional build:
3%bcond_without system_dconv # system double-conversion
4%bcond_without system_sqlite # system sqlite3
5%bcond_without system_lz4 # system lz4
e494b5cb
ER
6%bcond_without system_fastlz # system fastlz
7%bcond_without system_libafdt # system libafdt
c19fc9d9 8%bcond_without system_libzip # system libzip
fd4a736f 9
b682fdb1
ER
10# TODO
11# - system xhp
12# - system proxygen
13# - system thrift
14
89ad59aa
ER
15# NOTES:
16# - hphp/runtime/base/runtime-option.cpp evalJitDefault enables jit if /.hhvm-jit exists (yes, in filesystem root)
b682fdb1 17
20de90ba
ER
18# git show HHVM-3.3.1
19%define githash e0c98e21167b425dddf1fc9efe78c9f7a36db268
b682fdb1 20# these hashes are git submodules (be sure to check them on proper branch)
20de90ba 21%define thirdparty fdef620
b682fdb1 22%define folly 6e46d46
ed14b19f 23Summary: Virtual Machine, Runtime, and JIT for PHP
aa7908cc 24Name: hhvm
20de90ba 25Version: 3.3.1
2f0661f8 26Release: 1
6135817a 27License: PHP 3.01 and BSD
ac2930bc 28Group: Development/Languages
aa7908cc 29Source0: https://github.com/facebook/hhvm/archive/HHVM-%{version}.tar.gz
20de90ba
ER
30# Source0-md5: bab9490837ff4f54f295bbcf428d7a1c
31Source2: https://github.com/facebook/folly/archive/%{folly}/folly-3.2-%{folly}.tar.gz
32# Source2-md5: c4bdbea4c0ffe0650d12d9ff370b8255
745db304 33Source3: https://github.com/hhvm/hhvm-third-party/archive/%{thirdparty}/third_party-%{thirdparty}.tar.gz
20de90ba 34# Source3-md5: 63858096c50c172d6c45ddb3d9b6d721
6135817a
ER
35Source5: %{name}-fcgi.init
36Source6: %{name}-fcgi.sysconfig
37Source7: php.ini
991b3017 38Source100: get-source.sh
449902dc 39Patch1: no-debug.patch
e66c75f6 40Patch2: hphpize.patch
3e79618f 41Patch3: MAX.patch
142dde19 42Patch4: system-thirdparty.patch
ff452300 43URL: https://github.com/facebook/hhvm/wiki
f7556a8c 44BuildRequires: ImageMagick-devel
9256e518 45BuildRequires: a52dec-libs-devel
b05f3896
ER
46BuildRequires: apr-devel
47BuildRequires: autoconf
3f49543c 48BuildRequires: binutils-devel
6135817a
ER
49# CMake/HPHPFindLibs.cmake:364 - FIND_LIBRARY (BFD_LIB libbfd.a)
50BuildRequires: binutils-static
ed14b19f 51BuildRequires: boost-devel >= 1.50
745db304 52BuildRequires: cmake >= 2.8.5
ed14b19f 53BuildRequires: curl-devel >= 7.29.0
fd4a736f 54%{?with_system_dconv:BuildRequires: double-conversion-devel >= 1.1.1}
ed14b19f 55BuildRequires: elfutils-devel
3f49543c 56BuildRequires: expat-devel
e494b5cb 57%{?with_system_fastlz:BuildRequires: fastlz-devel >= 0.1.0-0.r12}
5c61d46f 58BuildRequires: gcc >= 6:4.6.0
3f49543c 59BuildRequires: gd-devel
ed14b19f
ER
60BuildRequires: glog-devel >= 0.3.2
61BuildRequires: imap-devel >= 1:2007
991b3017 62#BuildRequires: jemalloc-devel >= 3.0.0
e494b5cb 63%{?with_system_libafdt:BuildRequires: libafdt-devel >= 0.1.0}
c19fc9d9 64%{?with_system_libzip:BuildRequires: libzip-devel >= 0.11.2}
3f49543c 65BuildRequires: libcap-devel
04f13235 66BuildRequires: libdwarf-devel >= 20130729
ac2930bc 67BuildRequires: libicu-devel >= 4.2
be373886 68#BuildRequires: libmbfl-devel
ed14b19f 69BuildRequires: libmcrypt-devel
e883c14f 70BuildRequires: libmemcached-devel >= 1.0.4
491a5eb9 71BuildRequires: libstdc++-devel >= 6:4.8
ed14b19f 72BuildRequires: libunwind-devel
ac2930bc 73BuildRequires: libxml2-devel
9256e518 74BuildRequires: libxslt-devel
fd4a736f 75%{?with_system_lz4:BuildRequires: lz4-devel >= 0.0-1.r119}
3f49543c 76BuildRequires: mysql-devel
04f13235 77BuildRequires: ocaml-findlib
ac2930bc 78BuildRequires: oniguruma-devel
3f49543c 79BuildRequires: openssl-devel
fd4a736f 80BuildRequires: pcre-devel >= 8.32
ed14b19f 81#BuildRequires: php-xhp-devel >= 1.3.9-6
ed14b19f 82BuildRequires: readline-devel
89ad59aa 83BuildRequires: rpmbuild(macros) >= 1.675
fd4a736f 84%{?with_system_sqlite:BuildRequires: sqlite3-devel >= 3.7.15.2}
ed14b19f 85BuildRequires: tbb-devel >= 4.0.6000
3f49543c 86BuildRequires: zlib-devel
21df9de7
ER
87# check later, seem unused
88#BuildRequires: bison >= 2.3
89#BuildRequires: flex >= 2.5.35
90#BuildRequires: libafdt-devel >= 0.1.0
91#BuildRequires: re2c >= 0.13.0
87330af7 92Provides: %{name}(api) = %{hhvm_api_version}
c91d719c
ER
93Provides: php(core) = %{php_version}
94# foreach (get_loaded_extensions() as $ext) printf("Provides:\tphp(%s)\n", strtolower($ext));
206caaaf
ER
95Provides: php(apc)
96Provides: php(bcmath)
991b3017 97Provides: php(bz2)
745db304 98Provides: php(calendar)
206caaaf
ER
99Provides: php(ctype)
100Provides: php(curl)
101Provides: php(date)
9c2504b3 102Provides: php(debugger)
206caaaf 103Provides: php(dom)
c91d719c 104Provides: php(enum)
206caaaf
ER
105Provides: php(exif)
106Provides: php(fb)
991b3017 107Provides: php(fileinfo)
206caaaf 108Provides: php(filter)
745db304 109Provides: php(ftp)
206caaaf 110Provides: php(gd)
745db304 111Provides: php(gettext)
c91d719c 112Provides: php(gmp)
206caaaf 113Provides: php(hash)
9c2504b3
ER
114Provides: php(hh)
115Provides: php(hhvm.debugger)
116Provides: php(hhvm.ini)
206caaaf
ER
117Provides: php(hotprofiler)
118Provides: php(iconv)
206caaaf 119Provides: php(idn)
9c2504b3 120Provides: php(imagick)
206caaaf 121Provides: php(imap)
9c2504b3 122Provides: php(intl)
206caaaf
ER
123Provides: php(json)
124Provides: php(ldap)
9c2504b3 125Provides: php(libxml)
c91d719c
ER
126Provides: php(mail)
127Provides: php(mailparse)
206caaaf
ER
128Provides: php(mbstring)
129Provides: php(mcrypt)
130Provides: php(memcache)
131Provides: php(memcached)
132Provides: php(mysql)
9c2504b3 133Provides: php(mysqli)
745db304 134Provides: php(oauth)
206caaaf
ER
135Provides: php(openssl)
136Provides: php(pcntl)
137Provides: php(pcre)
745db304 138Provides: php(pcre_zend_compat)
206caaaf
ER
139Provides: php(pdo)
140Provides: php(pdo_mysql)
141Provides: php(pdo_sqlite)
142Provides: php(phar)
143Provides: php(posix)
9c2504b3 144Provides: php(redis)
206caaaf
ER
145Provides: php(reflection)
146Provides: php(server)
147Provides: php(session)
148Provides: php(simplexml)
149Provides: php(soap)
150Provides: php(sockets)
151Provides: php(spl)
152Provides: php(sqlite3)
745db304
ER
153Provides: php(standard)
154Provides: php(standard_zend_compat)
9c2504b3 155Provides: php(stream)
206caaaf
ER
156Provides: php(sysvmsg)
157Provides: php(sysvsem)
158Provides: php(sysvshm)
159Provides: php(thread)
160Provides: php(thrift_protocol)
161Provides: php(tokenizer)
9c2504b3 162Provides: php(url)
745db304
ER
163Provides: php(wddx)
164Provides: php(xenon)
206caaaf
ER
165Provides: php(xhprof)
166Provides: php(xml)
167Provides: php(xmlreader)
168Provides: php(xmlwriter)
9c2504b3 169Provides: php(xsl)
745db304 170Provides: php(yaml)
991b3017 171Provides: php(zip)
206caaaf 172Provides: php(zlib)
991b3017 173Obsoletes: hiphop-php < 2.3.2-0.2
17c75ade 174ExclusiveArch: %{x8664}
65446f6c
ER
175BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
176
c171e0ff 177# must be in sync with source. extra check ensuring that it is so is done in %%build
6135817a 178%define hhvm_api_version 20140829
87330af7
ER
179# hphp/system/idl/constants.idl.json defines it as 5.6.99-hhvm, but use some saner value
180%define php_version 5.6.0
c171e0ff 181
6135817a
ER
182%define hhvm_extensiondir %{_libdir}/hhvm
183
65446f6c 184%description
aa7908cc
ER
185HHVM (aka the HipHop Virtual Machine) is a new open-source virtual
186machine designed for executing programs written in PHP. HHVM uses a
187just-in-time compilation approach to achieve superior performance
188while maintaining the flexibility that PHP developers are accustomed
189to. To date, HHVM (and its predecessor HPHPc before it) has realized
190over a 9x increase in web request throughput and over a 5x reduction
191in memory consumption for Facebook compared with the Zend PHP 5.2
192engine + APC.
193
194HHVM can be run as a standalone webserver (i.e. without the Apache
195webserver and the "mod_php" extension). HHVM can also be used together
196with a FastCGI-based webserver, and work is in progress to make HHVM
197work smoothly with Apache.
65446f6c 198
2347c3ae
ER
199%package fcgi
200Summary: Init script to start HHVM as FastCGI daemon
201Group: Development/Languages/PHP
202Requires: %{name} = %{version}-%{release}
203Provides: php(fcgi)
204Requires(post,preun): /sbin/chkconfig
205Requires: rc-scripts
206
207%description fcgi
208Init script to start HHVM as FastCGI daemon
209
3234b364
ER
210%package program
211Summary: /usr/bin/php symlink
212Summary(pl.UTF-8): Dowiązanie symboliczne /usr/bin/php
213Group: Development/Languages/PHP
214Requires: %{name} = %{version}-%{release}
215Obsoletes: /usr/bin/php
216
217%description program
218Package providing /usr/bin/php symlink to PHP CLI.
219
220%description program -l pl.UTF-8
221Pakiet dostarczający dowiązanie symboliczne /usr/bin/php do PHP CLI.
222
c6264399
ER
223%package devel
224Summary: Files for HHVM modules development
225Group: Development/Languages/PHP
226URL: https://github.com/facebook/hhvm/wiki/Extension-API
f6ea7eef 227Requires: boost-devel >= 1.50
c6264399 228Requires: cmake >= 2.8.5
f6ea7eef 229Requires: glog-devel >= 0.3.2
e7779ee6 230Requires: libstdc++-devel >= 6:4.3
f6ea7eef
ER
231Requires: tbb-devel >= 4.0.6000
232Requires: zlib-devel
c6264399
ER
233
234%description devel
235HHVM provides a set of APIs for adding built-in functionality to the
236runtime either by way of pure PHP code, or a combination of PHP and
237C++.
238
65446f6c 239%prep
20de90ba 240%setup -q -n %{name}-HHVM-%{version} -a2 -a3
991b3017 241
745db304
ER
242# handle git submodules
243rmdir third-party
244mv hhvm-third-party-* third-party
245rmdir third-party/folly/src
246mv folly-* third-party/folly/src
f8472382 247
449902dc 248%patch1 -p1
e66c75f6 249%patch2 -p1
3e79618f 250%patch3 -p1
142dde19 251%patch4 -p1
ed14b19f 252
c6264399 253# prefer ones from system
20e9b450 254rm CMake/FindBISON.cmake
20e9b450 255rm CMake/FindFLEX.cmake
b17fa9dd 256rm CMake/FindFreetype.cmake
ed14b19f 257
40280c0c 258# ensure system libs get used
5ed97fec
ER
259# NOTE: keep sqlite dir, build breaks with 3.8.5.0
260
40280c0c
ER
261cd third-party
262rm -r pcre \
40280c0c
ER
263 %{?with_system_lz4:lz4} \
264 %{?with_system_dconv:double-conversion} \
265 %{?with_system_fastlz:fastlz} \
266 %{?with_system_libafdt:libafdt} \
c19fc9d9 267 %{?with_system_libzip:libzip} \
40280c0c
ER
268 %{nil}
269
ac2930bc 270%build
c171e0ff
ER
271# also in: hphp/tools/hphpize/hphpize.cmake
272API=$(awk '/#define HHVM_API_VERSION/{v=$3; sub(/L$/, "", v); print v}' hphp/runtime/ext/extension.h)
273
274if [ $API != %{hhvm_api_version} ]; then
275 echo "Set %%define hhvm_api_version to $API and re-run."
276 exit 1
277fi
278
20de90ba
ER
279# out of dir build broken (can't find it's tools, or headers)
280#install -d build
281#cd build
449902dc
ER
282
283# handle cmake & ccache
8dff2648 284# http://stackoverflow.com/questions/1815688/how-to-use-ccache-with-cmake
449902dc
ER
285# ASM fix: http://lists.busybox.net/pipermail/buildroot/2013-March/069436.html
286if [[ "%{__cc}" = *ccache* ]]; then
287 cc="%{__cc}"
288 cxx="%{__cxx}"
289 ccache="
290 -DCMAKE_C_COMPILER="ccache" -DCMAKE_C_COMPILER_ARG1="${cc#ccache }" \
291 -DCMAKE_CXX_COMPILER="ccache" -DCMAKE_CXX_COMPILER_ARG1="${cxx#ccache }" \
292 -DCMAKE_ASM_COMPILER="${cc#ccache }" \
293 "
294fi
e883c14f 295
ef07ca95 296%cmake \
449902dc 297 $ccache \
ef07ca95 298 -DCMAKE_PREFIX_PATH=%{_prefix} \
6135817a 299 -DHHVM_DYNAMIC_EXTENSION_DIR=%{hhvm_extensiondir} \
a0922d01 300 -DUSE_JEMALLOC=OFF \
be373886 301 -DUSE_TCMALLOC=OFF \
dc7e02ed 302 -DHPHP_NOTEST=ON \
142dde19 303 -DSYSTEM_PCRE=ON \
fd4a736f
ER
304 %{?with_system_sqlite:-DSYSTEM_SQLITE3=ON} \
305 %{?with_system_lz4:-DSYSTEM_LZ4=ON} \
306 %{?with_system_dconv:-DSYSTEM_DOUBLE_CONVERSION=ON} \
e494b5cb
ER
307 %{?with_system_fastlz:-DSYSTEM_FASTLZ=ON} \
308 %{?with_system_libafdt:-DSYSTEM_LIBAFDT=ON} \
c19fc9d9 309 %{?with_system_libzip:-DSYSTEM_LIBZIP=ON} \
541d5ea6 310 -DENABLE_COTIRE=ON \
20de90ba 311 .
ac3c6624 312
c513fdf6
ER
313# setup COMPILER_ID/HHVM_REPO_SCHEMA so it doesn't look it up from our package git repo
314# see hphp/util/generate-buildinfo.sh
ac3c6624 315export COMPILER_ID=HHVM-%{version}-%{release}-g%{githash}
c513fdf6
ER
316export HHVM_REPO_SCHEMA=$(date +%N_%s)
317
ac2930bc
ER
318%{__make}
319
65446f6c 320%install
745db304
ER
321# make install relinks all outputs which is very slow,
322# so to speedup rebuild, use timestamps to record states
323#test %{_specdir}/%{name}.spec -nt makeinstall.stamp && %{__rm} -f makeinstall.stamp
324if [ ! -f makeinstall.stamp -o ! -d $RPM_BUILD_ROOT ]; then
325 rm -rf makeinstall.stamp installed.stamp $RPM_BUILD_ROOT
8d9f731f 326
8dff2648 327 %{__make} install \
745db304
ER
328 DESTDIR=$RPM_BUILD_ROOT
329
330 touch makeinstall.stamp
331fi
332
333rm -rf $RPM_BUILD_ROOT%{_docdir}
334if [ ! -f installed.stamp ]; then
745db304 335# begin install block
9c2504b3 336
073742e0 337install -d $RPM_BUILD_ROOT{%{_sysconfdir}/%{name},%{_libdir}/%{name}}
6135817a 338cp -p %{SOURCE7} $RPM_BUILD_ROOT%{_sysconfdir}/%{name}
c3ecb766 339
3234b364
ER
340ln -s hhvm $RPM_BUILD_ROOT%{_bindir}/php
341ln -s hhvm $RPM_BUILD_ROOT%{_bindir}/hphp
342
44fcba3e 343install -d $RPM_BUILD_ROOT%{_datadir}/%{name}/hdf
17307be4 344cp -p hphp/doc/mime.hdf $RPM_BUILD_ROOT%{_datadir}/%{name}/hdf/static.mime-types.hdf
44fcba3e 345
2347c3ae
ER
346# install fastcgi initscript
347install -d $RPM_BUILD_ROOT/etc/{sysconfig,rc.d/init.d}
6135817a
ER
348cp -p %{SOURCE5} $RPM_BUILD_ROOT/etc/rc.d/init.d/%{name}-fcgi
349cp -p %{SOURCE6} $RPM_BUILD_ROOT/etc/sysconfig/%{name}-fcgi
2347c3ae 350
ac3c6624
ER
351install -p hphp/hack/bin/hh_{server,client} $RPM_BUILD_ROOT%{_bindir}
352
745db304 353%if 0
c6264399
ER
354# setup -devel
355install -d $RPM_BUILD_ROOT%{_datadir}/cmake/Modules
9c2504b3 356cp -p CMake/*.cmake $RPM_BUILD_ROOT%{_datadir}/cmake/Modules
c6264399
ER
357
358HPHP_HOME=$(pwd)
359sed -e "
360 /HHVM_INCLUDE_DIRS/ s,$HPHP_HOME,%{_includedir},g
361" hphp/tools/hphpize/hphpize.cmake > $RPM_BUILD_ROOT%{_datadir}/cmake/Modules/hphpize.cmake
362
363oIFS=$IFS
364IFS=";"
365set -- $(sed -ne 's/set(HHVM_INCLUDE_DIRS "\(.*\)")/\1/p' hphp/tools/hphpize/hphpize.cmake)
c6264399 366IFS=$oIFS
2a7c159c
ER
367set -- $(
368 for dir in "$@"; do
369 [[ "$dir" = $HPHP_HOME/hphp/* ]] && echo $dir
370 done
371)
372
373set +x
374for dir in "$@" \
375 $HPHP_HOME/hphp/runtime \
376 $HPHP_HOME/hphp/util \
377 $HPHP_HOME/hphp/neo \
378 $HPHP_HOME/hphp/system \
379 $HPHP_HOME/hphp/parser \
380; do
381 echo "D %{_includedir}${dir#$HPHP_HOME}"
382 find $dir -name '*.h' | while read path; do
383 file=%{_includedir}${path#$HPHP_HOME}
384 echo "F $file"
385 install -Dp $path $RPM_BUILD_ROOT$file
386 done
387done
388set -x
745db304
ER
389%endif
390
391# end of install block
392touch installed.stamp; fi
f6ea7eef 393
65446f6c
ER
394%clean
395rm -rf $RPM_BUILD_ROOT
396
8d9f731f
ER
397%post -p /sbin/ldconfig
398%postun -p /sbin/ldconfig
399
2347c3ae
ER
400%post fcgi
401/sbin/chkconfig --add %{name}-fcgi
402%service %{name}-fcgi restart
403
404%preun fcgi
405if [ "$1" = "0" ]; then
406 %service -q %{name}-fcgi stop
407 /sbin/chkconfig --del %{name}-fcgi
408fi
409
65446f6c
ER
410%files
411%defattr(644,root,root,755)
1c0ae000 412%doc README.md hphp/NEWS
349ae084 413%dir %{_sysconfdir}/%{name}
c3ecb766 414%config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/%{name}/php.ini
8d9f731f 415%attr(755,root,root) %{_bindir}/hhvm
3234b364 416%attr(755,root,root) %{_bindir}/hphp
ac3c6624
ER
417%attr(755,root,root) %{_bindir}/hh_client
418%attr(755,root,root) %{_bindir}/hh_server
44fcba3e
ER
419
420%dir %{_datadir}/%{name}
421%dir %{_datadir}/%{name}/hdf
422%{_datadir}/%{name}/hdf/static.mime-types.hdf
3234b364 423
073742e0
ER
424# dir for extensions
425%dir %{_libdir}/%{name}
426
2347c3ae
ER
427%files fcgi
428%defattr(644,root,root,755)
429%attr(754,root,root) /etc/rc.d/init.d/%{name}-fcgi
430%config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/%{name}-fcgi
431
3234b364
ER
432%files program
433%defattr(644,root,root,755)
434%attr(755,root,root) %{_bindir}/php
c6264399
ER
435
436%files devel
437%defattr(644,root,root,755)
438%attr(755,root,root) %{_bindir}/hphpize
439%{_includedir}/hphp
e35a4289
ER
440%dir %{_libdir}/hhvm
441%{_libdir}/hhvm/CMake
442%{_libdir}/hhvm/hphpize
This page took 0.101336 seconds and 4 git commands to generate.