2 # - hphp/runtime/base/runtime-option.cpp evalJitDefault enables jit if /.hhvm-jit exists (yes, in filesystem root)
4 # - system libevent2: https://github.com/facebook/hiphop-php/pull/421
5 # - system libmbfl, system xhp, sqlite3
6 %define githash 78394ee
8 Summary: Virtual Machine, Runtime, and JIT for PHP
11 Release: 0.%{githash}.%{rel}
13 Group: Development/Languages
14 Source0: https://github.com/facebook/hiphop-php/archive/%{githash}/HPHP-%{version}.%{githash}.tar.gz
15 # Source0-md5: 81742a0535a6bab906208d3756b206d1
16 # need fb.changes.patch, which is available for 1.4 only
17 Source1: http://www.monkey.org/~provos/libevent-1.4.14b-stable.tar.gz
18 # Source1-md5: a00e037e4d3f9e4fe9893e8a2d27918c
19 Source2: get-source.sh
20 Patch0: cmake-missing-library.patch
21 Patch1: libevent14.patch
22 Patch3: system-xhp.patch
23 Patch4: system-libafdt.patch
24 Patch5: system-folly.patch
25 Patch6: boost-system-category.patch
26 URL: http://wiki.github.com/facebook/hiphop-php/
27 BuildRequires: binutils-devel
28 BuildRequires: bison >= 2.3
29 BuildRequires: boost-devel >= 1.50
30 BuildRequires: cmake >= 2.8.5
31 BuildRequires: curl-devel >= 7.29.0
32 BuildRequires: elfutils-devel
33 BuildRequires: expat-devel
34 BuildRequires: flex >= 2.5.35
35 BuildRequires: gcc >= 6:4.6.0
36 BuildRequires: gd-devel
37 BuildRequires: glog-devel >= 0.3.2
38 BuildRequires: imap-devel >= 1:2007
39 #BuildRequires: jemalloc-devel
40 BuildRequires: libafdt-devel >= 0.1.0
41 BuildRequires: libcap-devel
42 BuildRequires: libdwarf-devel
43 #BuildRequires: libevent-devel >= 1.4.14
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.3
49 BuildRequires: libunwind-devel
50 BuildRequires: libxml2-devel
51 BuildRequires: mysql-devel
52 BuildRequires: oniguruma-devel
53 BuildRequires: openssl-devel
54 BuildRequires: pcre-devel
55 #BuildRequires: php-xhp-devel >= 1.3.9-6
56 BuildRequires: re2c >= 0.13.0
57 BuildRequires: readline-devel
58 BuildRequires: rpmbuild(macros) >= 1.675
59 BuildRequires: tbb-devel >= 4.0.6000
60 BuildRequires: zlib-devel
72 Provides: php(hotprofiler)
74 Provides: php(icu_ucsdet)
75 Provides: php(icu_uspoof)
80 Provides: php(mbstring)
82 Provides: php(memcache)
83 Provides: php(memcached)
85 Provides: php(openssl)
89 Provides: php(pdo_mysql)
90 Provides: php(pdo_sqlite)
93 Provides: php(reflection)
95 Provides: php(session)
96 Provides: php(simplexml)
98 Provides: php(sockets)
100 Provides: php(sqlite3)
101 Provides: php(sysvmsg)
102 Provides: php(sysvsem)
103 Provides: php(sysvshm)
104 Provides: php(thread)
105 Provides: php(thrift_protocol)
106 Provides: php(tokenizer)
107 Provides: php(xhprof)
109 Provides: php(xmlreader)
110 Provides: php(xmlwriter)
112 ExclusiveArch: %{x8664}
113 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
116 HipHop VM (HHVM) is a new open-source virtual machine designed for
117 executing programs written in PHP. HHVM uses a just-in-time
118 compilation approach to achieve superior performance while maintaining
119 the flexibility that PHP developers are accustomed to. HipHop VM (and
120 before it HPHPc) has realized > 5x increase in throughput for Facebook
121 compared with Zend PHP 5.2.
123 HipHop is most commonly run as a standalone server, replacing both
128 mv %{name}-%{githash}*/* .
133 ln -s libevent-1.4.*-stable libevent
134 %{__patch} -d libevent -p1 < hphp/third_party/libevent-1.4.14.fb-changes.diff
143 #rm -rf src/third_party/libmbfl
144 #sed -i -e '/add_subdirectory(third_party\/libmbfl)/d' src/CMakeLists.txt
146 rm -rf src/third_party/xhp
147 rm -rf src/third_party/libafdt
151 # build libevent 1.4 with fb patches
152 if [ ! -d libevent/.libs ]; then
154 # TODO: should use static linking, but then it fails to detect libraries due missing -lrt
156 %{?0:--enable-static} \
157 %{?0:--disable-shared}
164 export HPHP_HOME=$(pwd)
165 export HPHP_LIB=$HPHP_HOME/bin
167 # asm linking breaks on $CC containing spaces
168 if [[ "%{__cc}" = *ccache* ]]; then
169 cat <<-'EOF' > $HPHP_LIB/gcc
173 chmod +x $HPHP_LIB/gcc
178 export LIBEVENT_PREFIX=$HPHP_HOME/libevent
180 -DLibEvent_LIB=$HPHP_HOME/libevent/libevent.so \
181 -DLibEvent_INCLUDE_PATHS=$HPHP_HOME/libevent \
182 -DLibEvent_LIB_PATHS=$HPHP_HOME/libevent/.libs \
186 # out of dir build broken (can't find it's tools)
192 -DLIBEVENT_LIB=$HPHP_HOME/libevent/lib/libevent.so \
193 -DLIBEVENT_INCLUDE_DIR=$HPHP_HOME/libevent \
194 -DCMAKE_PREFIX_PATH=%{_prefix} \
195 -DSKIP_BUNDLED_XHP=ON \
200 # setup COMPILER_ID/HHVM_REPO_SCHEMA so it doesn't look it up from our package git repo
201 # see hphp/util/generate-buildinfo.sh
202 sha=$(echo %{name}-%{githash}*)
203 export COMPILER_ID=HPHP-%{version}-%{release}-${sha#%{name}-}
204 export HHVM_REPO_SCHEMA=$(date +%N_%s)
209 rm -rf $RPM_BUILD_ROOT
212 DESTDIR=$RPM_BUILD_ROOT
214 install -d $RPM_BUILD_ROOT%{_datadir}/%{name}/hdf
215 cp -p hphp/doc/mime.hdf $RPM_BUILD_ROOT%{_datadir}/%{name}/hdf/static.mime-types.hdf
217 # install our libevent for now
218 install -d $RPM_BUILD_ROOT%{_libdir}
219 libtool --mode=install install -p libevent/libevent.la $RPM_BUILD_ROOT%{_libdir}
220 %{__rm} $RPM_BUILD_ROOT%{_libdir}/libevent.{a,la,so}
223 rm -rf $RPM_BUILD_ROOT
225 %post -p /sbin/ldconfig
226 %postun -p /sbin/ldconfig
229 %defattr(644,root,root,755)
230 %doc README.md hphp/NEWS
231 %attr(755,root,root) %{_bindir}/hhvm
232 %attr(755,root,root) %{_libdir}/libevent-1.4.so.*.*.*
233 %ghost %{_libdir}/libevent-1.4.so.2
235 %dir %{_datadir}/%{name}
236 %dir %{_datadir}/%{name}/hdf
237 %{_datadir}/%{name}/hdf/static.mime-types.hdf