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