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