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