Install Ubuntu 12.04 LTS dependencies for Travis CI
[folly.git] / folly / build / deps_ubuntu_12.04.sh
1 #!/bin/bash
2
3 # Installs folly's dependencies to /usr/local on a clean Ubuntu 12.04 x64
4 # system.  Primarily intended for Travis CI, since most engineers don't run
5 # distributions this stale.
6 #
7 # WARNING: Uses 'sudo' to upgrade your system with impunity:
8 #  - Adds several PPAs for missing/outdated dependencies
9 #  - Installs several from-source dependencies in /usr/local
10 #
11 # Library sources & build files end up in folly/folly/deps/
12
13 set -ex
14
15 BUILD_DIR="$(readlink -f "$(dirname "$0")")"
16 mkdir -p "$BUILD_DIR/deps"
17 cd "$BUILD_DIR/deps"
18
19 sudo apt-get install -y python-software-properties  # for add-apt-repository
20 sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
21 sudo add-apt-repository -y ppa:boost-latest/ppa
22 sudo apt-get update
23
24 sudo apt-get install -y git gcc-4.8 g++-4.8 libboost1.54-dev autoconf git \
25   libboost-thread1.54-dev libboost-filesystem1.54-dev libssl-dev cmake \
26   libsnappy-dev libboost-system1.54-dev libboost-regex1.54-dev make \
27   libboost-context1.54-dev libtool libevent-dev libgtest-dev binutils-dev
28
29 # TODO: According to the folly docs, these system dependencies might be
30 # missing.  However, things seem to build fine...
31 #  automake autoconf-archive libboost-all-dev liblz4-dev liblzma-dev
32 #  zlib1g-dev libjemalloc-dev
33
34 sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8 50
35 sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.8 50
36
37 CMAKE_NAME=cmake-2.8.12.1
38 GFLAGS_VER=2.1.1
39 GLOG_NAME=glog-0.3.3
40
41 # double-conversion
42 pushd .
43 git clone https://github.com/google/double-conversion
44 cd double-conversion
45 cmake -DBUILD_SHARED_LIBS=ON .  # Don't use scons instead, it's broken.
46 make
47 sudo make install
48 sudo ldconfig
49 popd
50
51 # Newer cmake, since the system's 2.8.7 cmake is too old for gflags:
52 # https://groups.google.com/forum/#!topic/google-gflags/bu1iIDKn-ok
53 pushd .
54 wget http://www.cmake.org/files/v2.8/${CMAKE_NAME}.tar.gz \
55   -O ${CMAKE_NAME}.tar.gz
56 tar xzf ${CMAKE_NAME}.tar.gz
57 cd ${CMAKE_NAME}
58 cmake .
59 make
60 CMAKE="$(readlink -f bin/cmake)"
61 popd
62
63 # gflags
64 pushd .
65 wget https://github.com/gflags/gflags/archive/v${GFLAGS_VER}.tar.gz \
66   -O gflags-${GFLAGS_VER}.tar.gz
67 tar xzf gflags-${GFLAGS_VER}.tar.gz
68 mkdir -p gflags-${GFLAGS_VER}/build/ && cd gflags-${GFLAGS_VER}/build/
69 "$CMAKE" .. -DBUILD_SHARED_LIBS:BOOL=ON -DGFLAGS_NAMESPACE:STRING=google
70 make
71 sudo make install
72 sudo ldconfig
73 popd
74
75 # glog
76 pushd .
77 wget https://google-glog.googlecode.com/files/${GLOG_NAME}.tar.gz \
78   -O ${GLOG_NAME}.tar.gz
79 tar xzf ${GLOG_NAME}.tar.gz
80 cd ${GLOG_NAME}
81 ./configure
82 make
83 sudo make install
84 sudo ldconfig
85 popd