diff options
-rw-r--r-- | .travis.yml | 31 | ||||
-rwxr-xr-x | autogen.sh | 5 | ||||
-rw-r--r-- | travis/autotools.tar.xz | bin | 0 -> 9208 bytes | |||
-rw-r--r-- | travis/lib.sh | 38 | ||||
-rwxr-xr-x | travis/main.sh | 48 |
5 files changed, 120 insertions, 2 deletions
diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..4f5f843 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,31 @@ +# Travis build integration. +# https://docs.travis-ci.com/ + +language: c +compiler: + - clang + - gcc + +sudo: false + +os: + - linux +# Travis currently runs on OS X 10.9 which does not include *at funcs. +# Disable until they update or we include autotools support. + - osx + +# Travis currently uses Ubuntu 12.04 (Precise) which is too old: it does +# not include pyelftools. Disable until they update. +env: + - USE_PYTHON=no +# Note: OS X deps are maintained in .travis.sh until Travis supports it here. +addons: + apt: + packages: + - autoconf-archive + - gnulib + - xmlto + - python-pyelftools + - python3-pyelftools + +script: ./travis/main.sh @@ -1,6 +1,6 @@ #!/bin/bash -e -v() { echo "$@"; "$@"; } +. "${0%/*}"/travis/lib.sh m4dir="autotools/m4" @@ -33,12 +33,13 @@ mods=" utimensat vasprintf-posix " -v gnulib-tool \ +v --fold="gnulib-tool" gnulib-tool \ --source-base=autotools/gnulib --m4-base=autotools/m4 \ --import \ ${mods} # not everyone has sys-devel/autoconf-archive installed +v tar xf travis/autotools.tar.xz for macro in $(grep -o '\<AX[A-Z_]*\>' configure.ac | sort -u) ; do if m4=$(grep -rl "\[${macro}\]" /usr/share/aclocal/) ; then v cp $m4 ${m4dir}/ diff --git a/travis/autotools.tar.xz b/travis/autotools.tar.xz Binary files differnew file mode 100644 index 0000000..1c0c854 --- /dev/null +++ b/travis/autotools.tar.xz diff --git a/travis/lib.sh b/travis/lib.sh new file mode 100644 index 0000000..687ed41 --- /dev/null +++ b/travis/lib.sh @@ -0,0 +1,38 @@ +#!/bin/bash +# Common funcs for working w/Travis. + +travis_fold() { + if [[ -n ${TRAVIS_OS_NAME} ]] ; then + printf 'travis_fold:%s:%s\r\n' "$@" | sed 's: :_:g' + fi +} + +if [[ -n ${TRAVIS_OS_NAME} ]] ; then + whitebg=$(tput setab 7) + blackfg=$(tput setaf 0) + normal=$(tput sgr0) +else + whitebg= + blackbg= + normal= +fi +v() { + local fold="" + case $1 in + --fold=*) fold=${1:7}; shift;; + esac + if [[ -n ${fold} ]] ; then + travis_fold start "${fold}" + echo "\$ $*" + "$@" + travis_fold end "${fold}" + else + echo "${whitebg}${blackfg}\$ $*${normal}" + "$@" + fi +} + +ncpus=$(getconf _NPROCESSORS_ONLN) +m() { + v make -j${ncpus} "$@" +} diff --git a/travis/main.sh b/travis/main.sh new file mode 100755 index 0000000..58b4ddf --- /dev/null +++ b/travis/main.sh @@ -0,0 +1,48 @@ +#!/bin/bash -e + +. "${0%/*}"/lib.sh + +main() { + if [[ ${TRAVIS_OS_NAME} == "osx" ]] ; then + # Note: Linux deps are maintained in .travis.yml. + v --fold="brew_update" brew update + v --fold="brew_install" brew install xmlto xz + fi + + # See if we have to bootstrap gnulib. This is the case on OS X, and on + # Linux until they whitelist the package: + # https://github.com/travis-ci/apt-package-whitelist/issues/727 + if ! gnulib-tool --version >&/dev/null ; then + if [[ ! -d ../gnulib ]] ; then + v --fold="git_clone_gnulib" \ + git clone --depth=1 https://github.com/coreutils/gnulib.git ../gnulib + else + pushd ../gnulib + v --fold="git_pull_gnulib" git pull + popd + fi + export PATH="${PATH}:${PWD}/../gnulib" + fi + + if [[ ${TRAVIS_OS_NAME} == "linux" ]] ; then + # Standard optimized build. + m + m check + + # Debug build w/ASAN and such enabled. + m debug + m check + fi + + # Autotools based build. + v ./autogen.sh + if [[ ${TRAVIS_OS_NAME} == "linux" ]] ; then + v --fold="configure" ./configure + m V=1 distcheck + else + # ELF checks don't work on OS X -- no ELFs! + v ./configure + m V=1 + fi +} +main "$@" |