From: Mike Frysinger Date: Fri, 18 Dec 2015 02:55:28 +0000 (-0500) Subject: enable travis builds w/github X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=892e098c1268da3d063c9aee888ebbc638739b4b;p=elf2flt.git enable travis builds w/github --- diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..5247724 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,17 @@ +# Travis build integration. +# https://docs.travis-ci.com/ + +language: c +compiler: +# TODO: Enable clang support. +# - clang + - gcc + +sudo: false + +os: + - linux +# TODO: Enable OS X support. +# - osx + +script: ./travis/main.sh diff --git a/travis/arches.sh b/travis/arches.sh new file mode 100644 index 0000000..e338a27 --- /dev/null +++ b/travis/arches.sh @@ -0,0 +1,22 @@ +#!/bin/bash +# List of all supported arches. +# Written by Mike Frysinger +# Distributed under the terms of the GNU General Public License v2 + +# The e1/nios targets are dead and no longer configure. +ARCHES=( + arm + bfin +# e1 + h8300 + m68k + microblaze +# nios + nios2 + sh + sparc + v850 +) + +# Expanded list of targets that we can use with configure. +TARGETS=${ARCHES[@]/%/-elf} diff --git a/travis/lib.sh b/travis/lib.sh new file mode 100644 index 0000000..9e6f0e7 --- /dev/null +++ b/travis/lib.sh @@ -0,0 +1,40 @@ +#!/bin/bash +# Common funcs for working w/Travis. +# Written by Mike Frysinger +# Distributed under the terms of the GNU General Public License v2 + +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..a37feb4 --- /dev/null +++ b/travis/main.sh @@ -0,0 +1,37 @@ +#!/bin/bash -e +# Main Travis test script. +# Written by Mike Frysinger +# Distributed under the terms of the GNU General Public License v2 + +. "${0%/*}"/lib.sh +. "${0%/*}"/arches.sh + +BINUTILS_VER="2.25.1" + +build_one() { + local arch=$1 + local S=${PWD} + + travis_fold start ${arch} + v mkdir -p build/${arch} + pushd build/${arch} >/dev/null + v "${S}"/configure \ + --enable-werror \ + --with-binutils-build-dir="${S}"/../prebuilts-binutils-libs/output/${BINUTILS_VER} \ + --target=${arch}-elf + m + m check + popd >/dev/null + travis_fold end ${arch} +} + +main() { + v --fold="git_clone_binutils" \ + git clone --depth=1 https://github.com/uclinux-dev/prebuilts-binutils-libs ../prebuilts-binutils-libs + + local a + for a in "${ARCHES[@]}" ; do + build_one "${a}" + done +} +main "$@"