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