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