This repository has been archived by the owner on Dec 13, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 42
/
build
executable file
·54 lines (44 loc) · 1.68 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
#!/bin/bash
set -e # exit on an error
# set -x
function INFO(){
echo -e "\e[104m\e[97m[INFO]\e[49m\e[39m $@"
}
########## Set up ##########
cd $(dirname $0)
[ -z $GOPATH ] && (echo "GOPATH is not set"; exit 1)
export GOBIN=$GOPATH/bin
export PATH=$GOBIN:$PATH
########## ProtocolBuffers ##########
INFO "Installing protoc to $GOBIN"
go get github.com/golang/protobuf/proto
go get github.com/golang/protobuf/protoc-gen-go
INFO "Generating PB files (FIXME: skipped...)"
# protoc --go_out=nmz/util/pb -Imisc/inspector misc/inspector/inspector_message.proto
########## Go ##########
INFO "Building nmz"
go get -t github.com/osrg/namazu/nmz
go build -o bin/nmz github.com/osrg/namazu/nmz
INFO "Building nmz.static"
go build --ldflags '-extldflags "-static"' -tags static -o bin/nmz.static github.com/osrg/namazu/nmz
file bin/nmz.static | grep "statically linked" > /dev/null
EXAMPLES="example/template/mypolicy.go example/yarn/4301-reproduce/mypolicy.go"
for f in $EXAMPLES; do
INFO "Building ${f}"
(
cd $(dirname $f)
go build -o $(basename -s .go $f) $(basename $f)
)
done
########## Python ##########
#INFO "Checking whether pynmz deps are installed"
#INFO "Running \`autopep8 -r --diff\` for pynmz"
#autopep8 -r --diff misc/pynmz
#INFO "Testing pynmz"
########## Java ##########
INFO "Building Java Inspector (bin/nmz-inspector.jar)"
( cd misc/inspector/java/base; mvn package > /dev/null ) && cp -f misc/inspector/java/base/target/nmz-inspector.jar bin
INFO "Building Java Analyzer (bin/nmz-analyzer.jar)"
( cd misc/analyzer/java/base; mvn package > /dev/null ) && cp -f misc/analyzer/java/base/target/nmz-analyzer.jar bin
########## C ##########
#INFO "Building C Inspector" #FIXME: still broken?