From fc58b79b45f5b1917fae9f37e50d6de05d53c6f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lucas=20K=C3=A4ldstr=C3=B6m?= Date: Sat, 13 Aug 2016 12:44:28 +0300 Subject: [PATCH] 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 --- build | 5 ++--- test | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/build b/build index f1faf267..d0e2885b 100755 --- a/build +++ b/build @@ -10,14 +10,13 @@ if [ ! -h gopath/src/${REPO_PATH} ]; then fi export GO15VENDOREXPERIMENT=1 -export GOBIN=${PWD}/bin export GOPATH=${PWD}/gopath echo "Building API" go build "$@" ${REPO_PATH}/libcni echo "Building reference CLI" -go install "$@" ${REPO_PATH}/cnitool +go build -o ${PWD}/bin/cnitool "$@" ${REPO_PATH}/cnitool echo "Building plugins" PLUGINS="plugins/meta/* plugins/main/* plugins/ipam/* plugins/test/*" @@ -25,6 +24,6 @@ for d in $PLUGINS; do if [ -d $d ]; then plugin=$(basename $d) echo " " $plugin - go install "$@" ${REPO_PATH}/$d + go build -o ${PWD}/bin/$plugin "$@" ${REPO_PATH}/$d fi done diff --git a/test b/test index 2f1a4b21..afb1c94b 100755 --- a/test +++ b/test @@ -35,7 +35,7 @@ TEST=${split[@]/#/${REPO_PATH}/} echo -n "Running tests " 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 echo "with coverage profile generation..."