]> git.pld-linux.org Git - packages/hhvm.git/blob - hhvm.spec
fix ccache enabled build, use separate build dir; cleanups
[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:         ccache.patch
25 Patch1:         no-debug.patch
26 URL:            https://github.com/facebook/hhvm/wiki
27 BuildRequires:  ImageMagick-devel
28 BuildRequires:  a52dec-libs-devel
29 BuildRequires:  apr-devel
30 BuildRequires:  autoconf
31 BuildRequires:  binutils-devel
32 BuildRequires:  boost-devel >= 1.50
33 BuildRequires:  cmake >= 2.8.5
34 BuildRequires:  curl-devel >= 7.29.0
35 BuildRequires:  elfutils-devel
36 BuildRequires:  expat-devel
37 BuildRequires:  gcc >= 6:4.6.0
38 BuildRequires:  gd-devel
39 BuildRequires:  glog-devel >= 0.3.2
40 BuildRequires:  imap-devel >= 1:2007
41 #BuildRequires: jemalloc-devel >= 3.0.0
42 BuildRequires:  libcap-devel
43 BuildRequires:  libdwarf-devel >= 20130729
44 BuildRequires:  libicu-devel >= 4.2
45 #BuildRequires: libmbfl-devel
46 BuildRequires:  libmcrypt-devel
47 BuildRequires:  libmemcached-devel >= 1.0.4
48 BuildRequires:  libstdc++-devel >= 6:4.8
49 BuildRequires:  libunwind-devel
50 BuildRequires:  libxml2-devel
51 BuildRequires:  libxslt-devel
52 BuildRequires:  mysql-devel
53 BuildRequires:  ocaml-findlib
54 BuildRequires:  oniguruma-devel
55 BuildRequires:  openssl-devel
56 BuildRequires:  pcre-devel
57 #BuildRequires: php-xhp-devel >= 1.3.9-6
58 BuildRequires:  readline-devel
59 BuildRequires:  rpmbuild(macros) >= 1.675
60 BuildRequires:  tbb-devel >= 4.0.6000
61 BuildRequires:  zlib-devel
62 # check later, seem unused
63 #BuildRequires: bison >= 2.3
64 #BuildRequires: flex >= 2.5.35
65 #BuildRequires: libafdt-devel >= 0.1.0
66 #BuildRequires: re2c >= 0.13.0
67 # foreach (get_loaded_extensions() as $ext) printf("Provides:\tphp(%s)\n", strtolower($ext));
68 Provides:       %{name}(api) = %{hhvm_api_version}
69 Provides:       php(apache)
70 Provides:       php(apc)
71 Provides:       php(bcmath)
72 Provides:       php(bz2)
73 Provides:       php(calendar)
74 Provides:       php(core) = %{php_version}
75 Provides:       php(ctype)
76 Provides:       php(curl)
77 Provides:       php(date)
78 Provides:       php(debugger)
79 Provides:       php(dom)
80 Provides:       php(exif)
81 Provides:       php(fb)
82 Provides:       php(fileinfo)
83 Provides:       php(filter)
84 Provides:       php(ftp)
85 Provides:       php(gd)
86 Provides:       php(gettext)
87 Provides:       php(hash)
88 Provides:       php(hh)
89 Provides:       php(hhvm.debugger)
90 Provides:       php(hhvm.ini)
91 Provides:       php(hotprofiler)
92 Provides:       php(iconv)
93 Provides:       php(idn)
94 Provides:       php(imagick)
95 Provides:       php(imap)
96 Provides:       php(intl)
97 Provides:       php(json)
98 Provides:       php(ldap)
99 Provides:       php(libxml)
100 Provides:       php(mbstring)
101 Provides:       php(mcrypt)
102 Provides:       php(memcache)
103 Provides:       php(memcached)
104 Provides:       php(misc)
105 Provides:       php(mysql)
106 Provides:       php(mysqli)
107 Provides:       php(oauth)
108 Provides:       php(openssl)
109 Provides:       php(pcntl)
110 Provides:       php(pcre)
111 Provides:       php(pcre_zend_compat)
112 Provides:       php(pdo)
113 Provides:       php(pdo_mysql)
114 Provides:       php(pdo_sqlite)
115 Provides:       php(phar)
116 Provides:       php(posix)
117 Provides:       php(redis)
118 Provides:       php(reflection)
119 Provides:       php(server)
120 Provides:       php(session)
121 Provides:       php(simplexml)
122 Provides:       php(soap)
123 Provides:       php(sockets)
124 Provides:       php(spl)
125 Provides:       php(sqlite3)
126 Provides:       php(standard)
127 Provides:       php(standard_zend_compat)
128 Provides:       php(stream)
129 Provides:       php(sysvmsg)
130 Provides:       php(sysvsem)
131 Provides:       php(sysvshm)
132 Provides:       php(thread)
133 Provides:       php(thrift_protocol)
134 Provides:       php(tokenizer)
135 Provides:       php(url)
136 Provides:       php(wddx)
137 Provides:       php(xenon)
138 Provides:       php(xhprof)
139 Provides:       php(xml)
140 Provides:       php(xmlreader)
141 Provides:       php(xmlwriter)
142 Provides:       php(xsl)
143 Provides:       php(yaml)
144 Provides:       php(zip)
145 Provides:       php(zlib)
146 Obsoletes:      hiphop-php < 2.3.2-0.2
147 ExclusiveArch:  %{x8664}
148 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
149
150 # must be in sync with source. extra check ensuring that it is so is done in %%build
151 %define         hhvm_api_version        20140702
152 # hphp/system/idl/constants.idl.json defines it as 5.6.99-hhvm, but use some saner value
153 %define         php_version                     5.6.0
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 %patch0 -p1
220 %patch1 -p1
221
222 # prefer ones from system
223 rm CMake/FindBISON.cmake
224 rm CMake/FindFLEX.cmake
225 rm CMake/FindFreetype.cmake
226
227 %build
228 # also in: hphp/tools/hphpize/hphpize.cmake
229 API=$(awk '/#define HHVM_API_VERSION/{v=$3; sub(/L$/, "", v); print v}' hphp/runtime/ext/extension.h)
230
231 if [ $API != %{hhvm_api_version} ]; then
232         echo "Set %%define hhvm_api_version to $API and re-run."
233         exit 1
234 fi
235
236 # out of dir build broken (can't find it's tools)
237 install -d build
238 cd build
239
240 # handle cmake & ccache
241 # http://stackoverflow.com/questions/1815688/how-to-use-ccache-with-cmakec
242 # ASM fix: http://lists.busybox.net/pipermail/buildroot/2013-March/069436.html
243 if [[ "%{__cc}" = *ccache* ]]; then
244         cc="%{__cc}"
245         cxx="%{__cxx}"
246         ccache="
247         -DCMAKE_C_COMPILER="ccache" -DCMAKE_C_COMPILER_ARG1="${cc#ccache }" \
248         -DCMAKE_CXX_COMPILER="ccache" -DCMAKE_CXX_COMPILER_ARG1="${cxx#ccache }" \
249         -DCMAKE_ASM_COMPILER="${cc#ccache }" \
250         "
251 fi
252
253 %cmake \
254         $ccache \
255         -DCMAKE_PREFIX_PATH=%{_prefix} \
256         -DUSE_JEMALLOC=OFF \
257         -DUSE_TCMALLOC=OFF \
258         -DHPHP_NOTEST=ON \
259         ../
260
261 # setup COMPILER_ID/HHVM_REPO_SCHEMA so it doesn't look it up from our package git repo
262 # see hphp/util/generate-buildinfo.sh
263 export COMPILER_ID=HHVM-%{version}-%{release}-%{githash}
264 export HHVM_REPO_SCHEMA=$(date +%N_%s)
265
266 %{__make}
267
268 %install
269 # make install relinks all outputs which is very slow,
270 # so to speedup rebuild, use timestamps to record states
271 #test %{_specdir}/%{name}.spec -nt makeinstall.stamp && %{__rm} -f makeinstall.stamp
272 if [ ! -f makeinstall.stamp -o ! -d $RPM_BUILD_ROOT ]; then
273         rm -rf makeinstall.stamp installed.stamp $RPM_BUILD_ROOT
274
275         %{__make} install -C build \
276                 HPHP_HOME__=$(pwd) \
277                 DESTDIR=$RPM_BUILD_ROOT
278
279         touch makeinstall.stamp
280 fi
281
282 rm -rf $RPM_BUILD_ROOT%{_docdir}
283 if [ ! -f installed.stamp ]; then
284 install -d $RPM_BUILD_ROOT%{_sysconfdir}/%{name}
285 # begin install block
286
287 ln -s hhvm $RPM_BUILD_ROOT%{_bindir}/php
288 ln -s hhvm $RPM_BUILD_ROOT%{_bindir}/hphp
289
290 install -d $RPM_BUILD_ROOT%{_datadir}/%{name}/hdf
291 cp -p hphp/doc/mime.hdf $RPM_BUILD_ROOT%{_datadir}/%{name}/hdf/static.mime-types.hdf
292
293 # install fastcgi initscript
294 install -d $RPM_BUILD_ROOT/etc/{sysconfig,rc.d/init.d}
295 cp -p %{SOURCE4} $RPM_BUILD_ROOT/etc/rc.d/init.d/%{name}-fcgi
296 cp -p %{SOURCE5} $RPM_BUILD_ROOT/etc/sysconfig/%{name}-fcgi
297
298 %if 0
299 # setup -devel
300 install -d $RPM_BUILD_ROOT%{_datadir}/cmake/Modules
301 cp -p CMake/*.cmake $RPM_BUILD_ROOT%{_datadir}/cmake/Modules
302
303 HPHP_HOME=$(pwd)
304 sed -e "
305         /HHVM_INCLUDE_DIRS/ s,$HPHP_HOME,%{_includedir},g
306 " hphp/tools/hphpize/hphpize.cmake > $RPM_BUILD_ROOT%{_datadir}/cmake/Modules/hphpize.cmake
307
308 oIFS=$IFS
309 IFS=";"
310 set -- $(sed -ne 's/set(HHVM_INCLUDE_DIRS "\(.*\)")/\1/p' hphp/tools/hphpize/hphpize.cmake)
311 IFS=$oIFS
312 set -- $(
313         for dir in "$@"; do
314                 [[ "$dir" = $HPHP_HOME/hphp/* ]] && echo $dir
315         done
316 )
317
318 set +x
319 for dir in "$@" \
320         $HPHP_HOME/hphp/runtime \
321         $HPHP_HOME/hphp/util \
322         $HPHP_HOME/hphp/neo \
323         $HPHP_HOME/hphp/system \
324         $HPHP_HOME/hphp/parser \
325 ; do
326         echo "D %{_includedir}${dir#$HPHP_HOME}"
327         find $dir -name '*.h' | while read path; do
328                 file=%{_includedir}${path#$HPHP_HOME}
329                 echo "F $file"
330                 install -Dp $path $RPM_BUILD_ROOT$file
331         done
332 done
333 set -x
334 %endif
335
336 # end of install block
337 touch installed.stamp; fi
338
339 %clean
340 rm -rf $RPM_BUILD_ROOT
341
342 %post   -p /sbin/ldconfig
343 %postun -p /sbin/ldconfig
344
345 %post fcgi
346 /sbin/chkconfig --add %{name}-fcgi
347 %service %{name}-fcgi restart
348
349 %preun fcgi
350 if [ "$1" = "0" ]; then
351         %service -q %{name}-fcgi stop
352         /sbin/chkconfig --del %{name}-fcgi
353 fi
354
355 %files
356 %defattr(644,root,root,755)
357 %doc README.md hphp/NEWS
358 %dir %{_sysconfdir}/%{name}
359 %attr(755,root,root) %{_bindir}/hhvm
360 %attr(755,root,root) %{_bindir}/hphp
361
362 %dir %{_datadir}/%{name}
363 %dir %{_datadir}/%{name}/hdf
364 %{_datadir}/%{name}/hdf/static.mime-types.hdf
365
366 %files fcgi
367 %defattr(644,root,root,755)
368 %attr(754,root,root) /etc/rc.d/init.d/%{name}-fcgi
369 %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/%{name}-fcgi
370
371 %files program
372 %defattr(644,root,root,755)
373 %attr(755,root,root) %{_bindir}/php
374
375 %files devel
376 %defattr(644,root,root,755)
377 %attr(755,root,root) %{_bindir}/hphpize
378 %{_includedir}/hphp
379 %dir %{_prefix}/lib/hphp
380 %{_prefix}/lib/hphp/CMake
381 %{_prefix}/lib/hphp/hphpize
This page took 0.093116 seconds and 4 git commands to generate.