set -ex
TARGET=$1
if [ -z "$SRC" ]; then
SRC=.
fi
BRANCH=$TRAVIS_BRANCH
if [ "$BRANCH" = "" ]; then
BRANCH=$APPVEYOR_REPO_BRANCH
fi
if [ "$BRANCH" = "stable" ]; then
CHANNEL=stable
elif [ "$BRANCH" = "beta" ]; then
CHANNEL=beta
elif [ "$BRANCH" = "master" ]; then
CHANNEL=nightly
elif [ "$BRANCH" = "auto-cargo" ]; then
CHANNEL=nightly
else
CHANNEL=dev
fi
if [ -n "$CI" ] && [ "$BRANCH" != "auto-cargo" ] && [ "$ALLOW_PR" = "" ]; then
echo no build necessary, skipping
exit 0
fi
$SRC/configure \
--prefix=/tmp/obj/install \
--target=$TARGET \
--release-channel=$CHANNEL \
--enable-build-openssl
make cargo-$TARGET
make dist-$TARGET
if [ ! -z "$MAKE_TARGETS" ]; then
for target in "$MAKE_TARGETS"; do
make $target
done
fi