Fix race condition between 2 tests reading/writing the same file
[hiphop-php.git] / configure_ubuntu_12.04.sh
blob04e2fe8595a1d0acb87cc393cbf4560fe1b64a7e
1 #########################################
3 # Install all the dependencies for HipHop
5 #########################################
7 SCRIPT_NAME='./configure_ubuntu_12.04.sh'
8 if [ "$0" != "$SCRIPT_NAME" ]; then
9 echo "Run the script from the hiphop-php directory like:"
10 echo " $SCRIPT_NAME"
11 exit 1
14 if [ "x${TRAVIS}" != "x" ]; then
15 # Collect some stats for use in tuning build later on
16 free
17 CPUS=`cat /proc/cpuinfo | grep -E '^processor' | tail -1 | cut -d : -f 2`
18 CPUS=`expr ${CPUS} + 1`
19 echo "CPUs: ${CPUS}"
22 export CMAKE_PREFIX_PATH=`/bin/pwd`/..
24 # install python-software-properties before trying to add a PPA
25 sudo apt-get -y update
26 sudo apt-get install -y python-software-properties
28 # install apt-fast to speed up later dependency installation
29 sudo add-apt-repository -y ppa:apt-fast/stable
30 sudo add-apt-repository -y ppa:mapnik/boost
31 sudo apt-get -y update
32 sudo apt-get -y install apt-fast
34 # install the actual dependencies
35 sudo apt-fast -y update
36 sudo apt-fast -y install git-core cmake g++ libboost1.49-dev libmysqlclient-dev \
37 libxml2-dev libmcrypt-dev libicu-dev openssl build-essential binutils-dev \
38 libcap-dev libgd2-xpm-dev zlib1g-dev libtbb-dev libonig-dev libpcre3-dev \
39 autoconf libtool libcurl4-openssl-dev libboost-regex1.49-dev libboost-system1.49-dev \
40 libboost-program-options1.49-dev libboost-filesystem1.49-dev libboost-thread1.49-dev \
41 wget memcached libreadline-dev libncurses-dev libmemcached-dev libbz2-dev \
42 libc-client2007e-dev php5-mcrypt php5-imagick libgoogle-perftools-dev \
43 libcloog-ppl0 libelf-dev libdwarf-dev libunwind7-dev subversion \
44 libmagickwand-dev libxslt1-dev &
46 git clone git://github.com/libevent/libevent.git --quiet &
47 git clone git://github.com/bagder/curl.git --quiet &
48 svn checkout http://google-glog.googlecode.com/svn/trunk/ google-glog --quiet &
49 wget http://www.canonware.com/download/jemalloc/jemalloc-3.0.0.tar.bz2 --quiet &
51 # init submodules
52 git submodule update --init
54 # wait until all background processes finished
55 FAIL=0
57 for job in `jobs -p`
59 echo "waiting for background job $job"
60 wait $job || let "FAIL+=1"
61 done
63 if [ "$FAIL" == "0" ];
64 then
65 echo "all downloads finished"
66 else
67 echo "$FAIL errors while downloading!"
68 exit 100
71 # Leave this install till after the main parallel package install above
72 # since it adds a non-12.04 package repo and we don't want to
73 # pull EVERYTHING in, just the newer gcc compiler (and toolchain)
74 GCC_VER=4.7
75 if [ "x${TRAVIS}" != "x" ]; then
76 GCC_VER=4.8
78 sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
79 sudo apt-get -y update
80 sudo apt-get -y install gcc-${GCC_VER} g++-${GCC_VER}
81 sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-${GCC_VER} 60 \
82 --slave /usr/bin/g++ g++ /usr/bin/g++-${GCC_VER}
83 sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.6 40 \
84 --slave /usr/bin/g++ g++ /usr/bin/g++-4.6
85 sudo update-alternatives --set gcc /usr/bin/gcc-${GCC_VER}
87 # libevent
88 cd libevent
89 git checkout release-1.4.14b-stable
90 cat ../hphp/third_party/libevent-1.4.14.fb-changes.diff | patch -p1
91 ./autogen.sh
92 ./configure --prefix=$CMAKE_PREFIX_PATH
93 make -j $CPUS
94 make install
95 cd ..
97 # curl
98 cd curl
99 ./buildconf
100 ./configure --prefix=$CMAKE_PREFIX_PATH
101 make -j $CPUS
102 make install
103 cd ..
105 # glog
106 cd google-glog
107 ./configure --prefix=$CMAKE_PREFIX_PATH
108 make -j $CPUS
109 make install
110 cd ..
112 # jemaloc
113 tar xjvf jemalloc-3.0.0.tar.bz2
114 cd jemalloc-3.0.0
115 ./configure --prefix=$CMAKE_PREFIX_PATH
116 make -j $CPUS
117 make install
118 cd ..
120 # cleanup
121 rm -rf libevent curl google-glog jemalloc-3.0.0.tar.bz2 jemalloc-3.0.0
123 # hphp
124 cmake .
126 echo "-------------------------------------------------------------------------"
127 echo "Done. Now run:"
128 echo " CMAKE_PREFIX_PATH=\`pwd\`/.. make"