forked from cloudfoundry/multiapps-cli-plugin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.sh
executable file
·32 lines (28 loc) · 802 Bytes
/
build.sh
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
#!/bin/bash -eux
function build() {
local version=$1
local platform=$2
local arch=$3
GOOS=$platform GOARCH=$arch go build \
-ldflags "-X main.Version=${version}" \
-o mta_plugin_${platform}_${arch}
}
function main() {
if [[ $# -ne 1 ]]; then
echo "usage: ${0} <version>"
exit 1
fi
local version=$1
local platforms="linux darwin windows"
for platform in $platforms; do
echo calling to build for $platform
build $version $platform "amd64"
#Make windows binary executable
if [[ $platform == "windows" ]] ; then
mv mta_plugin_${platform}_amd64 mta_plugin_${platform}_amd64.exe
fi
done
}
script_dir="$(dirname -- "$(realpath -- "${BASH_SOURCE[0]}")")"
cd "${script_dir}"
main "$@"