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