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