2 # - system libevent2: https://github.com/facebook/hiphop-php/pull/421
3 # - build with newer libmemcached than 1.0.7, https://github.com/facebook/hiphop-php/issues/560
4 # - system libmbfl, system xhp, sqlite3
5 # - there should be a bit more packaged into files
7 # using bfd and gcc-6:4.6.2-2.x86_64 binutils-3:2.22.51.0.1-1.x86_64
8 # cd /home/users/glen/rpm/packages/BUILD.x86_64-linux/hiphop-php-1.000_cf9b612/src/hphpi && /home/users/glen/rpm/BUILD.x86_64-linux/hiphop-php-1.000_cf9b612/build/src/hphp/hphp -t cpp -f exe --input-dir . -i hphpi.php -o gen -vEnableEval=2 --log=1
10 # make[2]: *** [src/hphp/hphp] Error 139
11 # relinking succeeds, but resulting binary segfaults as well:
12 # 0x0000000000b9cc0b in HPHP::Extension::LoadModules(HPHP::Hdf) ()
13 %define githash 78394ee
15 Summary: Virtual Machine, Runtime, and JIT for PHP
18 Release: 0.%{githash}.%{rel}
20 Group: Development/Languages
21 Source0: https://github.com/facebook/hiphop-php/archive/%{githash}/HPHP-%{version}.%{githash}.tar.gz
22 # Source0-md5: 81742a0535a6bab906208d3756b206d1
23 # need fb.changes.patch, which is available for 1.4 only
24 Source1: http://www.monkey.org/~provos/libevent-1.4.14b-stable.tar.gz
25 # Source1-md5: a00e037e4d3f9e4fe9893e8a2d27918c
26 Source2: get-source.sh
27 Source3: http://ftp.oregonstate.edu/pub/hiphop/resources/hdf/static.mime-types.hdf
28 # Source3-md5: 1cf0a28bc27c3b407ab062b146f4e27e
29 Patch0: cmake-missing-library.patch
30 Patch1: libevent14.patch
31 Patch3: system-xhp.patch
32 Patch4: system-libafdt.patch
33 Patch5: system-folly.patch
34 Patch6: boost-system-category.patch
35 URL: http://wiki.github.com/facebook/hiphop-php/
36 BuildRequires: binutils-devel
37 BuildRequires: bison >= 2.3
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: flex >= 2.5.35
44 BuildRequires: gd-devel
45 BuildRequires: glog-devel >= 0.3.2
46 BuildRequires: imap-devel >= 1:2007
47 #BuildRequires: jemalloc-devel
48 BuildRequires: libafdt-devel >= 0.1.0
49 BuildRequires: libcap-devel
50 BuildRequires: libdwarf-devel
51 #BuildRequires: libevent-devel >= 1.4.14
52 BuildRequires: libicu-devel >= 4.2
53 #BuildRequires: libmbfl-devel
54 BuildRequires: libmcrypt-devel
55 BuildRequires: libmemcached-devel < 1.0.8
56 BuildRequires: libmemcached-devel >= 1.0.4
57 BuildRequires: libstdc++-devel >= 6:4.3
58 BuildRequires: libunwind-devel
59 BuildRequires: libxml2-devel
60 BuildRequires: mysql-devel
61 BuildRequires: oniguruma-devel
62 BuildRequires: openssl-devel
63 BuildRequires: pcre-devel
64 #BuildRequires: php-xhp-devel >= 1.3.9-6
65 BuildRequires: re2c >= 0.13.0
66 BuildRequires: readline-devel
67 BuildRequires: rpmbuild(macros) >= 1.600
68 BuildRequires: tbb-devel >= 4.0.6000
69 BuildRequires: zlib-devel
70 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
73 HipHop VM (HHVM) is a new open-source virtual machine designed for
74 executing programs written in PHP. HHVM uses a just-in-time
75 compilation approach to achieve superior performance while maintaining
76 the flexibility that PHP developers are accustomed to. HipHop VM (and
77 before it HPHPc) has realized > 5x increase in throughput for Facebook
78 compared with Zend PHP 5.2.
80 HipHop is most commonly run as a standalone server, replacing both
85 mv %{name}-%{githash}*/* .
89 ln -s libevent-1.4.*-stable libevent
90 %{__patch} -d libevent -p1 < hphp/third_party/libevent-1.4.14.fb-changes.diff
99 #rm -rf src/third_party/libmbfl
100 #sed -i -e '/add_subdirectory(third_party\/libmbfl)/d' src/CMakeLists.txt
102 rm -rf src/third_party/xhp
103 rm -rf src/third_party/libafdt
107 # build libevent 1.4 with fb patches
108 if [ ! -d libevent/.libs ]; then
110 # TODO: should use static linking, but then it fails to detect libraries due missing -lrt
112 %{?0:--enable-static} \
113 %{?0:--disable-shared}
120 export HPHP_HOME=$(pwd)
121 export HPHP_LIB=$HPHP_HOME/bin
124 export LIBEVENT_PREFIX=$HPHP_HOME/libevent
126 -DLibEvent_LIB=$HPHP_HOME/libevent/libevent.so \
127 -DLibEvent_INCLUDE_PATHS=$HPHP_HOME/libevent \
128 -DLibEvent_LIB_PATHS=$HPHP_HOME/libevent/.libs \
132 # out of dir build broken (can't find it's tools)
137 CPPFLAGS="%{rpmcppflags} -fno-permissive"
139 -DLIBEVENT_LIB=$HPHP_HOME/libevent/lib/libevent.so \
140 -DLIBEVENT_INCLUDE_DIR=$HPHP_HOME/libevent \
141 -DCMAKE_PREFIX_PATH=%{_prefix} \
142 -DSKIP_BUNDLED_XHP=ON \
149 rm -rf $RPM_BUILD_ROOT
151 DESTDIR=$RPM_BUILD_ROOT
153 install -d $RPM_BUILD_ROOT%{_datadir}/%{name}/hdf
154 cp -p %{SOURCE3} $RPM_BUILD_ROOT%{_datadir}/%{name}/hdf/static.mime-types.hdf
156 # install our libevent for now
157 install -d $RPM_BUILD_ROOT%{_libdir}
158 libtool --mode=install install -p libevent/libevent.la $RPM_BUILD_ROOT%{_libdir}
159 %{__rm} $RPM_BUILD_ROOT%{_libdir}/libevent.{a,la,so}
162 rm -rf $RPM_BUILD_ROOT
164 %post -p /sbin/ldconfig
165 %postun -p /sbin/ldconfig
168 %defattr(644,root,root,755)
169 %doc README.md hphp/NEWS
170 %attr(755,root,root) %{_bindir}/hhvm
171 %attr(755,root,root) %{_libdir}/libevent-1.4.so.*.*.*
172 %ghost %{_libdir}/libevent-1.4.so.2
174 %dir %{_datadir}/%{name}
175 %dir %{_datadir}/%{name}/hdf
176 %{_datadir}/%{name}/hdf/static.mime-types.hdf