]> git.pld-linux.org Git - packages/hhvm.git/blob - hhvm.spec
out of tree build is still broken
[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.3.1
7 %define         githash e0c98e21167b425dddf1fc9efe78c9f7a36db268
8 # these hashes are git submodules
9 %define         folly           6e46d46
10 %define         thirdparty      fdef620
11 Summary:        Virtual Machine, Runtime, and JIT for PHP
12 Name:           hhvm
13 Version:        3.3.1
14 Release:        0.1
15 License:        PHP 3.01 and BSD
16 Group:          Development/Languages
17 Source0:        https://github.com/facebook/hhvm/archive/HHVM-%{version}.tar.gz
18 # Source0-md5:  bab9490837ff4f54f295bbcf428d7a1c
19 Source2:        https://github.com/facebook/folly/archive/%{folly}/folly-3.2-%{folly}.tar.gz
20 # Source2-md5:  c4bdbea4c0ffe0650d12d9ff370b8255
21 Source3:        https://github.com/hhvm/hhvm-third-party/archive/%{thirdparty}/third_party-%{thirdparty}.tar.gz
22 # Source3-md5:  63858096c50c172d6c45ddb3d9b6d721
23 Source5:        %{name}-fcgi.init
24 Source6:        %{name}-fcgi.sysconfig
25 Source7:        php.ini
26 Source100:      get-source.sh
27 Patch1:         no-debug.patch
28 Patch2:         hphpize.patch
29 Patch3:         MAX.patch
30 URL:            https://github.com/facebook/hhvm/wiki
31 BuildRequires:  ImageMagick-devel
32 BuildRequires:  a52dec-libs-devel
33 BuildRequires:  apr-devel
34 BuildRequires:  autoconf
35 BuildRequires:  binutils-devel
36 # CMake/HPHPFindLibs.cmake:364 - FIND_LIBRARY (BFD_LIB libbfd.a)
37 BuildRequires:  binutils-static
38 BuildRequires:  boost-devel >= 1.50
39 BuildRequires:  cmake >= 2.8.5
40 BuildRequires:  curl-devel >= 7.29.0
41 BuildRequires:  elfutils-devel
42 BuildRequires:  expat-devel
43 BuildRequires:  gcc >= 6:4.6.0
44 BuildRequires:  gd-devel
45 BuildRequires:  glog-devel >= 0.3.2
46 BuildRequires:  imap-devel >= 1:2007
47 #BuildRequires: jemalloc-devel >= 3.0.0
48 BuildRequires:  libcap-devel
49 BuildRequires:  libdwarf-devel >= 20130729
50 BuildRequires:  libicu-devel >= 4.2
51 #BuildRequires: libmbfl-devel
52 BuildRequires:  libmcrypt-devel
53 BuildRequires:  libmemcached-devel >= 1.0.4
54 BuildRequires:  libstdc++-devel >= 6:4.8
55 BuildRequires:  libunwind-devel
56 BuildRequires:  libxml2-devel
57 BuildRequires:  libxslt-devel
58 BuildRequires:  mysql-devel
59 BuildRequires:  ocaml-findlib
60 BuildRequires:  oniguruma-devel
61 BuildRequires:  openssl-devel
62 BuildRequires:  pcre-devel
63 #BuildRequires: php-xhp-devel >= 1.3.9-6
64 BuildRequires:  readline-devel
65 BuildRequires:  rpmbuild(macros) >= 1.675
66 BuildRequires:  tbb-devel >= 4.0.6000
67 BuildRequires:  zlib-devel
68 # check later, seem unused
69 #BuildRequires: bison >= 2.3
70 #BuildRequires: flex >= 2.5.35
71 #BuildRequires: libafdt-devel >= 0.1.0
72 #BuildRequires: re2c >= 0.13.0
73 # foreach (get_loaded_extensions() as $ext) printf("Provides:\tphp(%s)\n", strtolower($ext));
74 Provides:       %{name}(api) = %{hhvm_api_version}
75 Provides:       php(apache)
76 Provides:       php(apc)
77 Provides:       php(bcmath)
78 Provides:       php(bz2)
79 Provides:       php(calendar)
80 Provides:       php(core) = %{php_version}
81 Provides:       php(ctype)
82 Provides:       php(curl)
83 Provides:       php(date)
84 Provides:       php(debugger)
85 Provides:       php(dom)
86 Provides:       php(exif)
87 Provides:       php(fb)
88 Provides:       php(fileinfo)
89 Provides:       php(filter)
90 Provides:       php(ftp)
91 Provides:       php(gd)
92 Provides:       php(gettext)
93 Provides:       php(hash)
94 Provides:       php(hh)
95 Provides:       php(hhvm.debugger)
96 Provides:       php(hhvm.ini)
97 Provides:       php(hotprofiler)
98 Provides:       php(iconv)
99 Provides:       php(idn)
100 Provides:       php(imagick)
101 Provides:       php(imap)
102 Provides:       php(intl)
103 Provides:       php(json)
104 Provides:       php(ldap)
105 Provides:       php(libxml)
106 Provides:       php(mbstring)
107 Provides:       php(mcrypt)
108 Provides:       php(memcache)
109 Provides:       php(memcached)
110 Provides:       php(misc)
111 Provides:       php(mysql)
112 Provides:       php(mysqli)
113 Provides:       php(oauth)
114 Provides:       php(openssl)
115 Provides:       php(pcntl)
116 Provides:       php(pcre)
117 Provides:       php(pcre_zend_compat)
118 Provides:       php(pdo)
119 Provides:       php(pdo_mysql)
120 Provides:       php(pdo_sqlite)
121 Provides:       php(phar)
122 Provides:       php(posix)
123 Provides:       php(redis)
124 Provides:       php(reflection)
125 Provides:       php(server)
126 Provides:       php(session)
127 Provides:       php(simplexml)
128 Provides:       php(soap)
129 Provides:       php(sockets)
130 Provides:       php(spl)
131 Provides:       php(sqlite3)
132 Provides:       php(standard)
133 Provides:       php(standard_zend_compat)
134 Provides:       php(stream)
135 Provides:       php(sysvmsg)
136 Provides:       php(sysvsem)
137 Provides:       php(sysvshm)
138 Provides:       php(thread)
139 Provides:       php(thrift_protocol)
140 Provides:       php(tokenizer)
141 Provides:       php(url)
142 Provides:       php(wddx)
143 Provides:       php(xenon)
144 Provides:       php(xhprof)
145 Provides:       php(xml)
146 Provides:       php(xmlreader)
147 Provides:       php(xmlwriter)
148 Provides:       php(xsl)
149 Provides:       php(yaml)
150 Provides:       php(zip)
151 Provides:       php(zlib)
152 Obsoletes:      hiphop-php < 2.3.2-0.2
153 ExclusiveArch:  %{x8664}
154 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
155
156 # must be in sync with source. extra check ensuring that it is so is done in %%build
157 %define         hhvm_api_version        20140829
158 # hphp/system/idl/constants.idl.json defines it as 5.6.99-hhvm, but use some saner value
159 %define         php_version                     5.6.0
160
161 %define         hhvm_extensiondir       %{_libdir}/hhvm
162
163 %description
164 HHVM (aka the HipHop Virtual Machine) is a new open-source virtual
165 machine designed for executing programs written in PHP. HHVM uses a
166 just-in-time compilation approach to achieve superior performance
167 while maintaining the flexibility that PHP developers are accustomed
168 to. To date, HHVM (and its predecessor HPHPc before it) has realized
169 over a 9x increase in web request throughput and over a 5x reduction
170 in memory consumption for Facebook compared with the Zend PHP 5.2
171 engine + APC.
172
173 HHVM can be run as a standalone webserver (i.e. without the Apache
174 webserver and the "mod_php" extension). HHVM can also be used together
175 with a FastCGI-based webserver, and work is in progress to make HHVM
176 work smoothly with Apache.
177
178 %package fcgi
179 Summary:        Init script to start HHVM as FastCGI daemon
180 Group:          Development/Languages/PHP
181 Requires:       %{name} = %{version}-%{release}
182 Provides:       php(fcgi)
183 Requires(post,preun):   /sbin/chkconfig
184 Requires:       rc-scripts
185
186 %description fcgi
187 Init script to start HHVM as FastCGI daemon
188
189 %package program
190 Summary:        /usr/bin/php symlink
191 Summary(pl.UTF-8):      Dowiązanie symboliczne /usr/bin/php
192 Group:          Development/Languages/PHP
193 Requires:       %{name} = %{version}-%{release}
194 Obsoletes:      /usr/bin/php
195
196 %description program
197 Package providing /usr/bin/php symlink to PHP CLI.
198
199 %description program -l pl.UTF-8
200 Pakiet dostarczający dowiązanie symboliczne /usr/bin/php do PHP CLI.
201
202 %package devel
203 Summary:        Files for HHVM modules development
204 Group:          Development/Languages/PHP
205 URL:            https://github.com/facebook/hhvm/wiki/Extension-API
206 Requires:       boost-devel >= 1.50
207 Requires:       cmake >= 2.8.5
208 Requires:       glog-devel >= 0.3.2
209 Requires:       libstdc++-devel >= 6:4.3
210 Requires:       tbb-devel >= 4.0.6000
211 Requires:       zlib-devel
212
213 %description devel
214 HHVM provides a set of APIs for adding built-in functionality to the
215 runtime either by way of pure PHP code, or a combination of PHP and
216 C++.
217
218 %prep
219 %setup -q -n %{name}-HHVM-%{version} -a2 -a3
220
221 # handle git submodules
222 rmdir third-party
223 mv hhvm-third-party-* third-party
224 rmdir third-party/folly/src
225 mv folly-* third-party/folly/src
226
227 %patch1 -p1
228 %patch2 -p1
229 %patch3 -p1
230
231 # prefer ones from system
232 rm CMake/FindBISON.cmake
233 rm CMake/FindFLEX.cmake
234 rm CMake/FindFreetype.cmake
235
236 %build
237 # also in: hphp/tools/hphpize/hphpize.cmake
238 API=$(awk '/#define HHVM_API_VERSION/{v=$3; sub(/L$/, "", v); print v}' hphp/runtime/ext/extension.h)
239
240 if [ $API != %{hhvm_api_version} ]; then
241         echo "Set %%define hhvm_api_version to $API and re-run."
242         exit 1
243 fi
244
245 # out of dir build broken (can't find it's tools, or headers)
246 #install -d build
247 #cd build
248
249 # handle cmake & ccache
250 # http://stackoverflow.com/questions/1815688/how-to-use-ccache-with-cmake
251 # ASM fix: http://lists.busybox.net/pipermail/buildroot/2013-March/069436.html
252 if [[ "%{__cc}" = *ccache* ]]; then
253         cc="%{__cc}"
254         cxx="%{__cxx}"
255         ccache="
256         -DCMAKE_C_COMPILER="ccache" -DCMAKE_C_COMPILER_ARG1="${cc#ccache }" \
257         -DCMAKE_CXX_COMPILER="ccache" -DCMAKE_CXX_COMPILER_ARG1="${cxx#ccache }" \
258         -DCMAKE_ASM_COMPILER="${cc#ccache }" \
259         "
260 fi
261
262 %cmake \
263         $ccache \
264         -DCMAKE_PREFIX_PATH=%{_prefix} \
265         -DHHVM_DYNAMIC_EXTENSION_DIR=%{hhvm_extensiondir} \
266         -DUSE_JEMALLOC=OFF \
267         -DUSE_TCMALLOC=OFF \
268         -DHPHP_NOTEST=ON \
269         -DENABLE_COTIRE=ON \
270         .
271
272 # setup COMPILER_ID/HHVM_REPO_SCHEMA so it doesn't look it up from our package git repo
273 # see hphp/util/generate-buildinfo.sh
274 export COMPILER_ID=HHVM-%{version}-%{release}-g%{githash}
275 export HHVM_REPO_SCHEMA=$(date +%N_%s)
276
277 %{__make}
278
279 %install
280 # make install relinks all outputs which is very slow,
281 # so to speedup rebuild, use timestamps to record states
282 #test %{_specdir}/%{name}.spec -nt makeinstall.stamp && %{__rm} -f makeinstall.stamp
283 if [ ! -f makeinstall.stamp -o ! -d $RPM_BUILD_ROOT ]; then
284         rm -rf makeinstall.stamp installed.stamp $RPM_BUILD_ROOT
285
286         %{__make} install \
287                 DESTDIR=$RPM_BUILD_ROOT
288
289         touch makeinstall.stamp
290 fi
291
292 rm -rf $RPM_BUILD_ROOT%{_docdir}
293 if [ ! -f installed.stamp ]; then
294 # begin install block
295
296 install -d $RPM_BUILD_ROOT{%{_sysconfdir}/%{name},%{_libdir}/%{name}}
297 cp -p %{SOURCE7} $RPM_BUILD_ROOT%{_sysconfdir}/%{name}
298
299 ln -s hhvm $RPM_BUILD_ROOT%{_bindir}/php
300 ln -s hhvm $RPM_BUILD_ROOT%{_bindir}/hphp
301
302 install -d $RPM_BUILD_ROOT%{_datadir}/%{name}/hdf
303 cp -p hphp/doc/mime.hdf $RPM_BUILD_ROOT%{_datadir}/%{name}/hdf/static.mime-types.hdf
304
305 # install fastcgi initscript
306 install -d $RPM_BUILD_ROOT/etc/{sysconfig,rc.d/init.d}
307 cp -p %{SOURCE5} $RPM_BUILD_ROOT/etc/rc.d/init.d/%{name}-fcgi
308 cp -p %{SOURCE6} $RPM_BUILD_ROOT/etc/sysconfig/%{name}-fcgi
309
310 install -p hphp/hack/bin/hh_{server,client} $RPM_BUILD_ROOT%{_bindir}
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 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/%{name}/php.ini
374 %attr(755,root,root) %{_bindir}/hhvm
375 %attr(755,root,root) %{_bindir}/hphp
376 %attr(755,root,root) %{_bindir}/hh_client
377 %attr(755,root,root) %{_bindir}/hh_server
378
379 %dir %{_datadir}/%{name}
380 %dir %{_datadir}/%{name}/hdf
381 %{_datadir}/%{name}/hdf/static.mime-types.hdf
382
383 # dir for extensions
384 %dir %{_libdir}/%{name}
385
386 %files fcgi
387 %defattr(644,root,root,755)
388 %attr(754,root,root) /etc/rc.d/init.d/%{name}-fcgi
389 %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/%{name}-fcgi
390
391 %files program
392 %defattr(644,root,root,755)
393 %attr(755,root,root) %{_bindir}/php
394
395 %files devel
396 %defattr(644,root,root,755)
397 %attr(755,root,root) %{_bindir}/hphpize
398 %{_includedir}/hphp
399 %dir %{_prefix}/lib/hphp
400 %{_prefix}/lib/hphp/CMake
401 %{_prefix}/lib/hphp/hphpize
This page took 0.077508 seconds and 4 git commands to generate.