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