From 521aa140f614499c73e0908fc33da8d475ee3fe7 Mon Sep 17 00:00:00 2001 From: Victor Costan Date: Fri, 8 Jan 2016 13:35:57 -0500 Subject: [PATCH] Another attempt of getting Travis CI to work. --- .gitignore | 6 ++--- .gitmodules | 3 +++ .travis.yml | 50 ++++++++++++++++++++++++++++------- README.md | 2 +- build/deps.sh | 29 -------------------- deps/cmake | 1 + scripts/deps/all.sh | 15 +++++++++++ scripts/deps/cmake.sh | 15 +++++++++++ scripts/deps/llvm.sh | 23 ++++++++++++++++ scripts/deps/ninja.sh | 16 +++++++++++ scripts/deps/setup.sh | 13 +++++++++ {build => scripts}/run_gyp.sh | 0 src/common.gypi | 2 +- 13 files changed, 130 insertions(+), 45 deletions(-) delete mode 100755 build/deps.sh create mode 160000 deps/cmake create mode 100755 scripts/deps/all.sh create mode 100755 scripts/deps/cmake.sh create mode 100755 scripts/deps/llvm.sh create mode 100755 scripts/deps/ninja.sh create mode 100755 scripts/deps/setup.sh rename {build => scripts}/run_gyp.sh (100%) diff --git a/.gitignore b/.gitignore index 7d2f589..9c70c65 100644 --- a/.gitignore +++ b/.gitignore @@ -2,10 +2,8 @@ *.sw* .DS_Store -# Build tools. -build/ninja -build/llvm -build/llvm-build/ +# Build infrastracture. +build/ # Build products. out/ diff --git a/.gitmodules b/.gitmodules index 05b9753..8cee719 100644 --- a/.gitmodules +++ b/.gitmodules @@ -25,3 +25,6 @@ [submodule "deps/googletest"] path = deps/googletest url = https://chromium.googlesource.com/external/googletest +[submodule "deps/cmake"] + path = deps/cmake + url = https://cmake.org/cmake.git diff --git a/.travis.yml b/.travis.yml index f2119fe..427c714 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,13 +1,43 @@ -language: cpp sudo: false -compiler: gcc +# sudo: required +os: linux +# dist: trusty +language: generic +addons: + apt: + sources: + - llvm-toolchain-precise-3.7 + - ubuntu-toolchain-r-test + packages: + - clang-3.7 + - g++-5 + +env: + global: + - CC=clang-3.7 + - CXX=clang++-3.7 + matrix: + # - BUILD=Debug + - BUILD=Release + +install: + # Check baseline memory usage; useful to know when OOMs occur + - free + - vmstat + - ps aux --sort=-rss | head -n 10 + + # Run the scripts in scripts/deps/all.sh one at a time. This buys a little + # time, as Travis limits each step here to 50 minutes. + - ./scripts/deps/setup.sh + - ./scripts/deps/ninja.sh + - ./scripts/deps/cmake.sh + - ./scripts/deps/llvm.sh + before_script: - - ./build/deps.sh - ./build/run_gyp.sh -env: - - BUILD=Debug - - BUILD=Release -script: ./build/ninja -C out/$BUILD && - ./out/$BUILD/bare_tests && - ./out/$BUILD/crypto_tests && - ./out/$BUILD/monitor_tests + +script: + - ./build/ninja -C out/$BUILD + - ./out/$BUILD/bare_tests + - ./out/$BUILD/crypto_tests + - ./out/$BUILD/monitor_tests diff --git a/README.md b/README.md index 3da6d2a..bd95e6c 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ RISC V processor. ### One-Time Setup ```bash -./build/deps.sh +./scripts/deps/all.sh ./build/run_gyp.sh ``` diff --git a/build/deps.sh b/build/deps.sh deleted file mode 100755 index 233efe7..0000000 --- a/build/deps.sh +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/sh -# -# Sets up the build system dependencies. - -set -o errexit # Stop the script on the first error. -set -o nounset # Catch un-initialized variables. - -# Check out all the dependencies. -git submodule update --init - -# Build and symlink Ninja. -cd deps/ninja -./configure.py --bootstrap -cd ../.. -rm -f build/ninja -ln -s "$PWD/deps/ninja/ninja" build/ninja - -# LLVM. -mkdir -p build/llvm-build -LLVM_PREFIX="$PWD/build" -cd build/llvm-build -../../deps/llvm/configure --prefix="$LLVM_PREFIX" \ - --enable-cxx11 \ - --enable-optimized --enable-debug-runtime --enable-debug-symbols \ - --with-clang-srcdir=../../deps/clang -make -j4 -cd ../.. -rm -f build/llvm -ln -s "$PWD/build/llvm-build/Release+Debug+Asserts/" build/llvm diff --git a/deps/cmake b/deps/cmake new file mode 160000 index 0000000..a9e8b12 --- /dev/null +++ b/deps/cmake @@ -0,0 +1 @@ +Subproject commit a9e8b123de79a65074dab1944bf80d94dc101b12 diff --git a/scripts/deps/all.sh b/scripts/deps/all.sh new file mode 100755 index 0000000..796f9bb --- /dev/null +++ b/scripts/deps/all.sh @@ -0,0 +1,15 @@ +#!/bin/sh +# +# Sets up the build system dependencies. + +set -o errexit # Stop the script on the first error. +set -o nounset # Catch un-initialized variables. + +# NOTE: All the scripts below also need to be listed in .travis.yml +# We cannot call all.sh directly in .travis.yml, because that would +# exceed the 50-minute time limit for a single build step. + +./scripts/deps/setup.sh +./scripts/deps/ninja.sh +./scripts/deps/cmake.sh +./scripts/deps/llvm.sh diff --git a/scripts/deps/cmake.sh b/scripts/deps/cmake.sh new file mode 100755 index 0000000..1e50594 --- /dev/null +++ b/scripts/deps/cmake.sh @@ -0,0 +1,15 @@ +#!/bin/sh +# +# Builds and symlinks CMake. + +set -o errexit # Stop the script on the first error. +set -o nounset # Catch un-initialized variables. + +mkdir -p build/cmake-build +cd build/cmake-build +../../deps/cmake/bootstrap +make + +cd ../.. +rm -f build/cmake +ln -s "$PWD/build/cmake-build/bin/cmake" build/ diff --git a/scripts/deps/llvm.sh b/scripts/deps/llvm.sh new file mode 100755 index 0000000..a302db5 --- /dev/null +++ b/scripts/deps/llvm.sh @@ -0,0 +1,23 @@ +#!/bin/sh +# +# Builds and symlinks LLVM. + +set -o errexit # Stop the script on the first error. +set -o nounset # Catch un-initialized variables. + +mkdir -p build/llvm-build +cd build/llvm-build + +# NOTE: CMake's ninja generator barfs if it can't find ninja on the path. +PATH="$PATH:$PWD/../" ../cmake -G "Ninja" \ + -DCMAKE_BUILD_TYPE:STRING=RelWithDebInfo \ + -DLLVM_ENABLE_RTTI:BOOL=ON \ + -DLLVM_INCLUDE_EXAMPLES:BOOL=OFF \ + -DLLVM_INCLUDE_TESTS:BOOL=OFF \ + -DLLVM_EXTERNAL_CLANG_SOURCE_DIR:PATH="$PWD/../../deps/clang" \ + ../../deps/llvm +../ninja + +cd ../.. +rm -f build/llvm +ln -s "$PWD/build/llvm-build/Release+Debug+Asserts/" build/llvm diff --git a/scripts/deps/ninja.sh b/scripts/deps/ninja.sh new file mode 100755 index 0000000..5c5ced0 --- /dev/null +++ b/scripts/deps/ninja.sh @@ -0,0 +1,16 @@ +#!/bin/sh +# +# Builds and symlinks Ninja. + +set -o errexit # Stop the script on the first error. +set -o nounset # Catch un-initialized variables. + +# NOTE: Ninja really wants to be built inside its source tree. +cd deps/ninja + +./configure.py --bootstrap +rm -f null.o # NOTE: This gets created for some weird reason. + +cd ../.. +rm -f build/ninja +ln -s "$PWD/deps/ninja/ninja" build/ninja diff --git a/scripts/deps/setup.sh b/scripts/deps/setup.sh new file mode 100755 index 0000000..288cfe3 --- /dev/null +++ b/scripts/deps/setup.sh @@ -0,0 +1,13 @@ +#!/bin/sh +# +# Project-specific setup. + +set -o errexit # Stop the script on the first error. +set -o nounset # Catch un-initialized variables. + +# Check out all the build dependencies stored in Git submodules. +git submodule update --init + +# Symlink build scripts in the build directory. +mkdir -p build/ +ln -s "$PWD/scripts/run_gyp.sh" build/run_gyp.sh diff --git a/build/run_gyp.sh b/scripts/run_gyp.sh similarity index 100% rename from build/run_gyp.sh rename to scripts/run_gyp.sh diff --git a/src/common.gypi b/src/common.gypi index 313f2da..eb84734 100644 --- a/src/common.gypi +++ b/src/common.gypi @@ -1,6 +1,6 @@ { 'variables': { - 'clang': 'build/llvm-build/Release+Debug+Asserts/bin', + 'clang': 'build/llvm-build/bin', 'library': 'static_library', 'mac_sdk': '10.11', 'mac_deployment_target': '10.7',