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