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