]> git.pld-linux.org Git - packages/hhvm.git/blob - hhvm.spec
package dir for extensions
[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.2.0
7 %define         githash 01228273b8cf709aacbd3df1c51b1e690ecebac8
8 %define         folly           09a81a9
9 %define         thirdparty      2234d64
10 Summary:        Virtual Machine, Runtime, and JIT for PHP
11 Name:           hhvm
12 Version:        3.2.0
13 Release:        1
14 License:        PHP 3.01
15 Group:          Development/Languages
16 Source0:        https://github.com/facebook/hhvm/archive/HHVM-%{version}.tar.gz
17 # Source0-md5:  791ca8c56d155a71f948387de8859f98
18 Source2:        https://github.com/facebook/folly/archive/%{folly}/folly-0.1-%{folly}.tar.gz
19 # Source2-md5:  17bc7ee76939cd6a26755588d80313c9
20 Source3:        https://github.com/hhvm/hhvm-third-party/archive/%{thirdparty}/third_party-%{thirdparty}.tar.gz
21 # Source3-md5:  9d40c3fbf1394bb1f03648d7046f8b9c
22 Source4:        %{name}-fcgi.init
23 Source5:        %{name}-fcgi.sysconfig
24 Source6:        php.ini
25 Source100:      get-source.sh
26 Patch0:         ccache.patch
27 Patch1:         no-debug.patch
28 URL:            https://github.com/facebook/hhvm/wiki
29 BuildRequires:  ImageMagick-devel
30 BuildRequires:  a52dec-libs-devel
31 BuildRequires:  apr-devel
32 BuildRequires:  autoconf
33 BuildRequires:  binutils-devel
34 BuildRequires:  boost-devel >= 1.50
35 BuildRequires:  cmake >= 2.8.5
36 BuildRequires:  curl-devel >= 7.29.0
37 BuildRequires:  elfutils-devel
38 BuildRequires:  expat-devel
39 BuildRequires:  gcc >= 6:4.6.0
40 BuildRequires:  gd-devel
41 BuildRequires:  glog-devel >= 0.3.2
42 BuildRequires:  imap-devel >= 1:2007
43 #BuildRequires: jemalloc-devel >= 3.0.0
44 BuildRequires:  libcap-devel
45 BuildRequires:  libdwarf-devel >= 20130729
46 BuildRequires:  libicu-devel >= 4.2
47 #BuildRequires: libmbfl-devel
48 BuildRequires:  libmcrypt-devel
49 BuildRequires:  libmemcached-devel >= 1.0.4
50 BuildRequires:  libstdc++-devel >= 6:4.8
51 BuildRequires:  libunwind-devel
52 BuildRequires:  libxml2-devel
53 BuildRequires:  libxslt-devel
54 BuildRequires:  mysql-devel
55 BuildRequires:  ocaml-findlib
56 BuildRequires:  oniguruma-devel
57 BuildRequires:  openssl-devel
58 BuildRequires:  pcre-devel
59 #BuildRequires: php-xhp-devel >= 1.3.9-6
60 BuildRequires:  readline-devel
61 BuildRequires:  rpmbuild(macros) >= 1.675
62 BuildRequires:  tbb-devel >= 4.0.6000
63 BuildRequires:  zlib-devel
64 # check later, seem unused
65 #BuildRequires: bison >= 2.3
66 #BuildRequires: flex >= 2.5.35
67 #BuildRequires: libafdt-devel >= 0.1.0
68 #BuildRequires: re2c >= 0.13.0
69 # foreach (get_loaded_extensions() as $ext) printf("Provides:\tphp(%s)\n", strtolower($ext));
70 Provides:       %{name}(api) = %{hhvm_api_version}
71 Provides:       php(apache)
72 Provides:       php(apc)
73 Provides:       php(bcmath)
74 Provides:       php(bz2)
75 Provides:       php(calendar)
76 Provides:       php(core) = %{php_version}
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 # hphp/system/idl/constants.idl.json defines it as 5.6.99-hhvm, but use some saner value
155 %define         php_version                     5.6.0
156
157 %description
158 HHVM (aka the HipHop Virtual Machine) is a new open-source virtual
159 machine designed for executing programs written in PHP. HHVM uses a
160 just-in-time compilation approach to achieve superior performance
161 while maintaining the flexibility that PHP developers are accustomed
162 to. To date, HHVM (and its predecessor HPHPc before it) has realized
163 over a 9x increase in web request throughput and over a 5x reduction
164 in memory consumption for Facebook compared with the Zend PHP 5.2
165 engine + APC.
166
167 HHVM can be run as a standalone webserver (i.e. without the Apache
168 webserver and the "mod_php" extension). HHVM can also be used together
169 with a FastCGI-based webserver, and work is in progress to make HHVM
170 work smoothly with Apache.
171
172 %package fcgi
173 Summary:        Init script to start HHVM as FastCGI daemon
174 Group:          Development/Languages/PHP
175 Requires:       %{name} = %{version}-%{release}
176 Provides:       php(fcgi)
177 Requires(post,preun):   /sbin/chkconfig
178 Requires:       rc-scripts
179
180 %description fcgi
181 Init script to start HHVM as FastCGI daemon
182
183 %package program
184 Summary:        /usr/bin/php symlink
185 Summary(pl.UTF-8):      Dowiązanie symboliczne /usr/bin/php
186 Group:          Development/Languages/PHP
187 Requires:       %{name} = %{version}-%{release}
188 Obsoletes:      /usr/bin/php
189
190 %description program
191 Package providing /usr/bin/php symlink to PHP CLI.
192
193 %description program -l pl.UTF-8
194 Pakiet dostarczający dowiązanie symboliczne /usr/bin/php do PHP CLI.
195
196 %package devel
197 Summary:        Files for HHVM modules development
198 Group:          Development/Languages/PHP
199 URL:            https://github.com/facebook/hhvm/wiki/Extension-API
200 Requires:       boost-devel >= 1.50
201 Requires:       cmake >= 2.8.5
202 Requires:       glog-devel >= 0.3.2
203 Requires:       libstdc++-devel >= 6:4.3
204 Requires:       tbb-devel >= 4.0.6000
205 Requires:       zlib-devel
206
207 %description devel
208 HHVM provides a set of APIs for adding built-in functionality to the
209 runtime either by way of pure PHP code, or a combination of PHP and
210 C++.
211
212 %prep
213 %setup -q -n %{name}-HHVM-%{version} -a2 -a3
214
215 # handle git submodules
216 rmdir third-party
217 mv hhvm-third-party-* third-party
218 rmdir third-party/folly/src
219 mv folly-* third-party/folly/src
220
221 %patch0 -p1
222 %patch1 -p1
223
224 # prefer ones from system
225 rm CMake/FindBISON.cmake
226 rm CMake/FindFLEX.cmake
227 rm CMake/FindFreetype.cmake
228
229 %build
230 # also in: hphp/tools/hphpize/hphpize.cmake
231 API=$(awk '/#define HHVM_API_VERSION/{v=$3; sub(/L$/, "", v); print v}' hphp/runtime/ext/extension.h)
232
233 if [ $API != %{hhvm_api_version} ]; then
234         echo "Set %%define hhvm_api_version to $API and re-run."
235         exit 1
236 fi
237
238 # out of dir build broken (can't find it's tools)
239 install -d build
240 cd build
241
242 # handle cmake & ccache
243 # http://stackoverflow.com/questions/1815688/how-to-use-ccache-with-cmakec
244 # ASM fix: http://lists.busybox.net/pipermail/buildroot/2013-March/069436.html
245 if [[ "%{__cc}" = *ccache* ]]; then
246         cc="%{__cc}"
247         cxx="%{__cxx}"
248         ccache="
249         -DCMAKE_C_COMPILER="ccache" -DCMAKE_C_COMPILER_ARG1="${cc#ccache }" \
250         -DCMAKE_CXX_COMPILER="ccache" -DCMAKE_CXX_COMPILER_ARG1="${cxx#ccache }" \
251         -DCMAKE_ASM_COMPILER="${cc#ccache }" \
252         "
253 fi
254
255 %cmake \
256         $ccache \
257         -DCMAKE_PREFIX_PATH=%{_prefix} \
258         -DUSE_JEMALLOC=OFF \
259         -DUSE_TCMALLOC=OFF \
260         -DHPHP_NOTEST=ON \
261         -DENABLE_COTIRE=ON \
262         ../
263
264
265 # setup COMPILER_ID/HHVM_REPO_SCHEMA so it doesn't look it up from our package git repo
266 # see hphp/util/generate-buildinfo.sh
267 export COMPILER_ID=HHVM-%{version}-%{release}-g%{githash}
268 export HHVM_REPO_SCHEMA=$(date +%N_%s)
269
270 %{__make}
271
272 %install
273 # make install relinks all outputs which is very slow,
274 # so to speedup rebuild, use timestamps to record states
275 #test %{_specdir}/%{name}.spec -nt makeinstall.stamp && %{__rm} -f makeinstall.stamp
276 if [ ! -f makeinstall.stamp -o ! -d $RPM_BUILD_ROOT ]; then
277         rm -rf makeinstall.stamp installed.stamp $RPM_BUILD_ROOT
278
279         %{__make} install -C build \
280                 HPHP_HOME__=$(pwd) \
281                 DESTDIR=$RPM_BUILD_ROOT
282
283         touch makeinstall.stamp
284 fi
285
286 rm -rf $RPM_BUILD_ROOT%{_docdir}
287 if [ ! -f installed.stamp ]; then
288 # begin install block
289
290 install -d $RPM_BUILD_ROOT{%{_sysconfdir}/%{name},%{_libdir}/%{name}}
291 cp -p %{SOURCE6} $RPM_BUILD_ROOT%{_sysconfdir}/%{name}
292
293 ln -s hhvm $RPM_BUILD_ROOT%{_bindir}/php
294 ln -s hhvm $RPM_BUILD_ROOT%{_bindir}/hphp
295
296 install -d $RPM_BUILD_ROOT%{_datadir}/%{name}/hdf
297 cp -p hphp/doc/mime.hdf $RPM_BUILD_ROOT%{_datadir}/%{name}/hdf/static.mime-types.hdf
298
299 # install fastcgi initscript
300 install -d $RPM_BUILD_ROOT/etc/{sysconfig,rc.d/init.d}
301 cp -p %{SOURCE4} $RPM_BUILD_ROOT/etc/rc.d/init.d/%{name}-fcgi
302 cp -p %{SOURCE5} $RPM_BUILD_ROOT/etc/sysconfig/%{name}-fcgi
303
304 install -p hphp/hack/bin/hh_{server,client} $RPM_BUILD_ROOT%{_bindir}
305
306 %if 0
307 # setup -devel
308 install -d $RPM_BUILD_ROOT%{_datadir}/cmake/Modules
309 cp -p CMake/*.cmake $RPM_BUILD_ROOT%{_datadir}/cmake/Modules
310
311 HPHP_HOME=$(pwd)
312 sed -e "
313         /HHVM_INCLUDE_DIRS/ s,$HPHP_HOME,%{_includedir},g
314 " hphp/tools/hphpize/hphpize.cmake > $RPM_BUILD_ROOT%{_datadir}/cmake/Modules/hphpize.cmake
315
316 oIFS=$IFS
317 IFS=";"
318 set -- $(sed -ne 's/set(HHVM_INCLUDE_DIRS "\(.*\)")/\1/p' hphp/tools/hphpize/hphpize.cmake)
319 IFS=$oIFS
320 set -- $(
321         for dir in "$@"; do
322                 [[ "$dir" = $HPHP_HOME/hphp/* ]] && echo $dir
323         done
324 )
325
326 set +x
327 for dir in "$@" \
328         $HPHP_HOME/hphp/runtime \
329         $HPHP_HOME/hphp/util \
330         $HPHP_HOME/hphp/neo \
331         $HPHP_HOME/hphp/system \
332         $HPHP_HOME/hphp/parser \
333 ; do
334         echo "D %{_includedir}${dir#$HPHP_HOME}"
335         find $dir -name '*.h' | while read path; do
336                 file=%{_includedir}${path#$HPHP_HOME}
337                 echo "F $file"
338                 install -Dp $path $RPM_BUILD_ROOT$file
339         done
340 done
341 set -x
342 %endif
343
344 # end of install block
345 touch installed.stamp; fi
346
347 %clean
348 rm -rf $RPM_BUILD_ROOT
349
350 %post   -p /sbin/ldconfig
351 %postun -p /sbin/ldconfig
352
353 %post fcgi
354 /sbin/chkconfig --add %{name}-fcgi
355 %service %{name}-fcgi restart
356
357 %preun fcgi
358 if [ "$1" = "0" ]; then
359         %service -q %{name}-fcgi stop
360         /sbin/chkconfig --del %{name}-fcgi
361 fi
362
363 %files
364 %defattr(644,root,root,755)
365 %doc README.md hphp/NEWS
366 %dir %{_sysconfdir}/%{name}
367 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/%{name}/php.ini
368 %attr(755,root,root) %{_bindir}/hhvm
369 %attr(755,root,root) %{_bindir}/hphp
370 %attr(755,root,root) %{_bindir}/hh_client
371 %attr(755,root,root) %{_bindir}/hh_server
372
373 %dir %{_datadir}/%{name}
374 %dir %{_datadir}/%{name}/hdf
375 %{_datadir}/%{name}/hdf/static.mime-types.hdf
376
377 # dir for extensions
378 %dir %{_libdir}/%{name}
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.069936 seconds and 4 git commands to generate.