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