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