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