Fix crash when trying to change staticness of a property
[hiphop-php.git] / configure_generic.sh
blobbb9431ecedae9000363c556c184d556d23361ec7
1 #########################################
2 # #
3 # Generic Dependency Installer Script #
4 # #
5 #########################################
7 # Current Script details
8 SCRIPT="$(readlink -f ${BASH_SOURCE[0]})"
9 SCRIPT_DIR="$(dirname $SCRIPT)"
10 PWD=$(readlink -f `pwd`)
12 # Make sure the script is run from its proper path.
13 # OR Since we know the path, why don't we do it ourselves ?
14 if [ $PWD != $SCRIPT_DIR ]
15 then
16 echo "Run the script from the hiphop-php directory like:"
17 echo "cd $SCRIPT_DIR && ./$SCRIPT"
18 exit 1
21 # Identify the Distro
22 OS_TYPE=$(uname)
23 if [ "x$OS_TYPE" = "xLinux" ];then
24 DISTRO_NAME=$(head -1 /etc/issue)
25 if grep -i fedora /etc/issue >/dev/null 2>&1; then
26 DISTRO=fedora
27 elif grep -i ubuntu /etc/issue >/dev/null 2>&1;then
28 DISTRO=ubuntu
29 else
30 DISTRO=unknown
32 else
33 echo "Linux is the only supported Operating system right now."
34 echo "Please submit a PR when this script is enhanced to support"
35 echo "other operating systems"
36 echo ""
37 echo "Project URL: https://github.com/facebook/hhvm"
38 echo ""
39 echo " - Thank You."
40 exit 1
43 echo "Date/Time : $(date)"
44 echo "Current Distro : $DISTRO_NAME"
46 # Determine the CPUs irrespective of Travis Mode
47 CPUS=`cat /proc/cpuinfo | grep -E '^processor' | tail -1 | cut -d : -f 2`
48 CPUS=`expr ${CPUS} + 1`
50 # For travis
51 if [ "x${TRAVIS}" != "x" ]; then
52 # Collect some stats for use in tuning build later on
53 free
54 echo "Travis Mode : YES"
55 echo "# CPUs : ${CPUS}"
56 echo ""
57 else
58 echo "Travis Mode : NO"
59 echo "# CPUs : ${CPUS}"
60 echo ""
63 # Place to save all the binaries/libraries/headers from the ext packages
64 export CMAKE_PREFIX_PATH=`/bin/pwd`/..
66 case $DISTRO in
67 fedora)
68 # install the actual dependencies
69 sudo yum groupinstall "Fedora Packager" -y
70 sudo yum install -y git wget make autoconf binutils-devel \
71 boost-devel bzip2-devel chrpath cmake cyrus-sasl elfutils-libelf-devel \
72 expat-devel fontconfig-devel freetype-devel gcc-c++ gd-devel glibc-devel \
73 glog-devel jemalloc-devel keyutils-libs krb5-devel libaio-devel libcap-devel \
74 libc-client libc-client-devel libcom_err-devel libdwarf-devel libedit-devel \
75 libicu-devel libjpeg-turbo libjpeg-turbo-devel libmcrypt-devel libmemcached-devel \
76 libpng-devel libselinux-devel libsepol-devel libstdc++-devel libtool \
77 libunwind-devel libvpx-devel libX11-devel libXau-devel libxcb-devel libxml2-devel \
78 libxml++-devel libXpm-devel mysql-devel ncurses-devel oniguruma-devel openldap-devel \
79 openssl-devel pam-devel pcre-devel readline-devel tbb-devel unixODBC-devel \
80 uw-imap-devel zlib zlib-devel \
81 ImageMagick-devel libxslt-devel &
83 # For patched stuff.
84 git clone git://github.com/libevent/libevent.git --quiet &
85 git clone git://github.com/bagder/curl.git --quiet &
87 ubuntu)
88 # install python-software-properties before trying to add a PPA
89 sudo apt-get -y update
90 sudo apt-get install -y python-software-properties
92 # install apt-fast to speed up later dependency installation
93 sudo add-apt-repository -y ppa:apt-fast/stable
94 sudo add-apt-repository -y ppa:mapnik/boost
95 sudo apt-get -y update
96 sudo apt-get -y install apt-fast
98 # install the actual dependencies
99 sudo apt-fast -y update
100 sudo apt-fast -y install git-core cmake g++ libboost1.49-dev libmysqlclient-dev \
101 libxml2-dev libmcrypt-dev libicu-dev openssl build-essential binutils-dev \
102 libcap-dev libgd2-xpm-dev zlib1g-dev libtbb-dev libonig-dev libpcre3-dev \
103 autoconf libtool libcurl4-openssl-dev libboost-regex1.49-dev libboost-system1.49-dev \
104 libboost-program-options1.49-dev libboost-filesystem1.49-dev libboost-thread1.49-dev \
105 wget memcached libreadline-dev libncurses-dev libmemcached-dev libbz2-dev \
106 libc-client2007e-dev php5-mcrypt php5-imagick libgoogle-perftools-dev \
107 libcloog-ppl0 libelf-dev libdwarf-dev libunwind7-dev subversion \
108 libmagickwand-dev libxslt1-dev &
110 git clone git://github.com/libevent/libevent.git --quiet &
111 git clone git://github.com/bagder/curl.git --quiet &
112 svn checkout http://google-glog.googlecode.com/svn/trunk/ google-glog --quiet &
113 wget http://www.canonware.com/download/jemalloc/jemalloc-3.5.1.tar.bz2 --quiet &
116 echo "Unknown distribution. Please update packages in this section."
117 exit 1
119 esac
121 # init submodules
122 git submodule update --init --recursive
124 # wait until all background processes finished
125 FAIL=0
127 for job in `jobs -p`
129 echo "waiting for background job $job"
130 wait $job || let "FAIL+=1"
131 done
133 if [ "$FAIL" == "0" ];
134 then
135 echo "all downloads finished"
136 else
137 echo "$FAIL errors while downloading!"
138 exit 100
141 if [[ "x$DISTRO" == "xubuntu" ]];then
142 # Leave this install till after the main parallel package install above
143 # since it adds a non-12.04 package repo and we don't want to
144 # pull EVERYTHING in, just the newer gcc compiler (and toolchain)
145 GCC_VER=4.7
146 if [ "x${TRAVIS}" != "x" ]; then
147 GCC_VER=4.8
149 sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
150 sudo apt-get -y update
151 sudo apt-get -y install gcc-${GCC_VER} g++-${GCC_VER}
152 sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-${GCC_VER} 60 \
153 --slave /usr/bin/g++ g++ /usr/bin/g++-${GCC_VER}
154 sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.6 40 \
155 --slave /usr/bin/g++ g++ /usr/bin/g++-4.6
156 sudo update-alternatives --set gcc /usr/bin/gcc-${GCC_VER}
159 # libevent
160 cd libevent
161 git checkout release-1.4.14b-stable
162 cat ../third-party/libevent-1.4.14.fb-changes.diff | patch -p1
163 ./autogen.sh
164 ./configure --prefix=$CMAKE_PREFIX_PATH
165 make -j $CPUS
166 make install
167 cd ..
169 # curl
170 cd curl
171 ./buildconf
172 ./configure --prefix=$CMAKE_PREFIX_PATH
173 make -j $CPUS
174 make install
175 cd ..
177 if [[ "x$DISTRO" == "xubuntu" ]];then
178 # glog
179 cd google-glog
180 ./configure --prefix=$CMAKE_PREFIX_PATH
181 make -j $CPUS
182 make install
183 cd ..
185 # jemaloc
186 tar xjvf jemalloc-3.5.1.tar.bz2
187 cd jemalloc-3.5.1
188 ./configure --prefix=$CMAKE_PREFIX_PATH
189 make -j $CPUS
190 make install
191 cd ..
193 # cleanup
194 rm -rf google-glog jemalloc-3.5.1.tar.bz2 jemalloc-3.5.1
197 # cleanup
198 rm -rf libevent curl
200 # hphp
201 cmake .
203 # all set
204 echo "-------------------------------------------------------------------------"
205 echo "Done. Now run:"
206 echo " CMAKE_PREFIX_PATH=\`pwd\`/.. make"