Install Ubuntu 12.04 LTS dependencies for Travis CI
authorAlexey Spiridonov <lesha@fb.com>
Tue, 7 Jul 2015 20:36:16 +0000 (13:36 -0700)
committerSara Golemon <sgolemon@fb.com>
Tue, 7 Jul 2015 20:44:38 +0000 (13:44 -0700)
Summary: This is the first of a series of diffs to get folly, fbthrift, and bistro to run on Ubuntu 12.04 LTS, which is what powers Travis CI.

It's important for folly to be easily usable with Travis CI, since everything C++ depends on it, and we really want all FB open-source projects to be monitored via continuous integration to avoid breaking their OSS builds.

Thanks to @int's work on `mcrouter`, this was considerably easier than it would have been otherwise.

This puts us a hop and a skip away from actually running folly's `make && make check && make install` on Travis CI. Do y'all think this is useful?

Reviewed By: @yfeldblum

Differential Revision: D2217441

README.md
folly/bootstrap-osx-homebrew.sh [deleted file]
folly/build/bootstrap-osx-homebrew.sh [new file with mode: 0755]
folly/build/deps_ubuntu_12.04.sh [new file with mode: 0755]

index e6800cb6e50c04a9053cf22a4a818a17b15ff34b..30df7fa46c0878815a12d275a7a988da1b2e6fa0 100644 (file)
--- a/README.md
+++ b/README.md
@@ -18,6 +18,13 @@ Please download googletest from
 https://googletest.googlecode.com/files/gtest-1.7.0.zip and unzip it in the
 folly/test subdirectory.
 
 https://googletest.googlecode.com/files/gtest-1.7.0.zip and unzip it in the
 folly/test subdirectory.
 
+Ubuntu 12.04
+------------
+
+This release is old, requiring many upgrades. However, since Travis CI runs
+on 12.04, `folly/build/deps_ubuntu_12.04.sh` is provided, and upgrades all
+the required packages.
+
 Ubuntu 13.10
 ------------
 
 Ubuntu 13.10
 ------------
 
@@ -71,11 +78,11 @@ OS X (Homebrew)
 ----
 folly is available as a Formula and releases may be built via `brew install folly`.
 
 ----
 folly is available as a Formula and releases may be built via `brew install folly`.
 
-You may also use `folly/bootstrap-osx-homebrew.sh` to build against `master`:
+You may also use `folly/build/bootstrap-osx-homebrew.sh` to build against `master`:
 
 ```
   cd folly
 
 ```
   cd folly
-  ./bootstrap-osx-homebrew.sh
+  ./build/bootstrap-osx-homebrew.sh
   make
   make check
 ```
   make
   make check
 ```
diff --git a/folly/bootstrap-osx-homebrew.sh b/folly/bootstrap-osx-homebrew.sh
deleted file mode 100755 (executable)
index 688ce4d..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-#!/bin/bash -x
-# The only prerequisite should be homebrew. If something doesn't work out of
-# the box with just homebrew, let's fix it.
-
-# fail fast
-set -e
-
-brewget() {
-    brew install $@ || brew upgrade $@
-}
-
-# tool dependencies: autotools and scons (for double-conversion)
-brewget autoconf automake libtool
-
-# dependencies
-brewget glog gflags boost libevent double-conversion
-
-autoreconf -i
-./configure
-
-pushd test
-test -e gtest-1.7.0.zip || {
-    curl -O https://googletest.googlecode.com/files/gtest-1.7.0.zip
-    unzip gtest-1.7.0.zip
-}
-popd
diff --git a/folly/build/bootstrap-osx-homebrew.sh b/folly/build/bootstrap-osx-homebrew.sh
new file mode 100755 (executable)
index 0000000..c7c350c
--- /dev/null
@@ -0,0 +1,29 @@
+#!/bin/bash -x
+# The only prerequisite should be homebrew. If something doesn't work out of
+# the box with just homebrew, let's fix it.
+
+# fail fast
+set -e
+
+BASE_DIR="$(cd "$(dirname -- "$0")"/.. ; pwd)"  # folly/folly
+cd "$BASE_DIR"
+
+brewget() {
+    brew install $@ || brew upgrade $@
+}
+
+# tool dependencies: autotools and scons (for double-conversion)
+brewget autoconf automake libtool
+
+# dependencies
+brewget glog gflags boost libevent double-conversion
+
+autoreconf -i
+./configure
+
+pushd test
+test -e gtest-1.7.0.zip || {
+    curl -O https://googletest.googlecode.com/files/gtest-1.7.0.zip
+    unzip gtest-1.7.0.zip
+}
+popd
diff --git a/folly/build/deps_ubuntu_12.04.sh b/folly/build/deps_ubuntu_12.04.sh
new file mode 100755 (executable)
index 0000000..4e3e7d2
--- /dev/null
@@ -0,0 +1,85 @@
+#!/bin/bash
+
+# Installs folly's dependencies to /usr/local on a clean Ubuntu 12.04 x64
+# system.  Primarily intended for Travis CI, since most engineers don't run
+# distributions this stale.
+#
+# WARNING: Uses 'sudo' to upgrade your system with impunity:
+#  - Adds several PPAs for missing/outdated dependencies
+#  - Installs several from-source dependencies in /usr/local
+#
+# Library sources & build files end up in folly/folly/deps/
+
+set -ex
+
+BUILD_DIR="$(readlink -f "$(dirname "$0")")"
+mkdir -p "$BUILD_DIR/deps"
+cd "$BUILD_DIR/deps"
+
+sudo apt-get install -y python-software-properties  # for add-apt-repository
+sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
+sudo add-apt-repository -y ppa:boost-latest/ppa
+sudo apt-get update
+
+sudo apt-get install -y git gcc-4.8 g++-4.8 libboost1.54-dev autoconf git \
+  libboost-thread1.54-dev libboost-filesystem1.54-dev libssl-dev cmake \
+  libsnappy-dev libboost-system1.54-dev libboost-regex1.54-dev make \
+  libboost-context1.54-dev libtool libevent-dev libgtest-dev binutils-dev
+
+# TODO: According to the folly docs, these system dependencies might be
+# missing.  However, things seem to build fine...
+#  automake autoconf-archive libboost-all-dev liblz4-dev liblzma-dev
+#  zlib1g-dev libjemalloc-dev
+
+sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8 50
+sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.8 50
+
+CMAKE_NAME=cmake-2.8.12.1
+GFLAGS_VER=2.1.1
+GLOG_NAME=glog-0.3.3
+
+# double-conversion
+pushd .
+git clone https://github.com/google/double-conversion
+cd double-conversion
+cmake -DBUILD_SHARED_LIBS=ON .  # Don't use scons instead, it's broken.
+make
+sudo make install
+sudo ldconfig
+popd
+
+# Newer cmake, since the system's 2.8.7 cmake is too old for gflags:
+# https://groups.google.com/forum/#!topic/google-gflags/bu1iIDKn-ok
+pushd .
+wget http://www.cmake.org/files/v2.8/${CMAKE_NAME}.tar.gz \
+  -O ${CMAKE_NAME}.tar.gz
+tar xzf ${CMAKE_NAME}.tar.gz
+cd ${CMAKE_NAME}
+cmake .
+make
+CMAKE="$(readlink -f bin/cmake)"
+popd
+
+# gflags
+pushd .
+wget https://github.com/gflags/gflags/archive/v${GFLAGS_VER}.tar.gz \
+  -O gflags-${GFLAGS_VER}.tar.gz
+tar xzf gflags-${GFLAGS_VER}.tar.gz
+mkdir -p gflags-${GFLAGS_VER}/build/ && cd gflags-${GFLAGS_VER}/build/
+"$CMAKE" .. -DBUILD_SHARED_LIBS:BOOL=ON -DGFLAGS_NAMESPACE:STRING=google
+make
+sudo make install
+sudo ldconfig
+popd
+
+# glog
+pushd .
+wget https://google-glog.googlecode.com/files/${GLOG_NAME}.tar.gz \
+  -O ${GLOG_NAME}.tar.gz
+tar xzf ${GLOG_NAME}.tar.gz
+cd ${GLOG_NAME}
+./configure
+make
+sudo make install
+sudo ldconfig
+popd