Skip to content

Instantly share code, notes, and snippets.

@kamermans
Created July 12, 2011 16:46
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save kamermans/1078394 to your computer and use it in GitHub Desktop.
Save kamermans/1078394 to your computer and use it in GitHub Desktop.
Script for installing and compiling HipHop for PHP on a fresh install of Ubuntu 11.04 x64
#!/bin/bash
# HipHop for PHP scripted installation
# by Steve Kamerman, July 12, 2011
echo -e "\e[00;31m**** Installing Prerequisites\e[00m"
sudo apt-get --yes install git-core cmake g++ libboost-dev libmysqlclient-dev libxml2-dev libmcrypt-dev libicu-dev openssl binutils-dev libcap-dev libgd2-xpm-dev zlib1g-dev libtbb-dev libonig-dev libpcre3-dev autoconf libtool libcurl4-openssl-dev libboost-system-dev libboost-program-options-dev libboost-filesystem-dev wget memcached libreadline-dev libncurses-dev libmemcached-dev libicu-dev libbz2-dev libc-client2007e-dev php5-mcrypt php5-imagick libgoogle-perftools-dev
echo -e "\e[00;31m**** Getting HIPHOP in 5 seconds ****\e[00m"
sleep 5
mkdir -p /opt/hiphop/dev
cd /opt/hiphop/dev
git clone git://github.com/facebook/hiphop-php.git
cd hiphop-php
rm CMakeCache.txt
export CMAKE_PREFIX_PATH=`/bin/pwd`/../
export HPHP_HOME=`/bin/pwd`
export HPHP_LIB=`/bin/pwd`/bin
MAKEOPTS="-j$(grep -c '^processor' /proc/cpuinfo)"
cd ..
echo -e "\e[00;31m**** Getting LIBEVENT in 5 seconds ****\e[00m"
sleep 5
wget http://www.monkey.org/~provos/libevent-1.4.14b-stable.tar.gz
tar -xzvf libevent-1.4.14b-stable.tar.gz
cd libevent-1.4.14b-stable
cp ../hiphop-php/src/third_party/libevent-1.4.14.fb-changes.diff .
patch -p1 < libevent-1.4.14.fb-changes.diff
./configure --prefix=$CMAKE_PREFIX_PATH
make
make install
cd ..
echo -e "\e[00;31m**** Getting LIBCURL in 5 seconds ****\e[00m"
sleep 5
wget http://curl.haxx.se/download/curl-7.21.2.tar.gz
tar -xvzf curl-7.21.2.tar.gz
cd curl-7.21.2
cp ../hiphop-php/src/third_party/libcurl.fb-changes.diff .
patch -p1 < libcurl.fb-changes.diff
./configure --prefix=$CMAKE_PREFIX_PATH
make
make install
cd ..
echo -e "\e[00;31m**** Getting LIBMEMCACHED in 5 seconds ****\e[00m"
sleep 5
wget http://launchpad.net/libmemcached/1.0/0.49/+download/libmemcached-0.49.tar.gz
tar -xzvf libmemcached-0.49.tar.gz
cd libmemcached-0.49
./configure --prefix=$CMAKE_PREFIX_PATH
make
make install
cd ..
echo -e "\e[00;31m**** Ready to build HipHop for PHP ****\e[00m"
echo "This process may take 30 minutes or more"
echo "Please review the output above and press 'y' if you are ready to build HipHop"
read -p "Build HipHop now (y/n)?"
if [ "$REPLY" != "y" ]; then
echo "You can build HipHop later with the following commands:"
echo "cd /opt/hiphop/dev/hiphop-php/"
echo "git submodule init"
echo "git submodule update"
echo "cmake ."
echo "make"
exit 0
fi
cd hiphop-php
git submodule init
git submodule update
cmake .
make
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment