diff options
Diffstat (limited to 'ci/utils.sh')
-rw-r--r-- | ci/utils.sh | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/ci/utils.sh b/ci/utils.sh new file mode 100644 index 00000000..32c7de37 --- /dev/null +++ b/ci/utils.sh @@ -0,0 +1,56 @@ +mktempd() { + echo $(mktemp -d 2>/dev/null || mktemp -d -t tmp) +} + +host() { + case "$TRAVIS_OS_NAME" in + linux) + echo x86_64-unknown-linux-gnu + ;; + osx) + echo x86_64-apple-darwin + ;; + esac +} + +gcc_prefix() { + case "$TARGET" in + aarch64-unknown-linux-gnu) + echo aarch64-linux-gnu- + ;; + arm*-gnueabihf) + echo arm-linux-gnueabihf- + ;; + *) + return + ;; + esac +} + +dobin() { + [ -z $MAKE_DEB ] && die 'dobin: $MAKE_DEB not set' + [ $# -lt 1 ] && die "dobin: at least one argument needed" + + local f prefix=$(gcc_prefix) + for f in "$@"; do + install -m0755 $f $dtd/debian/usr/bin/ + ${prefix}strip -s $dtd/debian/usr/bin/$(basename $f) + done +} + +architecture() { + case $1 in + x86_64-unknown-linux-gnu|x86_64-unknown-linux-musl) + echo amd64 + ;; + i686-unknown-linux-gnu|i686-unknown-linux-musl) + echo i386 + ;; + arm*-unknown-linux-gnueabihf) + echo armhf + ;; + *) + die "architecture: unexpected target $TARGET" + ;; + esac +} |