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