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