--- /dev/null
+#!/bin/sh
+set -e
+
+package=hiphop-php
+version=$(awk '/^Version:/{print $NF}' $package.spec)
+repo_url=git://github.com/facebook/$package.git
+
+export GIT_DIR=$package/.git
+
+if [ ! -d $package ]; then
+ git clone --depth 1 $repo_url $package
+else
+ git pull
+fi
+
+git submodule init
+git submodule update
+
+#rm -rf src/third_party/libmbfl
+#rm -rf src/third_party/xhp
+#rm -rf src/third_party/libafdt
+
+version=$(cd $package; (echo 'function HPHP_VERSION(v) { printf("%.3f", v)}; BEGIN{'; cat src/version; echo '}') | awk -f -)
+version=${version}_$(git log -1 --format=%h)
+
+git archive master --prefix $package-$version/ | bzip2 > $package-$version.tar.bz2
+
+../dropin $package-$version.tar.bz2 &
# TODO
# - system libmbfl, system xhp, sqlite3
# - there should be a bit more packaged into files
-# - mysql namespace sanity:
-#/home/users/glen/rpm/BUILD.x86_64-linux/hiphop-php/src/runtime/ext/ext_mysql.cpp:730: error: undefined reference to 'cli_safe_read'
-#/home/users/glen/rpm/BUILD.x86_64-linux/hiphop-php/src/runtime/ext/ext_mysql.cpp:740: error: undefined reference to 'net_field_length'
-#/home/users/glen/rpm/BUILD.x86_64-linux/hiphop-php/src/runtime/ext/ext_mysql.cpp:753: error: undefined reference to 'cli_safe_read'
-#/home/users/glen/rpm/BUILD.x86_64-linux/hiphop-php/src/runtime/ext/ext_mysql.cpp:784: error: undefined reference to 'free_root'
-%if 0
-# source updating:
-git clone git://github.com/facebook/hiphop-php.git
-cd hiphop-php
-git submodule init
-git submodule update
-rm -rf src/third_party/libmbfl
-rm -rf src/third_party/xhp
-rm -rf src/third_party/libafdt
-version=$((echo 'function HPHP_VERSION(v) { printf("%.3f", v)}; BEGIN{'; cat src/version; echo '}') | awk -f -)
-version=${version}_$(git log -1 --format=%h)
-cd ..
-tar --exclude-vcs -cjf hiphop-php-$version.tar.bz2 hiphop-php
-../dropin hiphop-php-$version.tar.bz2
-%endif
+# - linking segfaults
+# using bfd and gcc-6:4.6.2-2.x86_64 binutils-3:2.22.51.0.1-1.x86_64
+# 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
+# Segmentation fault
+# make[2]: *** [src/hphp/hphp] Error 139
+# relinking succeeds, but resulting binary segfaults as well:
+# 0x0000000000b9cc0b in HPHP::Extension::LoadModules(HPHP::Hdf) ()
+%define snap cf9b612
+%define rel 0.2
Summary: HipHop for PHP transforms PHP source code into highly optimized C++
Name: hiphop-php
Version: 1.000
-Release: 0.1
+Release: %{rel}.%{snap}
License: PHP 3.01
Group: Development/Languages
-Source0: %{name}-%{version}_9f026c9.tar.bz2
+Source0: %{name}-%{version}_%{snap}.tar.bz2
# Source0-md5: 16b7928995a91001657b015fe7f8a06d
# need fb.changes.patch, which is available for 1.4 only
Source1: http://www.monkey.org/~provos/libevent-1.4.14b-stable.tar.gz
# Source1-md5: a00e037e4d3f9e4fe9893e8a2d27918c
+Source2: get-source.sh
Patch0: cmake-missing-library.patch
+Patch1: libevent14.patch
Patch3: system-xhp.patch
Patch4: system-libafdt.patch
URL: http://wiki.github.com/facebook/hiphop-php/
BuildRequires: expat-devel
BuildRequires: flex >= 2.5.35
BuildRequires: gd-devel
+BuildRequires: jemalloc-devel
BuildRequires: libafdt-devel >= 0.1.0
BuildRequires: libcap-devel
#BuildRequires: libevent-devel < 2.0
#BuildRequires: libevent-devel >= 1.4.13-2
BuildRequires: libicu-devel >= 4.2
-BuildRequires: libmbfl-devel
+#BuildRequires: libmbfl-devel
BuildRequires: libmcrypt
BuildRequires: libmemcached-devel >= 0.39
BuildRequires: libstdc++-devel >= 6:4.3
tier can serve twice the traffic using 30% less CPU.
%prep
-%setup -qn %{name} -a1
+%setup -qn %{name}-%{version}_%{snap} -a1
%patch0 -p1
+%patch1 -p1
#%patch3 -p1
%patch4 -p1
ln -s libevent-1.4.*-stable libevent
%{__patch} -d libevent -p1 < src/third_party/libevent-1.4.14.fb-changes.diff
-rm -rf src/third_party/libmbfl
+#rm -rf src/third_party/libmbfl
+#sed -i -e '/add_subdirectory(third_party\/libmbfl)/d' src/CMakeLists.txt
+
rm -rf src/third_party/xhp
rm -rf src/third_party/libafdt
install -d build
cd build
%cmake \
- -DLibEvent_PREFIX=$HPHP_HOME/libevent \
- -DzLIBEVENT_INCLUDE_DIR=$HPHP_HOME/libevent \
- -DzLIBEVENT_LIB=$HPHP_HOME/libevent/.libs/libevent.a \
+ -DLibEvent_INCLUDE_PATHS=$HPHP_HOME/libevent \
+ -DLibEvent_LIB_PATHS=$HPHP_HOME/libevent/.libs \
-DCMAKE_PREFIX_PATH=%{_prefix} \
-DSKIP_BUNDLED_XHP=ON \
+ -DUSE_JEMALLOC=ON \
+ -DUSE_TCMALLOC=OFF \
../
%{__make}
%install
rm -rf $RPM_BUILD_ROOT
-%{__make} install \
- DESTDIR=$RPM_BUILD_ROOT
+install -d $RPM_BUILD_ROOT%{_bindir}
+install -p build/src/hphp/hphp $RPM_BUILD_ROOT%{_bindir}
%clean
rm -rf $RPM_BUILD_ROOT
%files
%defattr(644,root,root,755)
+%attr(755,root,root) %{_bindir}/hphp