From aae972390aa9db415f9813b5b6f525d1b447e795 Mon Sep 17 00:00:00 2001 From: Eric Kidd Date: Mon, 12 Sep 2016 07:22:46 -0400 Subject: [PATCH] Add an example script for use with Travis CI --- examples/build-release | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100755 examples/build-release diff --git a/examples/build-release b/examples/build-release new file mode 100755 index 0000000..6fd860c --- /dev/null +++ b/examples/build-release @@ -0,0 +1,31 @@ +#!/bin/bash +# +# Usage: ./build-release ${TRAVIS_TAG}-${TRAVIS_OS_NAME} +# +# Called by `.travis.yml` to build release binaries. We use +# ekidd/rust-musl-builder to make the Linux binaries so that we can run +# them unchanged on any distro, including tiny distros like Alpine (which +# is heavily used for Docker containers). Other platforms get regular +# binaries, which will generally be dynamically linked against libc. +# +# If you have a platform which supports static linking of libc, and this +# would be generally useful, please feel free to submit patches. + +set -euo pipefail + +rust-musl-builder() { + docker run --rm -it -v "$(pwd)":/home/rust/src ekidd/rust-musl-builder "$@" +} + +case `uname -s` in + Linux) + echo "Building static binaries using ekidd/rust-musl-builder" + rust-musl-builder cargo build --release + zip -j "$1"-"$2".zip target/x86_64-unknown-linux-musl/release/"$1" + ;; + *) + echo "Building standard release binaries" + cargo build --release + zip -j "$1"-"$2".zip target/release/"$1" + ;; +esac