-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun
executable file
·48 lines (36 loc) · 922 Bytes
/
run
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
#!/bin/sh
set -e
cd $(dirname $0)
header(){
echo ""
echo "|> $1"
}
header "Get grpc and protoc-gen-go"
go get -u google.golang.org/grpc
go get -u github.com/golang/protobuf/protoc-gen-go
mkdir -p dist
header "Execute protoc"
cd lib
go get -v ./...
protoc -I . lib.proto --go_out=plugins=grpc:.
header "Go build the server"
cd ../server
go build -a -o ../dist/dbhi-grpc-server
header "Go build the client shared library"
cd ../client
go build -o "libgrpc-go.so" -buildmode=c-shared *.go
header "Build the C example client"
cd eg-c
gcc -o "../../dist/dbhi-grpc-eg-c" -I../ "main.c" "../libgrpc-go.so"
header "Move shared library and header to dist"
cd ..
cp libgrpc-go.so ../dist
cp libgrpc-go.h ../dist
header "Build the Go example client"
cd eg-go
cp ../client.go ./
go build -a -o ../../dist/dbhi-grpc-eg-go
rm client.go
header "Go build then client gen"
cd ../gen
go build -a -o ../../dist/dbhi-grpc-gen