summaryrefslogtreecommitdiff
path: root/.travis-translate-pkgs
blob: b31337c1f104afd353488e8fdd0b18179c4cae31 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/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