| #!/bin/sh |
| |
| set -e |
| |
| # Translate 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 "Error: Unknown package name: '$1'" >&2 |
| exit 2 ;; |
| esac |
| } |
| |
| case "$TRAVIS_OS_NAME" in |
| linux) |
| echo "autopoint" "$@" |
| ;; |
| osx) |
| accu="gettext" |
| for pkg in "$@"; do |
| pkg="$(ubuntu2osx "$pkg")" |
| accu="$accu $pkg" |
| done |
| echo "$accu" |
| ;; |
| *) |
| echo "Unknown TRAVIS_OS_NAME value: '$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 |
| for SH in "bash" "busybox sh"; do |
| for os in linux osx no-os; do |
| for EXTRALIBS in "" "libusb-dev" "libusb-1.0-0-dev libgd2-xpm-dev" "nosuchlib"; 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 |