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