diff options
author | Hans Ulrich Niedermann <hun@n-dimensional.de> | 2016-01-20 14:15:36 +0100 |
---|---|---|
committer | Hans Ulrich Niedermann <hun@n-dimensional.de> | 2016-01-20 14:15:36 +0100 |
commit | b562952dafd616142d95925fd6475ae9e57aa356 (patch) | |
tree | 94455697770d1ce08fc3646f5ae8a211e7b60e28 | |
parent | f9ee4f729053a66b66fe7a8c379dd1896501ad11 (diff) | |
download | libgphoto2-b562952dafd616142d95925fd6475ae9e57aa356.tar.gz |
travis: Install required libs on Linux *and* OSX
Formerly, we ran three identical OSX builds. Now we test
the same set of optional packages on OSX as we test on Linux.
-rw-r--r-- | .travis-before-install | 60 | ||||
-rw-r--r-- | .travis.yml | 3 |
2 files changed, 61 insertions, 2 deletions
diff --git a/.travis-before-install b/.travis-before-install new file mode 100644 index 000000000..62c7fe6a1 --- /dev/null +++ b/.travis-before-install @@ -0,0 +1,60 @@ +#!/bin/sh + +set -e + +# Calling us with ECHO=echo makes this script dry-run with debug +# output for testing this script. + +# Convert package names from Ubuntu packages to OSX brew packages +ubuntu2osx() { + case "$1" in + libusb-dev) echo "libusb-compat" ;; + libusb-1.0-0-dev) echo "libusb" ;; + libgd2-xpm-dev) echo "gd" ;; + *) + echo "Unknown package name: '$1'" >&2 + exit 2 ;; + esac +} + +case "$TRAVIS_OS_NAME" in + linux) + $ECHO sudo apt-get update -qq + accu="autopoint" + for pkg in "$@"; do + accu="$accu $pkg" + done + $ECHO sudo apt-get install -y $accu + ;; + osx) + $ECHO brew update + accu="gettext" + for pkg in "$@"; do + pkg="$(ubuntu2osx "$pkg")" + accu="$accu $pkg" + done + $ECHO brew install $accu + ;; + *) + echo "Unknown Travis CI build OS: $TRAVIS_OS_NAME" >&2 + exit 1 +esac + +exit 0 + +# Test this script. +# +# Usage: Type ( into a shell, paste test code, type ) and press Enter. +true <<EOF +export ECHO=echo +for SH in "bash" "busybox sh"; do + for os in linux osx; do + for EXTRALIBS in "" "libusb-dev" "libusb-1.0-0-dev libgd2-xpm-dev"; do + echo "### SHELL: $SH OS: $os EXTRALIBS: '$EXTRALIBS' ###" + env TRAVIS_OS_NAME=$os $SH .travis-before-install $EXTRALIBS + echo "### Status: $?" + echo + done + done +done +EOF diff --git a/.travis.yml b/.travis.yml index ac33bbc2c..0a2af569f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,8 +10,7 @@ env: - EXTRALIBS="libusb-1.0-0-dev libgd2-xpm-dev" before_install: - - sudo apt-get update -qq || brew update - - sudo apt-get install autopoint $EXTRALIBS || brew install gettext + - sh .travis-before-install $EXTRALIBS compiler: - clang |