forked from cockroachdb/cockroach
-
Notifications
You must be signed in to change notification settings - Fork 0
/
bootstrap.sh
executable file
·47 lines (36 loc) · 1.43 KB
/
bootstrap.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
47
#!/bin/bash
# Bootstrap sets up all needed dependencies.
# It's idempotent so if you don't hack often, your best bet is to just run this.
# Assumes you are running from the top of the project.
#
# 1) Update all source code and submodules
# 2) Update go dependencies
# 3) Build a shadow toolchain containing our dependencies in _vendor/build
# TODO(shawn) make rocksdb build less magic
# TODO(shawn) make sure rocksdb still links against jemalloc (and that it makes sense when embedding in go)
# TODO(pmattis): check for pkg-config and curl.
cd -P "$(dirname $0)"
set -e -x
# Update submodules
git submodule update --init
function go_get() {
go get -u -v "$@"
}
# Grab binaries required by git hooks.
go_get github.com/golang/lint/golint
go_get code.google.com/p/go.tools/cmd/goimports
# go vet is special: it installs into $GOROOT (which $USER may not have
# write access to) instead of $GOPATH. It is usually but not always
# installed along with the rest of the go toolchain. Don't try to
# install it if it's already there.
go vet 2>/dev/null || go_get code.google.com/p/go.tools/cmd/vet
# Grab the go dependencies required for building.
./build/godeps.sh
# Create symlinks to all git hooks in your own .git dir.
for f in $(ls -d githooks/*); do
rm .git/hooks/$(basename $f)
ln -s ../../$f .git/hooks/$(basename $f)
done && ls -al .git/hooks | grep githooks
# Build the required libraries.
./build/vendor.sh
echo "Bootstrapped successfully!"