1 #########################################
3 # Generic Dependency Installer Script #
5 #########################################
7 # Current Script details
8 SCRIPT
="$(readlink -f $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 ]
16 echo "Run the script from the hiphop-php directory like:"
17 echo "cd $SCRIPT_DIR && ./$SCRIPT"
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
27 elif grep -i ubuntu
/etc
/issue
>/dev
/null
2>&1;then
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"
37 echo "Project URL: https://github.com/facebook/hhvm"
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`
51 if [ "x${TRAVIS}" != "x" ]; then
52 # Collect some stats for use in tuning build later on
54 echo "Travis Mode : YES"
55 echo "# CPUs : ${CPUS}"
58 echo "Travis Mode : NO"
59 echo "# CPUs : ${CPUS}"
63 # Place to save all the binaries/libraries/headers from the ext packages
64 export CMAKE_PREFIX_PATH
=`/bin/pwd`/..
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
&
84 git clone git
://github.com
/libevent
/libevent.git
--quiet &
85 git clone git
://github.com
/bagder
/curl.git
--quiet &
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."
122 git submodule update
--init --recursive
124 # wait until all background processes finished
129 echo "waiting for background job $job"
130 wait $job ||
let "FAIL+=1"
133 if [ "$FAIL" == "0" ];
135 echo "all downloads finished"
137 echo "$FAIL errors while downloading!"
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)
146 if [ "x${TRAVIS}" != "x" ]; then
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}
161 git checkout release-1.4
.14b-stable
162 cat ..
/third-party
/libevent-1.4
.14.fb-changes.
diff |
patch -p1
164 .
/configure
--prefix=$CMAKE_PREFIX_PATH
172 .
/configure
--prefix=$CMAKE_PREFIX_PATH
177 if [[ "x$DISTRO" == "xubuntu" ]];then
180 .
/configure
--prefix=$CMAKE_PREFIX_PATH
186 tar xjvf jemalloc-3.5
.1.
tar.bz2
188 .
/configure
--prefix=$CMAKE_PREFIX_PATH
194 rm -rf google-glog jemalloc-3.5
.1.
tar.bz2 jemalloc-3.5
.1
204 echo "-------------------------------------------------------------------------"
205 echo "Done. Now run:"
206 echo " CMAKE_PREFIX_PATH=\`pwd\`/.. make"