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