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