]> git.pld-linux.org Git - packages/hhvm.git/blob - hhvm.spec
update githash for compiler-id
[packages/hhvm.git] / hhvm.spec
1 # NOTES:
2 # - hphp/runtime/base/runtime-option.cpp evalJitDefault enables jit if /.hhvm-jit exists (yes, in filesystem root)
3 # TODO
4 # - system libevent2: https://github.com/facebook/hiphop-php/pull/421
5 # - system libmbfl, system xhp, sqlite3
6 # - libdwarf>20120410 issue: https://github.com/facebook/hhvm/issues/1337
7 # git show HHVM-2.4.1
8 %define         githash 072ec429a4c42b481aabaa8bca0210b288a8d55e
9 %define         folly   18bedc2
10 Summary:        Virtual Machine, Runtime, and JIT for PHP
11 Name:           hhvm
12 Version:        2.4.1
13 Release:        0.1
14 License:        PHP 3.01
15 Group:          Development/Languages
16 Source0:        https://github.com/facebook/hhvm/archive/HHVM-%{version}.tar.gz
17 # Source0-md5:  a18dde8a30f8293963e6641ee8cb04c8
18 # need fb.changes.patch, which is available for 1.4 only
19 Source1:        http://www.monkey.org/~provos/libevent-1.4.14b-stable.tar.gz
20 # Source1-md5:  a00e037e4d3f9e4fe9893e8a2d27918c
21 Source2:        https://github.com/facebook/folly/archive/%{folly}/folly-0.1-%{folly}.tar.gz
22 # Source2-md5:  5de02fa81641c66a93c2f57094c7aa72
23 Source3:        %{name}-fcgi.init
24 Source4:        %{name}-fcgi.sysconfig
25 Source100:      get-source.sh
26 Patch0:         cmake-missing-library.patch
27 Patch1:         libevent14.patch
28 Patch3:         system-xhp.patch
29 Patch4:         system-libafdt.patch
30 Patch5:         system-folly.patch
31 Patch8:         hphpize.patch
32 Patch9:         notest.patch
33 Patch10:        no-debug.patch
34 URL:            http://wiki.github.com/facebook/hiphop-php/
35 BuildRequires:  apr-devel
36 BuildRequires:  autoconf
37 BuildRequires:  binutils-devel
38 BuildRequires:  boost-devel >= 1.50
39 BuildRequires:  cmake >= 2.8.7
40 BuildRequires:  curl-devel >= 7.29.0
41 BuildRequires:  elfutils-devel
42 BuildRequires:  expat-devel
43 BuildRequires:  gcc >= 6:4.6.0
44 BuildRequires:  gd-devel
45 BuildRequires:  glog-devel >= 0.3.2
46 BuildRequires:  imap-devel >= 1:2007
47 #BuildRequires: jemalloc-devel >= 3.0.0
48 BuildRequires:  libcap-devel
49 BuildRequires:  libdwarf-devel <= 20120410
50 #BuildRequires: libevent-devel >= 1.4.14
51 BuildRequires:  libicu-devel >= 4.2
52 #BuildRequires: libmbfl-devel
53 BuildRequires:  libmcrypt-devel
54 BuildRequires:  libmemcached-devel >= 1.0.4
55 BuildRequires:  libstdc++-devel >= 6:4.3
56 BuildRequires:  libunwind-devel
57 BuildRequires:  libxml2-devel
58 BuildRequires:  mysql-devel
59 BuildRequires:  oniguruma-devel
60 BuildRequires:  openssl-devel
61 BuildRequires:  pcre-devel
62 #BuildRequires: php-xhp-devel >= 1.3.9-6
63 BuildRequires:  readline-devel
64 BuildRequires:  rpmbuild(macros) >= 1.675
65 BuildRequires:  tbb-devel >= 4.0.6000
66 BuildRequires:  zlib-devel
67 # check later, seem unused
68 #BuildRequires: bison >= 2.3
69 #BuildRequires: flex >= 2.5.35
70 #BuildRequires: libafdt-devel >= 0.1.0
71 #BuildRequires: re2c >= 0.13.0
72 Provides:       php(apc)
73 Provides:       php(bcmath)
74 Provides:       php(bz2)
75 Provides:       php(ctype)
76 Provides:       php(curl)
77 Provides:       php(date)
78 Provides:       php(dom)
79 Provides:       php(exif)
80 Provides:       php(fb)
81 Provides:       php(fileinfo)
82 Provides:       php(filter)
83 Provides:       php(gd)
84 Provides:       php(hash)
85 Provides:       php(hotprofiler)
86 Provides:       php(iconv)
87 Provides:       php(icu_num_fmt)
88 Provides:       php(icu_ucsdet)
89 Provides:       php(icu_uspoof)
90 Provides:       php(idn)
91 Provides:       php(imap)
92 Provides:       php(json)
93 Provides:       php(ldap)
94 Provides:       php(mbstring)
95 Provides:       php(mcrypt)
96 Provides:       php(memcache)
97 Provides:       php(memcached)
98 Provides:       php(mysql)
99 Provides:       php(openssl)
100 Provides:       php(pcntl)
101 Provides:       php(pcre)
102 Provides:       php(pdo)
103 Provides:       php(pdo_mysql)
104 Provides:       php(pdo_sqlite)
105 Provides:       php(phar)
106 Provides:       php(posix)
107 Provides:       php(reflection)
108 Provides:       php(server)
109 Provides:       php(session)
110 Provides:       php(simplexml)
111 Provides:       php(soap)
112 Provides:       php(sockets)
113 Provides:       php(spl)
114 Provides:       php(sqlite3)
115 Provides:       php(sysvmsg)
116 Provides:       php(sysvsem)
117 Provides:       php(sysvshm)
118 Provides:       php(thread)
119 Provides:       php(thrift_protocol)
120 Provides:       php(tokenizer)
121 Provides:       php(xhprof)
122 Provides:       php(xml)
123 Provides:       php(xmlreader)
124 Provides:       php(xmlwriter)
125 Provides:       php(zip)
126 Provides:       php(zlib)
127 Obsoletes:      hiphop-php < 2.3.2-0.2
128 ExclusiveArch:  %{x8664}
129 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
130
131 %description
132 HHVM (aka the HipHop Virtual Machine) is a new open-source virtual
133 machine designed for executing programs written in PHP. HHVM uses a
134 just-in-time compilation approach to achieve superior performance
135 while maintaining the flexibility that PHP developers are accustomed
136 to. To date, HHVM (and its predecessor HPHPc before it) has realized
137 over a 9x increase in web request throughput and over a 5x reduction
138 in memory consumption for Facebook compared with the Zend PHP 5.2
139 engine + APC.
140
141 HHVM can be run as a standalone webserver (i.e. without the Apache
142 webserver and the "mod_php" extension). HHVM can also be used together
143 with a FastCGI-based webserver, and work is in progress to make HHVM
144 work smoothly with Apache.
145
146 %package fcgi
147 Summary:        Init script to start HHVM as FastCGI daemon
148 Group:          Development/Languages/PHP
149 Requires:       %{name} = %{version}-%{release}
150 Provides:       php(fcgi)
151 Requires(post,preun):   /sbin/chkconfig
152 Requires:       rc-scripts
153
154 %description fcgi
155 Init script to start HHVM as FastCGI daemon
156
157 %package program
158 Summary:        /usr/bin/php symlink
159 Summary(pl.UTF-8):      Dowiązanie symboliczne /usr/bin/php
160 Group:          Development/Languages/PHP
161 Requires:       %{name} = %{version}-%{release}
162 Obsoletes:      /usr/bin/php
163
164 %description program
165 Package providing /usr/bin/php symlink to PHP CLI.
166
167 %description program -l pl.UTF-8
168 Pakiet dostarczający dowiązanie symboliczne /usr/bin/php do PHP CLI.
169
170 %package devel
171 Summary:        Files for HHVM modules development
172 Group:          Development/Languages/PHP
173 URL:            https://github.com/facebook/hhvm/wiki/Extension-API
174 Requires:       boost-devel >= 1.50
175 Requires:       cmake >= 2.8.5
176 Requires:       glog-devel >= 0.3.2
177 Requires:       libstdc++-devel >= 6:4.3
178 Requires:       tbb-devel >= 4.0.6000
179 Requires:       zlib-devel
180
181 %description devel
182 HHVM provides a set of APIs for adding built-in functionality to the
183 runtime either by way of pure PHP code, or a combination of PHP and
184 C++.
185
186 %prep
187 %setup -q -a1 -a2 -n %{name}-HHVM-%{version}
188
189 mv folly-*/* hphp/submodules/folly
190
191 %patch8 -p1
192 %patch9 -p1
193 %patch10 -p1
194 #%patch5 -p1
195
196 # prefer ones from system
197 rm CMake/FindBISON.cmake
198 rm CMake/FindBoost.cmake
199 rm CMake/FindFLEX.cmake
200 rm CMake/FindFreetype.cmake
201
202 ln -s libevent-1.4.*-stable libevent
203 %{__patch} -d libevent -p1 < hphp/third_party/libevent-1.4.14.fb-changes.diff
204
205 %if 0
206 %patch0 -p1
207 %patch1 -p1
208 #%patch3 -p1
209 %patch4 -p1
210
211 #rm -rf src/third_party/libmbfl
212 #sed -i -e '/add_subdirectory(third_party\/libmbfl)/d' src/CMakeLists.txt
213
214 rm -rf src/third_party/xhp
215 rm -rf src/third_party/libafdt
216 %endif
217
218 %build
219 # build libevent 1.4 with fb patches
220 if [ ! -d libevent/.libs ]; then
221         cd libevent
222         # TODO: should use static linking, but then it fails to detect libraries due missing -lrt
223         %configure \
224                 %{?0:--enable-static} \
225                 %{?0:--disable-shared}
226         %{__make}
227         ln -s .libs lib
228         ln -s . include
229         cd ..
230 fi
231
232 export HPHP_HOME=$(pwd)
233 export HPHP_LIB=$HPHP_HOME/bin
234 install -d $HPHP_LIB
235
236 # asm linking breaks on $CC containing spaces
237 if [[ "%{__cc}" = *ccache* ]]; then
238         cat <<-'EOF' > $HPHP_LIB/gcc
239         #!/bin/sh
240         exec %{__cc} "$@"
241         EOF
242         chmod +x $HPHP_LIB/gcc
243         CC=$HPHP_LIB/gcc
244 fi
245
246 %if 0
247 # out of dir build broken (can't find it's tools)
248 install -d build
249 cd build
250 %endif
251
252 %cmake \
253         -DLIBEVENT_LIB=$HPHP_HOME/libevent/lib/libevent.so \
254         -DLIBEVENT_INCLUDE_DIR=$HPHP_HOME/libevent \
255         -DCMAKE_PREFIX_PATH=%{_prefix} \
256         -DUSE_JEMALLOC=OFF \
257         -DUSE_TCMALLOC=OFF \
258         -DHPHP_NOTEST=ON \
259         ./
260
261 # setup COMPILER_ID/HHVM_REPO_SCHEMA so it doesn't look it up from our package git repo
262 # see hphp/util/generate-buildinfo.sh
263 export COMPILER_ID=HHVM-%{version}-%{release}-%{githash}
264 export HHVM_REPO_SCHEMA=$(date +%N_%s)
265
266 %{__make}
267
268 %install
269 rm -rf $RPM_BUILD_ROOT
270 install -d $RPM_BUILD_ROOT%{_sysconfdir}/%{name}
271 %{__make} install \
272         HPHP_HOME=$(pwd) \
273         DESTDIR=$RPM_BUILD_ROOT
274
275 ln -s hhvm $RPM_BUILD_ROOT%{_bindir}/php
276 ln -s hhvm $RPM_BUILD_ROOT%{_bindir}/hphp
277
278 install -d $RPM_BUILD_ROOT%{_datadir}/%{name}/hdf
279 cp -p hphp/doc/mime.hdf $RPM_BUILD_ROOT%{_datadir}/%{name}/hdf/static.mime-types.hdf
280
281 # install fastcgi initscript
282 install -d $RPM_BUILD_ROOT/etc/{sysconfig,rc.d/init.d}
283 cp -p %{SOURCE3} $RPM_BUILD_ROOT/etc/rc.d/init.d/%{name}-fcgi
284 cp -p %{SOURCE4} $RPM_BUILD_ROOT/etc/sysconfig/%{name}-fcgi
285
286 # install our libevent for now
287 install -d $RPM_BUILD_ROOT%{_libdir}
288 libtool --mode=install install -p libevent/libevent.la $RPM_BUILD_ROOT%{_libdir}
289 %{__rm} $RPM_BUILD_ROOT%{_libdir}/libevent.{a,la,so}
290
291 # setup -devel
292 install -d $RPM_BUILD_ROOT%{_datadir}/cmake/Modules
293 cp -a CMake/* $RPM_BUILD_ROOT%{_datadir}/cmake/Modules
294
295 HPHP_HOME=$(pwd)
296 sed -e "
297         /HHVM_INCLUDE_DIRS/ s,$HPHP_HOME,%{_includedir},g
298 " hphp/tools/hphpize/hphpize.cmake > $RPM_BUILD_ROOT%{_datadir}/cmake/Modules/hphpize.cmake
299
300 oIFS=$IFS
301 IFS=";"
302 set -- $(sed -ne 's/set(HHVM_INCLUDE_DIRS "\(.*\)")/\1/p' hphp/tools/hphpize/hphpize.cmake)
303 IFS=$oIFS
304 set -- $(
305         for dir in "$@"; do
306                 [[ "$dir" = $HPHP_HOME/hphp/* ]] && echo $dir
307         done
308 )
309
310 set +x
311 for dir in "$@" \
312         $HPHP_HOME/hphp/runtime \
313         $HPHP_HOME/hphp/util \
314         $HPHP_HOME/hphp/neo \
315         $HPHP_HOME/hphp/system \
316         $HPHP_HOME/hphp/parser \
317 ; do
318         echo "D %{_includedir}${dir#$HPHP_HOME}"
319         find $dir -name '*.h' | while read path; do
320                 file=%{_includedir}${path#$HPHP_HOME}
321                 echo "F $file"
322                 install -Dp $path $RPM_BUILD_ROOT$file
323         done
324 done
325 set -x
326
327 %clean
328 rm -rf $RPM_BUILD_ROOT
329
330 %post   -p /sbin/ldconfig
331 %postun -p /sbin/ldconfig
332
333 %post fcgi
334 /sbin/chkconfig --add %{name}-fcgi
335 %service %{name}-fcgi restart
336
337 %preun fcgi
338 if [ "$1" = "0" ]; then
339         %service -q %{name}-fcgi stop
340         /sbin/chkconfig --del %{name}-fcgi
341 fi
342
343 %files
344 %defattr(644,root,root,755)
345 %doc README.md hphp/NEWS
346 %dir %{_sysconfdir}/%{name}
347 %attr(755,root,root) %{_bindir}/hhvm
348 %attr(755,root,root) %{_bindir}/hphp
349 %attr(755,root,root) %{_libdir}/libevent-1.4.so.*.*.*
350 %ghost %{_libdir}/libevent-1.4.so.2
351
352 %dir %{_datadir}/%{name}
353 %dir %{_datadir}/%{name}/hdf
354 %{_datadir}/%{name}/hdf/static.mime-types.hdf
355
356 %files fcgi
357 %defattr(644,root,root,755)
358 %attr(754,root,root) /etc/rc.d/init.d/%{name}-fcgi
359 %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/%{name}-fcgi
360
361 %files program
362 %defattr(644,root,root,755)
363 %attr(755,root,root) %{_bindir}/php
364
365 %files devel
366 %defattr(644,root,root,755)
367 %attr(755,root,root) %{_bindir}/hphpize
368 %{_includedir}/hphp
369 %{_datadir}/cmake/Modules/ExtZendCompat.cmake
370 %{_datadir}/cmake/Modules/FindCClient.cmake
371 %{_datadir}/cmake/Modules/FindEditline.cmake
372 %{_datadir}/cmake/Modules/FindGlog.cmake
373 %{_datadir}/cmake/Modules/FindICU.cmake
374 %{_datadir}/cmake/Modules/FindLdap.cmake
375 %{_datadir}/cmake/Modules/FindLibAfdt.cmake
376 %{_datadir}/cmake/Modules/FindLibCh.cmake
377 %{_datadir}/cmake/Modules/FindLibDL.cmake
378 %{_datadir}/cmake/Modules/FindLibDwarf.cmake
379 %{_datadir}/cmake/Modules/FindLibElf.cmake
380 %{_datadir}/cmake/Modules/FindLibEvent.cmake
381 %{_datadir}/cmake/Modules/FindLibEvent.cmake.bak
382 %{_datadir}/cmake/Modules/FindLibJpeg.cmake
383 %{_datadir}/cmake/Modules/FindLibNuma.cmake
384 %{_datadir}/cmake/Modules/FindLibPng.cmake
385 %{_datadir}/cmake/Modules/FindLibUODBC.cmake
386 %{_datadir}/cmake/Modules/FindLibVpx.cmake
387 %{_datadir}/cmake/Modules/FindLibXed.cmake
388 %{_datadir}/cmake/Modules/FindLibYaml.cmake
389 %{_datadir}/cmake/Modules/FindLibiconv.cmake
390 %{_datadir}/cmake/Modules/FindLibinotify.cmake
391 %{_datadir}/cmake/Modules/FindLibmemcached.cmake
392 %{_datadir}/cmake/Modules/FindLibpam.cmake
393 %{_datadir}/cmake/Modules/FindMcrypt.cmake
394 %{_datadir}/cmake/Modules/FindMySQL.cmake
395 %{_datadir}/cmake/Modules/FindNcurses.cmake
396 %{_datadir}/cmake/Modules/FindONIGURUMA.cmake
397 %{_datadir}/cmake/Modules/FindPCRE.cmake
398 %{_datadir}/cmake/Modules/FindPThread.cmake
399 %{_datadir}/cmake/Modules/FindReadline.cmake
400 %{_datadir}/cmake/Modules/FindTBB.cmake
401 %{_datadir}/cmake/Modules/FollySetup.cmake
402 %{_datadir}/cmake/Modules/HPHPCompiler.cmake
403 %{_datadir}/cmake/Modules/HPHPFindLibs.cmake
404 %{_datadir}/cmake/Modules/HPHPFunctions.cmake
405 %{_datadir}/cmake/Modules/HPHPSetup.cmake
406 %{_datadir}/cmake/Modules/Options.cmake
407 %{_datadir}/cmake/Modules/hphpize.cmake
This page took 0.11499 seconds and 3 git commands to generate.