-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild
executable file
·70 lines (52 loc) · 1.5 KB
/
build
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#!/bin/bash
GO=$(which go)
if [ "x${GO}" = "x" ]; then
wget https://storage.googleapis.com/golang/go1.4.2.linux-amd64.tar.gz -O go.tar.gz
tar -zxf go.tar.gz
rm -f go.tar.gz
export PATH=$(pwd)/go/bin:/bin:/usr/bin:/sbin:/usr/sbin
export GOROOT=$(pwd)/go
fi
PROJECT=github.com/sadeemio/shabik
mkdir -p vendor
if ! go list github.com/sadeemio/shabik &> /dev/null; then
rm -rf .gopath
mkdir -p .gopath/src/github.com/sadeemio
ln -sf ../../../.. .gopath/src/${PROJECT}
export GOPATH="${PWD}/.gopath:${PWD}/vendor"
fi
export GOPATH="$GOPATH:${PWD}/vendor"
clone() {
local vcs="$1"
local pkg="$2"
local url="$3"
: ${url:=https://$pkg}
local target="vendor/src/$pkg"
echo -n "$pkg"
if [ -d "$target" ]; then
echo -n 'rm old, '
rm -rf "$target"
fi
echo -n 'clone, '
case "$vcs" in
git)
git clone --quiet --no-checkout "$url" "$target"
( cd "$target" && git checkout --quiet )
;;
hg)
hg clone --quiet --updaterev "$url" "$target"
;;
esac
echo -n 'rm VCS, '
( cd "$target" && rm -rf .{git,hg} )
echo -n 'rm vendor, '
( cd "$target" && rm -rf vendor Godeps/_workspace )
echo done
}
clone git github.com/asaif/dhcp4
clone git github.com/streadway/amqp
clone git github.com/boltdb/bolt
clone git github.com/hashicorp/logutils
#Special rule for golang deps as it's main repo changed but the dpes still use old one
git clone https://github.com/golang/net.git vendor/src/golang.org/x/net
go build -a -x -o bin/shabik ${REPO_PATH}