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