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