Skip to content
This repository was archived by the owner on Jun 14, 2018. It is now read-only.

Commit 651f85b

Browse files
committedSep 16, 2016
Fix old build process for newer Go
1 parent a1d691e commit 651f85b

File tree

1 file changed

+8
-23
lines changed

1 file changed

+8
-23
lines changed
 

‎build.sh

+8-23
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
#!/bin/bash
2+
set -euo pipefail
23

34
pkg=github.com/calmh/mole
45
buildstamp=$(date +%s)
56
buildver=$(git describe --always --dirty)
67
builduser="$(whoami)@$(hostname)"
7-
ldflags="-w -X main.buildStamp '$buildstamp' -X main.buildVersion '$buildver' -X main.buildUser '$builduser'"
8+
ldflags="-w -X main.buildStamp=$buildstamp -X main.buildVersion=$buildver -X main.buildUser=$builduser"
89

910
export GOBIN=$(pwd)/bin
1011

@@ -16,7 +17,8 @@ buildClient() {
1617
export GOOS=${arch%-*}
1718
export GOARCH=${arch#*-}
1819
rm -rf bin
19-
godep go install -ldflags "$ldflags" "$pkg/cmd/mole"
20+
mkdir bin
21+
godep go build -ldflags "$ldflags" -o bin/mole "$pkg/cmd/mole"
2022
tar zcf "mole-$arch.tar.gz" bin
2123

2224
[ -f bin/mole ] && mv bin/mole "auto/mole-$arch"
@@ -30,40 +32,23 @@ buildClient() {
3032
export GOOS=${arch%-*}
3133
export GOARCH=${arch#*-}
3234
rm -rf bin
33-
godep go install -ldflags "$ldflags" "$pkg/cmd/mole"
35+
mkdir bin
36+
godep go build -ldflags "$ldflags" -o bin/mole.exe "$pkg/cmd/mole"
3437
zip -qr "mole-$arch.zip" bin
3538
done
3639
rm -rf bin
3740
}
3841

39-
buildServer() {
40-
rm -rf srv bin
41-
mkdir srv
42-
source /usr/local/golang-crosscompile/crosscompile.bash
43-
for arch in linux-386 linux-amd64 darwin-amd64 ; do
44-
echo "$arch"
45-
"go-$arch" install -ldflags "$ldflags" "$pkg/cmd/molesrv"
46-
[ -f bin/molesrv ] && mv bin/molesrv "srv/molesrv-$arch"
47-
[ -f bin/*/molesrv ] && mv bin/*/molesrv "srv/molesrv-$arch"
48-
done
49-
rm -rf bin
50-
tar zcf molesrv-all.tar.gz srv
51-
}
52-
53-
case $1 in
42+
case ${1:-default} in
5443
all)
5544
rm -fr "$GOPATH"/pkg
5645
godep go test ./...
5746
echo
5847
echo Client
5948
echo
6049
buildClient
61-
echo
62-
echo Server
63-
echo
64-
buildServer
6550
;;
66-
*)
51+
default)
6752
godep go install -ldflags "$ldflags" "$pkg/cmd/..."
6853
;;
6954
esac

0 commit comments

Comments
 (0)
This repository has been archived.