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