|
| 1 | +#!/bin/bash |
| 2 | + |
| 3 | +set -e |
| 4 | + |
| 5 | +SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) |
| 6 | +cd ${SCRIPT_DIR} |
| 7 | +. ./toolchain.env |
| 8 | + |
| 9 | +printf "Making release of rclone for ArangoDB with $GO_VERSION...\n\n" |
| 10 | + |
| 11 | +RELEASE_TAG="${GO_VERSION//:/-}-$(git rev-parse --short HEAD)" |
| 12 | +RELEASE_OUTPUT=${SCRIPT_DIR}/${RELEASE_TAG} |
| 13 | +rm -rf ${RELEASE_OUTPUT} && mkdir -p ${RELEASE_OUTPUT} |
| 14 | + |
| 15 | +for ARANGODB in $(echo 3.*) |
| 16 | +do |
| 17 | + cd ${SCRIPT_DIR}/${ARANGODB} |
| 18 | + |
| 19 | + . ./rclone.env |
| 20 | + |
| 21 | + printf "Making release of rclone for ArangoDB $ARANGODB...\n\n" |
| 22 | + |
| 23 | + . ./targets.env |
| 24 | + rm -rf ./rclone && \ |
| 25 | + git clone --single-branch --depth 1 -b ${RCLONE_VERSION} https://github.com/rclone/rclone.git && cd ./rclone |
| 26 | + |
| 27 | + for TARGET in ${TARGETS} |
| 28 | + do |
| 29 | + TARGET_OS="${TARGET%_*}" |
| 30 | + TARGET_ARCH="${TARGET#*_}" |
| 31 | + printf "Building rclone $RCLONE_VERSION for $TARGET_OS-$TARGET_ARCH...\n\n"continue |
| 32 | + docker run --rm -v "$(pwd):/rclone" \ |
| 33 | + -v "${HOME}:/user" \ |
| 34 | + -e "GOPATH=/user/rclone_go/go" \ |
| 35 | + -e "GOCACHE=/user/rclone_go/cache" \ |
| 36 | + -e "RCLONE_OUTPUT=${RELEASE_TAG}_${ARANGODB}_${RCLONE_VERSION}" \ |
| 37 | + -e "TARGET_OS=$TARGET_OS" \ |
| 38 | + -e "TARGET_ARCH=$TARGET_ARCH" \ |
| 39 | + -u "${UID}:${GID}" \ |
| 40 | + -w /rclone ${GO_VERSION} \ |
| 41 | + bash +x -c 'cd /rclone; go mod vendor; go get -u github.com/cloudflare/circl; go get -u github.com/Azure/azure-sdk-for-go/sdk/azidentity; go get -u golang.org/x/crypto; go get google.golang.org/api; go mod tidy; go mod vendor; function build { GOOS=$1 GOARCH=$2 CGO_ENABLED=0 go build -trimpath -ldflags="-s -w -X github.com/rclone/rclone/fs.VersionSuffix= " -tags cmount -o /rclone/${RCLONE_OUTPUT}_rclone-arangodb-$(echo $1 | sed "s/darwin/macos/g")-$2$([[ $1 == "windows" ]] && echo ".exe"); }; go get -u golang.org/x/sys; build $TARGET_OS $TARGET_ARCH' && \ |
| 42 | + mv ./*rclone-arangodb-*-* "${RELEASE_OUTPUT}" && rm -rf ./*rclone-arangodb-*-* |
| 43 | + printf "\n\nDone building rclone $RCLONE_VERSION for $TARGET_OS-$TARGET_ARCH!\n\n" |
| 44 | + done |
| 45 | + printf "\n\nDone making release of rclone for ArangoDB $ARANGODB!\n\n" |
| 46 | + rm -rf ${SCRIPT_DIR}/${ARANGODB}/rclone |
| 47 | +done |
| 48 | + |
| 49 | +printf "\n\nDone making release of rclone for ArangoDB with $GO_VERSION!\n\n" |
0 commit comments