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