build/release: link all release binaries statically
authorStefan Junker <mail@stefanjunker.de>
Thu, 28 Apr 2016 20:40:59 +0000 (22:40 +0200)
committerStefan Junker <mail@stefanjunker.de>
Thu, 19 May 2016 13:05:29 +0000 (15:05 +0200)
build
build-static [deleted file]
scripts/release-with-rkt.sh

diff --git a/build b/build
index 2acc8f2..c6d60ff 100755 (executable)
--- a/build
+++ b/build
@@ -1,5 +1,5 @@
 #!/usr/bin/env bash
-set -e
+set -xe
 
 ORG_PATH="github.com/containernetworking"
 REPO_PATH="${ORG_PATH}/cni"
@@ -14,18 +14,17 @@ export GOBIN=${PWD}/bin
 export GOPATH=${PWD}/gopath
 
 echo "Building API"
-go build ${REPO_PATH}/libcni
+go build "$@" ${REPO_PATH}/libcni
 
 echo "Building reference CLI"
-go install ${REPO_PATH}/cnitool
+go install "$@" ${REPO_PATH}/cnitool
 
 echo "Building plugins"
-
 PLUGINS="plugins/meta/* plugins/main/* plugins/ipam/*"
 for d in $PLUGINS; do
        if [ -d $d ]; then
                plugin=$(basename $d)
                echo "  " $plugin
-               go install ${REPO_PATH}/$d
+               go install "$@" ${REPO_PATH}/$d
        fi
 done
diff --git a/build-static b/build-static
deleted file mode 100755 (executable)
index aae17f0..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-#!/usr/bin/env bash
-set -xe
-
-ORG_PATH="github.com/appc"
-REPO_PATH="${ORG_PATH}/cni"
-
-if [ ! -h gopath/src/${REPO_PATH} ]; then
-       mkdir -p gopath/src/${ORG_PATH}
-       ln -s ../../../.. gopath/src/${REPO_PATH} || exit 255
-fi
-
-export GO15VENDOREXPERIMENT=1
-export GOBIN=${PWD}/bin
-export GOPATH=${PWD}/gopath
-export CGO_ENABLED=0
-
-echo "Building API"
-go build ${REPO_PATH}/libcni
-
-echo "Building reference CLI"
-go install --ldflags '-extldflags "-static"' ${REPO_PATH}/cnitool
-
-echo "Building plugins"
-
-PLUGINS="plugins/meta/* plugins/main/* plugins/ipam/*"
-for d in $PLUGINS; do
-       if [ -d $d ]; then
-               plugin=$(basename $d)
-               echo "  " $plugin
-               go install ${REPO_PATH}/$d
-       fi
-done
index 4e88950..c5fac8f 100755 (executable)
@@ -7,6 +7,7 @@ FEDORA_INSTALL="dnf install -y golang tar xz bzip2 gzip sudo iproute wget"
 FEDORA_IMAGE="docker://fedora:23"
 ACBUILD_URL="https://github.com/appc/acbuild/releases/download/v0.2.2/acbuild.tar.gz"
 ACBUILD="acbuild --debug"
+BUILDFLAGS="-a --ldflags '-extldflags \"-static\"'"
 
 TAG=$(git describe --exact-match --abbrev=0) || TAG=$(git describe)
 RELEASE_DIR=release-${TAG}
@@ -25,7 +26,7 @@ sudo -E rkt run \
     ${FEDORA_IMAGE} \
     --exec /bin/bash \
     -- -xe -c "\
-    ${FEDORA_INSTALL}; cd /opt/src; umask 0022; ./build-static; ./test || true; \
+    ${FEDORA_INSTALL}; cd /opt/src; umask 0022; CGO_ENABLED=0 ./build ${BUILDFLAGS}; ./test || true; \
     for format in txz tbz2 tgz; do \
         FILENAME=cni-${TAG}.\$format; \
         FILEPATH=${RELEASE_DIR}/\$FILENAME; \