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