]> git.pld-linux.org Git - packages/hhvm.git/blame - hhvm.spec
fix ccache enabled build, use separate build dir; cleanups
[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
449902dc
ER
24Patch0: ccache.patch
25Patch1: no-debug.patch
ff452300 26URL: https://github.com/facebook/hhvm/wiki
f7556a8c 27BuildRequires: ImageMagick-devel
9256e518 28BuildRequires: a52dec-libs-devel
b05f3896
ER
29BuildRequires: apr-devel
30BuildRequires: autoconf
3f49543c 31BuildRequires: binutils-devel
ed14b19f 32BuildRequires: boost-devel >= 1.50
745db304 33BuildRequires: cmake >= 2.8.5
ed14b19f
ER
34BuildRequires: curl-devel >= 7.29.0
35BuildRequires: elfutils-devel
3f49543c 36BuildRequires: expat-devel
5c61d46f 37BuildRequires: gcc >= 6:4.6.0
3f49543c 38BuildRequires: gd-devel
ed14b19f
ER
39BuildRequires: glog-devel >= 0.3.2
40BuildRequires: imap-devel >= 1:2007
991b3017 41#BuildRequires: jemalloc-devel >= 3.0.0
3f49543c 42BuildRequires: libcap-devel
04f13235 43BuildRequires: libdwarf-devel >= 20130729
ac2930bc 44BuildRequires: libicu-devel >= 4.2
be373886 45#BuildRequires: libmbfl-devel
ed14b19f 46BuildRequires: libmcrypt-devel
e883c14f 47BuildRequires: libmemcached-devel >= 1.0.4
491a5eb9 48BuildRequires: libstdc++-devel >= 6:4.8
ed14b19f 49BuildRequires: libunwind-devel
ac2930bc 50BuildRequires: libxml2-devel
9256e518 51BuildRequires: libxslt-devel
3f49543c 52BuildRequires: mysql-devel
04f13235 53BuildRequires: ocaml-findlib
ac2930bc 54BuildRequires: oniguruma-devel
3f49543c
ER
55BuildRequires: openssl-devel
56BuildRequires: pcre-devel
ed14b19f 57#BuildRequires: php-xhp-devel >= 1.3.9-6
ed14b19f 58BuildRequires: readline-devel
89ad59aa 59BuildRequires: rpmbuild(macros) >= 1.675
ed14b19f 60BuildRequires: tbb-devel >= 4.0.6000
3f49543c 61BuildRequires: zlib-devel
21df9de7
ER
62# check later, seem unused
63#BuildRequires: bison >= 2.3
64#BuildRequires: flex >= 2.5.35
65#BuildRequires: libafdt-devel >= 0.1.0
66#BuildRequires: re2c >= 0.13.0
9c2504b3 67# foreach (get_loaded_extensions() as $ext) printf("Provides:\tphp(%s)\n", strtolower($ext));
87330af7 68Provides: %{name}(api) = %{hhvm_api_version}
9c2504b3 69Provides: php(apache)
206caaaf
ER
70Provides: php(apc)
71Provides: php(bcmath)
991b3017 72Provides: php(bz2)
745db304 73Provides: php(calendar)
87330af7 74Provides: php(core) = %{php_version}
206caaaf
ER
75Provides: php(ctype)
76Provides: php(curl)
77Provides: php(date)
9c2504b3 78Provides: php(debugger)
206caaaf
ER
79Provides: php(dom)
80Provides: php(exif)
81Provides: php(fb)
991b3017 82Provides: php(fileinfo)
206caaaf 83Provides: php(filter)
745db304 84Provides: php(ftp)
206caaaf 85Provides: php(gd)
745db304 86Provides: php(gettext)
206caaaf 87Provides: php(hash)
9c2504b3
ER
88Provides: php(hh)
89Provides: php(hhvm.debugger)
90Provides: php(hhvm.ini)
206caaaf
ER
91Provides: php(hotprofiler)
92Provides: php(iconv)
206caaaf 93Provides: php(idn)
9c2504b3 94Provides: php(imagick)
206caaaf 95Provides: php(imap)
9c2504b3 96Provides: php(intl)
206caaaf
ER
97Provides: php(json)
98Provides: php(ldap)
9c2504b3 99Provides: php(libxml)
206caaaf
ER
100Provides: php(mbstring)
101Provides: php(mcrypt)
102Provides: php(memcache)
103Provides: php(memcached)
9c2504b3 104Provides: php(misc)
206caaaf 105Provides: php(mysql)
9c2504b3 106Provides: php(mysqli)
745db304 107Provides: php(oauth)
206caaaf
ER
108Provides: php(openssl)
109Provides: php(pcntl)
110Provides: php(pcre)
745db304 111Provides: php(pcre_zend_compat)
206caaaf
ER
112Provides: php(pdo)
113Provides: php(pdo_mysql)
114Provides: php(pdo_sqlite)
115Provides: php(phar)
116Provides: php(posix)
9c2504b3 117Provides: php(redis)
206caaaf
ER
118Provides: php(reflection)
119Provides: php(server)
120Provides: php(session)
121Provides: php(simplexml)
122Provides: php(soap)
123Provides: php(sockets)
124Provides: php(spl)
125Provides: php(sqlite3)
745db304
ER
126Provides: php(standard)
127Provides: php(standard_zend_compat)
9c2504b3 128Provides: php(stream)
206caaaf
ER
129Provides: php(sysvmsg)
130Provides: php(sysvsem)
131Provides: php(sysvshm)
132Provides: php(thread)
133Provides: php(thrift_protocol)
134Provides: php(tokenizer)
9c2504b3 135Provides: php(url)
745db304
ER
136Provides: php(wddx)
137Provides: php(xenon)
206caaaf
ER
138Provides: php(xhprof)
139Provides: php(xml)
140Provides: php(xmlreader)
141Provides: php(xmlwriter)
9c2504b3 142Provides: php(xsl)
745db304 143Provides: php(yaml)
991b3017 144Provides: php(zip)
206caaaf 145Provides: php(zlib)
991b3017 146Obsoletes: hiphop-php < 2.3.2-0.2
17c75ade 147ExclusiveArch: %{x8664}
65446f6c
ER
148BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
149
c171e0ff 150# must be in sync with source. extra check ensuring that it is so is done in %%build
87330af7
ER
151%define hhvm_api_version 20140702
152# hphp/system/idl/constants.idl.json defines it as 5.6.99-hhvm, but use some saner value
153%define php_version 5.6.0
c171e0ff 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
449902dc
ER
219%patch0 -p1
220%patch1 -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 226
ac2930bc 227%build
c171e0ff
ER
228# also in: hphp/tools/hphpize/hphpize.cmake
229API=$(awk '/#define HHVM_API_VERSION/{v=$3; sub(/L$/, "", v); print v}' hphp/runtime/ext/extension.h)
230
231if [ $API != %{hhvm_api_version} ]; then
232 echo "Set %%define hhvm_api_version to $API and re-run."
233 exit 1
234fi
235
e883c14f 236# out of dir build broken (can't find it's tools)
ef07ca95
ER
237install -d build
238cd build
449902dc
ER
239
240# handle cmake & ccache
241# http://stackoverflow.com/questions/1815688/how-to-use-ccache-with-cmakec
242# ASM fix: http://lists.busybox.net/pipermail/buildroot/2013-March/069436.html
243if [[ "%{__cc}" = *ccache* ]]; then
244 cc="%{__cc}"
245 cxx="%{__cxx}"
246 ccache="
247 -DCMAKE_C_COMPILER="ccache" -DCMAKE_C_COMPILER_ARG1="${cc#ccache }" \
248 -DCMAKE_CXX_COMPILER="ccache" -DCMAKE_CXX_COMPILER_ARG1="${cxx#ccache }" \
249 -DCMAKE_ASM_COMPILER="${cc#ccache }" \
250 "
251fi
e883c14f 252
ef07ca95 253%cmake \
449902dc 254 $ccache \
ef07ca95 255 -DCMAKE_PREFIX_PATH=%{_prefix} \
a0922d01 256 -DUSE_JEMALLOC=OFF \
be373886 257 -DUSE_TCMALLOC=OFF \
dc7e02ed 258 -DHPHP_NOTEST=ON \
449902dc 259 ../
c513fdf6
ER
260
261# setup COMPILER_ID/HHVM_REPO_SCHEMA so it doesn't look it up from our package git repo
262# see hphp/util/generate-buildinfo.sh
df52bbfc 263export COMPILER_ID=HHVM-%{version}-%{release}-%{githash}
c513fdf6
ER
264export HHVM_REPO_SCHEMA=$(date +%N_%s)
265
ac2930bc
ER
266%{__make}
267
65446f6c 268%install
745db304
ER
269# make install relinks all outputs which is very slow,
270# so to speedup rebuild, use timestamps to record states
271#test %{_specdir}/%{name}.spec -nt makeinstall.stamp && %{__rm} -f makeinstall.stamp
272if [ ! -f makeinstall.stamp -o ! -d $RPM_BUILD_ROOT ]; then
273 rm -rf makeinstall.stamp installed.stamp $RPM_BUILD_ROOT
8d9f731f 274
449902dc 275 %{__make} install -C build \
745db304
ER
276 HPHP_HOME__=$(pwd) \
277 DESTDIR=$RPM_BUILD_ROOT
278
279 touch makeinstall.stamp
280fi
281
282rm -rf $RPM_BUILD_ROOT%{_docdir}
283if [ ! -f installed.stamp ]; then
284install -d $RPM_BUILD_ROOT%{_sysconfdir}/%{name}
285# begin install block
9c2504b3 286
3234b364
ER
287ln -s hhvm $RPM_BUILD_ROOT%{_bindir}/php
288ln -s hhvm $RPM_BUILD_ROOT%{_bindir}/hphp
289
44fcba3e 290install -d $RPM_BUILD_ROOT%{_datadir}/%{name}/hdf
17307be4 291cp -p hphp/doc/mime.hdf $RPM_BUILD_ROOT%{_datadir}/%{name}/hdf/static.mime-types.hdf
44fcba3e 292
2347c3ae
ER
293# install fastcgi initscript
294install -d $RPM_BUILD_ROOT/etc/{sysconfig,rc.d/init.d}
745db304
ER
295cp -p %{SOURCE4} $RPM_BUILD_ROOT/etc/rc.d/init.d/%{name}-fcgi
296cp -p %{SOURCE5} $RPM_BUILD_ROOT/etc/sysconfig/%{name}-fcgi
2347c3ae 297
745db304 298%if 0
c6264399
ER
299# setup -devel
300install -d $RPM_BUILD_ROOT%{_datadir}/cmake/Modules
9c2504b3 301cp -p CMake/*.cmake $RPM_BUILD_ROOT%{_datadir}/cmake/Modules
c6264399
ER
302
303HPHP_HOME=$(pwd)
304sed -e "
305 /HHVM_INCLUDE_DIRS/ s,$HPHP_HOME,%{_includedir},g
306" hphp/tools/hphpize/hphpize.cmake > $RPM_BUILD_ROOT%{_datadir}/cmake/Modules/hphpize.cmake
307
308oIFS=$IFS
309IFS=";"
310set -- $(sed -ne 's/set(HHVM_INCLUDE_DIRS "\(.*\)")/\1/p' hphp/tools/hphpize/hphpize.cmake)
c6264399 311IFS=$oIFS
2a7c159c
ER
312set -- $(
313 for dir in "$@"; do
314 [[ "$dir" = $HPHP_HOME/hphp/* ]] && echo $dir
315 done
316)
317
318set +x
319for dir in "$@" \
320 $HPHP_HOME/hphp/runtime \
321 $HPHP_HOME/hphp/util \
322 $HPHP_HOME/hphp/neo \
323 $HPHP_HOME/hphp/system \
324 $HPHP_HOME/hphp/parser \
325; do
326 echo "D %{_includedir}${dir#$HPHP_HOME}"
327 find $dir -name '*.h' | while read path; do
328 file=%{_includedir}${path#$HPHP_HOME}
329 echo "F $file"
330 install -Dp $path $RPM_BUILD_ROOT$file
331 done
332done
333set -x
745db304
ER
334%endif
335
336# end of install block
337touch installed.stamp; fi
f6ea7eef 338
65446f6c
ER
339%clean
340rm -rf $RPM_BUILD_ROOT
341
8d9f731f
ER
342%post -p /sbin/ldconfig
343%postun -p /sbin/ldconfig
344
2347c3ae
ER
345%post fcgi
346/sbin/chkconfig --add %{name}-fcgi
347%service %{name}-fcgi restart
348
349%preun fcgi
350if [ "$1" = "0" ]; then
351 %service -q %{name}-fcgi stop
352 /sbin/chkconfig --del %{name}-fcgi
353fi
354
65446f6c
ER
355%files
356%defattr(644,root,root,755)
1c0ae000 357%doc README.md hphp/NEWS
349ae084 358%dir %{_sysconfdir}/%{name}
8d9f731f 359%attr(755,root,root) %{_bindir}/hhvm
3234b364 360%attr(755,root,root) %{_bindir}/hphp
44fcba3e
ER
361
362%dir %{_datadir}/%{name}
363%dir %{_datadir}/%{name}/hdf
364%{_datadir}/%{name}/hdf/static.mime-types.hdf
3234b364 365
2347c3ae
ER
366%files fcgi
367%defattr(644,root,root,755)
368%attr(754,root,root) /etc/rc.d/init.d/%{name}-fcgi
369%config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/%{name}-fcgi
370
3234b364
ER
371%files program
372%defattr(644,root,root,755)
373%attr(755,root,root) %{_bindir}/php
c6264399
ER
374
375%files devel
376%defattr(644,root,root,755)
377%attr(755,root,root) %{_bindir}/hphpize
378%{_includedir}/hphp
745db304
ER
379%dir %{_prefix}/lib/hphp
380%{_prefix}/lib/hphp/CMake
381%{_prefix}/lib/hphp/hphpize
This page took 0.12394 seconds and 4 git commands to generate.