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