forked from vmware/govmomi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.sh
executable file
·46 lines (38 loc) · 1.13 KB
/
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/bin/bash -e
git_version=$(git describe --dirty)
if [[ $git_version == *-dirty ]] ; then
echo 'Working tree is dirty.'
echo 'NOTE: This script is meant for building govc releases via release.sh'
echo 'To build govc from source see: https://github.com/vmware/govmomi/blob/master/govc/README.md#source'
exit 1
fi
CDIR=$(cd `dirname "$0"` && pwd)
cd "$CDIR"
# Workaround when GOPATH is not defined
mkdir -p gopath/src/github.com/vmware
if [ ! -s gopath/src/github.com/vmware/govmomi ]; then
ln -sf ../../../../../ gopath/src/github.com/vmware/govmomi
fi
export GOPATH="$CDIR"/gopath
ldflags="-X github.com/vmware/govmomi/govc/version.gitVersion=${git_version}"
BUILD_OS=${BUILD_OS:-darwin linux windows freebsd}
BUILD_ARCH=${BUILD_ARCH:-386 amd64}
for os in ${BUILD_OS}; do
export GOOS="${os}"
for arch in ${BUILD_ARCH}; do
export GOARCH="${arch}"
out="govc_${os}_${arch}"
if [ "${os}" == "windows" ]; then
out="${out}.exe"
fi
set -x
go build \
-o="${out}" \
-pkgdir="./_pkg" \
-compiler='gc' \
-ldflags="${ldflags}" \
github.com/vmware/govmomi/govc &
set +x
done
done
wait