-
Notifications
You must be signed in to change notification settings - Fork 61
/
buildInDocker.sh
58 lines (47 loc) · 1.66 KB
/
buildInDocker.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
48
49
50
51
52
53
54
55
56
57
#!/bin/bash
# © Copyright IBM Corporation 2019
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Script to build the Go libraries and sample programs from within a Docker container
# This script is INSIDE the container and used as the entrypoint.
export PATH="${PATH}:/usr/lib/go-${GOVERSION}/bin:/go/bin"
export CGO_CFLAGS="-I/opt/mqm/inc/"
export CGO_LDFLAGS_ALLOW="-Wl,-rpath.*"
export GOCACHE=/tmp/.gocache
echo "Running as " `id`
# Build the libraries so they can be used by other programs
cd $GOPATH/src
echo "Using compiler:"
go version
# No longer need to explicitly build packages as
# modules manage the download/installation. And the latest
# compilers have the original version of commands as
# errors. So we comment out that phase.
for pkg in $ORG/$REPO/ibmmq $ORG/$REPO/mqmetric
do
lib=`basename $pkg`
: echo "Building package: $lib"
: go install $pkg
done
# Do the sample program builds into the bin directory
cd $GOPATH
srcdir=src/$ORG/$REPO/samples
cd $srcdir
for samp in *.go
do
exe=`basename $samp .go`
echo "Building program: $exe"
go build -o $GOPATH/bin/$exe $samp
done
echo "Building program: mqitest"
go build -o $GOPATH/bin/mqitest mqitest/mqitest.go