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