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