]> git.pld-linux.org Git - packages/hhvm.git/blob - hhvm.spec
fix Extension API provides
[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 # must be in sync with source. extra check ensuring that it is so is done in %%build
19 %define         hhvm_api_version        20140829
20 # git show HHVM-3.3.1
21 %define         githash e0c98e21167b425dddf1fc9efe78c9f7a36db268
22 # these hashes are git submodules (be sure to check them on proper branch)
23 %define         thirdparty      fdef620
24 %define         folly           6e46d46
25 Summary:        Virtual Machine, Runtime, and JIT for PHP
26 Name:           hhvm
27 Version:        3.3.1
28 Release:        2
29 License:        PHP 3.01 and BSD
30 Group:          Development/Languages
31 Source0:        https://github.com/facebook/hhvm/archive/HHVM-%{version}.tar.gz
32 # Source0-md5:  bab9490837ff4f54f295bbcf428d7a1c
33 Source2:        https://github.com/facebook/folly/archive/%{folly}/folly-3.2-%{folly}.tar.gz
34 # Source2-md5:  c4bdbea4c0ffe0650d12d9ff370b8255
35 Source3:        https://github.com/hhvm/hhvm-third-party/archive/%{thirdparty}/third_party-%{thirdparty}.tar.gz
36 # Source3-md5:  63858096c50c172d6c45ddb3d9b6d721
37 Source5:        %{name}-fcgi.init
38 Source6:        %{name}-fcgi.sysconfig
39 Source7:        php.ini
40 Source100:      get-source.sh
41 Patch1:         no-debug.patch
42 Patch2:         hphpize.patch
43 Patch3:         MAX.patch
44 Patch4:         system-thirdparty.patch
45 URL:            https://github.com/facebook/hhvm/wiki
46 BuildRequires:  ImageMagick-devel
47 BuildRequires:  a52dec-libs-devel
48 BuildRequires:  apr-devel
49 BuildRequires:  autoconf
50 BuildRequires:  binutils-devel
51 # CMake/HPHPFindLibs.cmake:364 - FIND_LIBRARY (BFD_LIB libbfd.a)
52 BuildRequires:  binutils-static
53 BuildRequires:  boost-devel >= 1.50
54 BuildRequires:  cmake >= 2.8.5
55 BuildRequires:  curl-devel >= 7.29.0
56 %{?with_system_dconv:BuildRequires:     double-conversion-devel >= 1.1.1}
57 BuildRequires:  elfutils-devel
58 BuildRequires:  expat-devel
59 %{?with_system_fastlz:BuildRequires:    fastlz-devel >= 0.1.0-0.r12}
60 BuildRequires:  gcc >= 6:4.6.0
61 BuildRequires:  gd-devel
62 BuildRequires:  glog-devel >= 0.3.2
63 BuildRequires:  imap-devel >= 1:2007
64 #BuildRequires: jemalloc-devel >= 3.0.0
65 %{?with_system_libafdt:BuildRequires:   libafdt-devel >= 0.1.0}
66 %{?with_system_libzip:BuildRequires:    libzip-devel >= 0.11.2}
67 BuildRequires:  libcap-devel
68 BuildRequires:  libdwarf-devel >= 20130729
69 BuildRequires:  libicu-devel >= 4.2
70 #BuildRequires: libmbfl-devel
71 BuildRequires:  libmcrypt-devel
72 BuildRequires:  libmemcached-devel >= 1.0.4
73 BuildRequires:  libstdc++-devel >= 6:4.8
74 BuildRequires:  libunwind-devel
75 BuildRequires:  libxml2-devel
76 BuildRequires:  libxslt-devel
77 %{?with_system_lz4:BuildRequires:       lz4-devel >= 0.0-1.r119}
78 BuildRequires:  mysql-devel
79 BuildRequires:  ocaml-findlib
80 BuildRequires:  oniguruma-devel
81 BuildRequires:  openssl-devel
82 BuildRequires:  pcre-devel >= 8.32
83 #BuildRequires: php-xhp-devel >= 1.3.9-6
84 BuildRequires:  readline-devel
85 BuildRequires:  rpmbuild(macros) >= 1.675
86 %{?with_system_sqlite:BuildRequires:    sqlite3-devel >= 3.7.15.2}
87 BuildRequires:  tbb-devel >= 4.0.6000
88 BuildRequires:  zlib-devel
89 # check later, seem unused
90 #BuildRequires: bison >= 2.3
91 #BuildRequires: flex >= 2.5.35
92 #BuildRequires: libafdt-devel >= 0.1.0
93 #BuildRequires: re2c >= 0.13.0
94 Provides:       %{name}(api) = %{hhvm_api_version}
95 Provides:       php(core) = %{php_version}
96 # foreach (get_loaded_extensions() as $ext) printf("Provides:\tphp(%s)\n", strtolower($ext));
97 Provides:       php(apc)
98 Provides:       php(bcmath)
99 Provides:       php(bz2)
100 Provides:       php(calendar)
101 Provides:       php(ctype)
102 Provides:       php(curl)
103 Provides:       php(date)
104 Provides:       php(debugger)
105 Provides:       php(dom)
106 Provides:       php(enum)
107 Provides:       php(exif)
108 Provides:       php(fb)
109 Provides:       php(fileinfo)
110 Provides:       php(filter)
111 Provides:       php(ftp)
112 Provides:       php(gd)
113 Provides:       php(gettext)
114 Provides:       php(gmp)
115 Provides:       php(hash)
116 Provides:       php(hh)
117 Provides:       php(hhvm.debugger)
118 Provides:       php(hhvm.ini)
119 Provides:       php(hotprofiler)
120 Provides:       php(iconv)
121 Provides:       php(idn)
122 Provides:       php(imagick)
123 Provides:       php(imap)
124 Provides:       php(intl)
125 Provides:       php(json)
126 Provides:       php(ldap)
127 Provides:       php(libxml)
128 Provides:       php(mail)
129 Provides:       php(mailparse)
130 Provides:       php(mbstring)
131 Provides:       php(mcrypt)
132 Provides:       php(memcache)
133 Provides:       php(memcached)
134 Provides:       php(mysql)
135 Provides:       php(mysqli)
136 Provides:       php(oauth)
137 Provides:       php(openssl)
138 Provides:       php(pcntl)
139 Provides:       php(pcre)
140 Provides:       php(pcre_zend_compat)
141 Provides:       php(pdo)
142 Provides:       php(pdo_mysql)
143 Provides:       php(pdo_sqlite)
144 Provides:       php(phar)
145 Provides:       php(posix)
146 Provides:       php(redis)
147 Provides:       php(reflection)
148 Provides:       php(server)
149 Provides:       php(session)
150 Provides:       php(simplexml)
151 Provides:       php(soap)
152 Provides:       php(sockets)
153 Provides:       php(spl)
154 Provides:       php(sqlite3)
155 Provides:       php(standard)
156 Provides:       php(standard_zend_compat)
157 Provides:       php(stream)
158 Provides:       php(sysvmsg)
159 Provides:       php(sysvsem)
160 Provides:       php(sysvshm)
161 Provides:       php(thread)
162 Provides:       php(thrift_protocol)
163 Provides:       php(tokenizer)
164 Provides:       php(url)
165 Provides:       php(wddx)
166 Provides:       php(xenon)
167 Provides:       php(xhprof)
168 Provides:       php(xml)
169 Provides:       php(xmlreader)
170 Provides:       php(xmlwriter)
171 Provides:       php(xsl)
172 Provides:       php(yaml)
173 Provides:       php(zip)
174 Provides:       php(zlib)
175 Obsoletes:      hiphop-php < 2.3.2-0.2
176 ExclusiveArch:  %{x8664}
177 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
178
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.106915 seconds and 4 git commands to generate.