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