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