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