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