]> git.wh0rd.org Git - elf2flt.git/commitdiff
enable travis builds w/github
authorMike Frysinger <vapier@gentoo.org>
Fri, 18 Dec 2015 02:55:28 +0000 (21:55 -0500)
committerMike Frysinger <vapier@gentoo.org>
Thu, 24 Dec 2015 06:41:27 +0000 (01:41 -0500)
.travis.yml [new file with mode: 0644]
travis/arches.sh [new file with mode: 0644]
travis/lib.sh [new file with mode: 0644]
travis/main.sh [new file with mode: 0755]

diff --git a/.travis.yml b/.travis.yml
new file mode 100644 (file)
index 0000000..5247724
--- /dev/null
@@ -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 (file)
index 0000000..e338a27
--- /dev/null
@@ -0,0 +1,22 @@
+#!/bin/bash
+# List of all supported arches.
+# Written by Mike Frysinger <vapier@gentoo.org>
+# 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 (file)
index 0000000..9e6f0e7
--- /dev/null
@@ -0,0 +1,40 @@
+#!/bin/bash
+# Common funcs for working w/Travis.
+# Written by Mike Frysinger <vapier@gentoo.org>
+# 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 (executable)
index 0000000..a37feb4
--- /dev/null
@@ -0,0 +1,37 @@
+#!/bin/bash -e
+# Main Travis test script.
+# Written by Mike Frysinger <vapier@gentoo.org>
+# 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 "$@"