blob: be724f3bb98683c6dd930a32cd8e8ce6de864f95 [file] [log] [blame]
Don Newtona6f55052020-01-09 10:38:45 -05001#!/bin/bash
2<<COMMENT
3 Copyright 2019 the original author or authors.
4
5 Licensed under the Apache License, Version 2.0 (the "License");
6 you may not use this file except in compliance with the License.
7 You may obtain a copy of the License at
8
9 http://www.apache.org/licenses/LICENSE-2.0
10
11 Unless required by applicable law or agreed to in writing, software
12 distributed under the License is distributed on an "AS IS" BASIS,
13 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 See the License for the specific language governing permissions and
15 limitations under the License.
16COMMENT
17if [ -z output ]
18then
19 rm output
20fi
Don Newtonac0455d2020-01-23 11:52:26 -050021set GO111MODULE=on
22go build -mod=vendor -o /build/ofagent \
23 -ldflags \
24 "-X github.com/opencord/voltha-lib-go/v2/pkg/version.version=$org_label_schema_version \
25 -X github.com/opencord/voltha-lib-go/v2/pkg/version.vcsRef=$org_label_schema_vcs_ref \
26 -X github.com/opencord/voltha-lib-go/v2/pkg/version.vcsDirty=$org_opencord_vcs_dirty \
27 -X github.com/opencord/voltha-lib-go/v2/pkg/version.goVersion=$(go version 2>&1 | sed -E 's/.*go([0-9]+\.[0-9]+\.[0-9]+).*/\1/g') \
28 -X github.com/opencord/voltha-lib-go/v2/pkg/version.os=$(go env GOHOSTOS) \
29 -X github.com/opencord/voltha-lib-go/v2/pkg/version.arch=$(go env GOHOSTARCH) \
30 -X github.com/opencord/voltha-lib-go/v2/pkg/version.buildTime=$org_label_schema_build_date" \
31 ./cmd/ofagent
32
33#go build ./cmd/ofagent -mod=vendor -o build/ofagent-go
Don Newtona6f55052020-01-09 10:38:45 -050034
35if [ "$1" = "debug" ]
36then
37 echo DEBUGGING
38 ./build/ofagent-go -memprofile=debugmem -cpuprofile=debugcpu -debug -ofaddress=localhost openflowPort=6653 -volthaAddress=localhost -volthaPort=50057 2>&1 |tee output
39else
40 echo NOT DEBUGGING
41 ./build/ofagent-go -ofaddress=localhost openflowPort=6653 -volthaAddress=localhost -volthaPort=50057 -memprofile=mem -cpuprofile=cpu 2>&1 |tee output
42fi
43