build: Update the build script to make it possible to build for other architectures
This makes it possible to cross-compile cni like so: $ GOARCH=arm ./build $ GOARCH=arm64 ./build $ GOARCH=ppc64le ./build ref #209
This commit is contained in:
parent
488db88fd1
commit
fc58b79b45
5
build
5
build
@ -10,14 +10,13 @@ if [ ! -h gopath/src/${REPO_PATH} ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
export GO15VENDOREXPERIMENT=1
|
export GO15VENDOREXPERIMENT=1
|
||||||
export GOBIN=${PWD}/bin
|
|
||||||
export GOPATH=${PWD}/gopath
|
export GOPATH=${PWD}/gopath
|
||||||
|
|
||||||
echo "Building API"
|
echo "Building API"
|
||||||
go build "$@" ${REPO_PATH}/libcni
|
go build "$@" ${REPO_PATH}/libcni
|
||||||
|
|
||||||
echo "Building reference CLI"
|
echo "Building reference CLI"
|
||||||
go install "$@" ${REPO_PATH}/cnitool
|
go build -o ${PWD}/bin/cnitool "$@" ${REPO_PATH}/cnitool
|
||||||
|
|
||||||
echo "Building plugins"
|
echo "Building plugins"
|
||||||
PLUGINS="plugins/meta/* plugins/main/* plugins/ipam/* plugins/test/*"
|
PLUGINS="plugins/meta/* plugins/main/* plugins/ipam/* plugins/test/*"
|
||||||
@ -25,6 +24,6 @@ for d in $PLUGINS; do
|
|||||||
if [ -d $d ]; then
|
if [ -d $d ]; then
|
||||||
plugin=$(basename $d)
|
plugin=$(basename $d)
|
||||||
echo " " $plugin
|
echo " " $plugin
|
||||||
go install "$@" ${REPO_PATH}/$d
|
go build -o ${PWD}/bin/$plugin "$@" ${REPO_PATH}/$d
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
2
test
2
test
@ -35,7 +35,7 @@ TEST=${split[@]/#/${REPO_PATH}/}
|
|||||||
|
|
||||||
echo -n "Running tests "
|
echo -n "Running tests "
|
||||||
function testrun {
|
function testrun {
|
||||||
sudo -E bash -c "umask 0; PATH=$GOROOT/bin:$GOBIN:$PATH go test -covermode set $@"
|
sudo -E bash -c "umask 0; PATH=$GOROOT/bin:$(pwd)/bin:$PATH go test -covermode set $@"
|
||||||
}
|
}
|
||||||
if [ ! -z "${COVERALLS}" ]; then
|
if [ ! -z "${COVERALLS}" ]; then
|
||||||
echo "with coverage profile generation..."
|
echo "with coverage profile generation..."
|
||||||
|
Loading…
x
Reference in New Issue
Block a user