diff --git a/.travis.yml b/.travis.yml index b0f2279fbb..25ab961ec4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,11 +1,8 @@ language: c -compiler: - - clang - - gcc -before_install: - - ./scripts/clint.sh - - sudo ./scripts/travis-setup.sh +env: + - TRAVIS_BUILD_TYPE=clang/asan + - TRAVIS_BUILD_TYPE=gcc/ia32 + - TRAVIS_BUILD_TYPE=gcc/unittest + - TRAVIS_BUILD_TYPE=clint script: - ./scripts/travis.sh -after_success: - - coveralls --encoding iso-8859-1 diff --git a/CMakeLists.txt b/CMakeLists.txt index 4e88157c7b..cd7e6936e4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,11 @@ cmake_minimum_required (VERSION 2.8.7) project (NEOVIM) +set(CMAKE_SYSTEM_PROCESSOR i386) +set(CMAKE_SYSTEM_LIBRARY_PATH /lib32 /usr/lib32 /usr/local/lib32) +set(FIND_LIBRARY_USE_LIB64_PATHS OFF) +set(CMAKE_IGNORE_PATH /lib /usr/lib /usr/local/lib) + # Point CMake at any custom modules we may ship set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake") diff --git a/cmake/i386-linux-gnu.toolchain.cmake b/cmake/i386-linux-gnu.toolchain.cmake new file mode 100644 index 0000000000..5b3e02d18d --- /dev/null +++ b/cmake/i386-linux-gnu.toolchain.cmake @@ -0,0 +1,5 @@ +set(CMAKE_SYSTEM_PROCESSOR i386) +set(CMAKE_SYSTEM_NAME Linux) +set(CMAKE_SYSTEM_VERSION gnu) +set(CMAKE_C_COMPILER gcc) +set(CMAKE_C_COMPILER_ARG1 "-m32") diff --git a/scripts/travis-setup.sh b/scripts/travis-setup.sh deleted file mode 100755 index 1520777841..0000000000 --- a/scripts/travis-setup.sh +++ /dev/null @@ -1,50 +0,0 @@ -#!/bin/sh -e - -# Despite the logs, CC isn't being exported at before_install time in Travis. -# So the following check cannot be used to avoid the download. -# [ "$CC" != "clang" ] && exit - -echo "Downloading clang 3.4..." -mkdir /usr/local/clang-3.4 -wget -q -O - http://llvm.org/releases/3.4/clang+llvm-3.4-x86_64-unknown-ubuntu12.04.tar.xz | - unxz -c | tar xf - --strip-components=1 -C /usr/local/clang-3.4 - - -# The section below is still around, in case we want to try the llvm.org/apt/ -# repository again. - -# Set to true to enable using the clang stable builds hosted at -# http://llvm.org/apt/. -# -# Note: there have been issues with this repository. Several days in a row -# there have been problems running from broken a source repository (causing us -# to remove them from the .list file), to the toolchain being packaged -# incorrectly (most likely due to a change in version number--3.4.0 -> 3.4.1). -# Use with care. -# USE_CLANG_34=true - -# if [ -n "$USE_CLANG_34" ]; then -# add-apt-repository -y ppa:ubuntu-toolchain-r/ppa -# wget -O - http://llvm.org/apt/llvm-snapshot.gpg.key | apt-key add - - -# cat > /etc/apt/sources.list.d/clang.list << "EOF" -# # deb http://llvm.org/apt/precise/ llvm-toolchain-precise main -# # deb-src http://llvm.org/apt/precise/ llvm-toolchain-precise main -# # 3.4 -# deb http://llvm.org/apt/precise/ llvm-toolchain-precise-3.4 main -# # deb-src http://llvm.org/apt/precise/ llvm-toolchain-precise-3.4 main -# # Common -# deb http://ppa.launchpad.net/ubuntu-toolchain-r/test/ubuntu precise main -# EOF -# fi - -# apt-get -qq update - -# [ -n "$USE_CLANG_34" ] && -# apt-get -qq -y --no-install-recommends install clang-3.4 lldb-3.4 - -pip install cpp-coveralls --use-mirrors - -# install prebuilt dependencies -cd /opt -sudo git clone --depth=1 git://github.com/tarruda/neovim-deps diff --git a/scripts/travis.sh b/scripts/travis.sh index ec8ae435af..849d458b5a 100755 --- a/scripts/travis.sh +++ b/scripts/travis.sh @@ -17,11 +17,20 @@ check_and_report() { ) } -# setup environment for using the /opt/neovim-deps prefix -export PATH="/opt/neovim-deps/bin:$PATH" -export PKG_CONFIG_PATH="/opt/neovim-deps/lib/pkgconfig" -export DEPS_CMAKE_FLAGS="-DUSE_BUNDLED_LIBUV=OFF -DUSE_BUNDLED_LUAJIT=OFF -DUSE_BUNDLED_MSGPACK=OFF -DUSE_BUNDLED_LUAROCKS=OFF" -eval $(/opt/neovim-deps/bin/luarocks path) +set_environment() { + local prefix="$1" + eval $($prefix/bin/luarocks path) + export PATH="$prefix/bin:$PATH" + export PKG_CONFIG_PATH="$prefix/lib/pkgconfig" + export DEPS_CMAKE_FLAGS="-DUSE_BUNDLED_LIBUV=OFF -DUSE_BUNDLED_LUAJIT=OFF -DUSE_BUNDLED_MSGPACK=OFF -DUSE_BUNDLED_LUAROCKS=OFF" +} + +# install prebuilt dependencies +if [ ! -d /opt/neovim-deps ]; then + cd /opt + sudo git clone --depth=1 git://github.com/tarruda/neovim-deps + cd - +fi # Travis reports back that it has 32-cores via /proc/cpuinfo, but it's not # what we really have available. According to their documentation, it only has @@ -31,7 +40,19 @@ eval $(/opt/neovim-deps/bin/luarocks path) # for more information. MAKE_CMD="make -j2" -if [ "$CC" = "clang" ]; then +if [ "$TRAVIS_BUILD_TYPE" = "clang/asan" ]; then + if [ ! -d /usr/local/clang-3.4 ]; then + echo "Downloading clang 3.4..." + sudo sh <<- "EOF" + mkdir /usr/local/clang-3.4 + wget -q -O - http://llvm.org/releases/3.4/clang+llvm-3.4-x86_64-unknown-ubuntu12.04.tar.xz | + unxz -c | tar xf - --strip-components=1 -C /usr/local/clang-3.4 + EOF + fi + sudo pip install cpp-coveralls --use-mirrors + + export CC=clang + set_environment /opt/neovim-deps if test -f /usr/local/clang-3.4/bin/clang; then USE_CLANG_34=true export CC=/usr/local/clang-3.4/bin/clang @@ -56,7 +77,7 @@ if [ "$CC" = "clang" ]; then export ASAN_OPTIONS="detect_leaks=1:" else symbolizer=/usr/local/clang-3.3/bin/llvm-symbolizer - fi + fi export SANITIZE=1 export ASAN_SYMBOLIZER_PATH=$symbolizer @@ -74,10 +95,23 @@ if [ "$CC" = "clang" ]; then exit 1 fi check_and_report + coveralls --encoding iso-8859-1 $MAKE_CMD install -else +elif [ "$TRAVIS_BUILD_TYPE" = "gcc/unittest" ]; then + sudo pip install cpp-coveralls --use-mirrors + export CC=gcc + set_environment /opt/neovim-deps export SKIP_EXEC=1 - $MAKE_CMD CMAKE_EXTRA_FLAGS="-DBUSTED_OUTPUT_TYPE=TAP -DUSE_GCOV=ON" - $MAKE_CMD cmake CMAKE_EXTRA_FLAGS="-DUSE_GCOV=ON" - $MAKE_CMD unittest + $MAKE_CMD CMAKE_EXTRA_FLAGS="-DBUSTED_OUTPUT_TYPE=TAP -DUSE_GCOV=ON" unittest + coveralls --encoding iso-8859-1 +elif [ "$TRAVIS_BUILD_TYPE" = "gcc/ia32" ]; then + set_environment /opt/neovim-deps/32 + sudo apt-get update + sudo apt-get install gcc-multilib g++-multilib libncurses5:i386 + sudo ln -s /lib/i386-linux-gnu/libtinfo.so.5 /lib/i386-linux-gnu/libtinfo.so + sudo ln -s /lib/i386-linux-gnu/libncurses.so.5.9 /lib/i386-linux-gnu/libcurses.so + $MAKE_CMD CMAKE_EXTRA_FLAGS="-DBUSTED_OUTPUT_TYPE=TAP -DCMAKE_TOOLCHAIN_FILE=cmake/i386-linux-gnu.toolchain.cmake" unittest + $MAKE_CMD test +elif [ "$TRAVIS_BUILD_TYPE" = "clint" ]; then + ./scripts/clint.sh fi