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