1
0
mirror of https://github.com/rancher/os.git synced 2025-06-22 13:07:04 +00:00
os/scripts/mk-ros.sh
Ivan Mikushin 3b6d47be32 Use the correct strip binary.
Fixes native builds on ARM
2016-03-15 15:58:03 -07:00

20 lines
524 B
Bash
Executable File

#!/bin/bash
set -ex
ros="$1"
ARCH=${ARCH:?"ARCH not set"}
VERSION=${VERSION:?"VERSION not set"}
cd $(dirname $0)/..
strip_bin=$(which strip)
[ "${ARCH}" == "arm" ] && export GOARM=6
if [ "${TOOLCHAIN}" != "" ]; then
export CC=/usr/bin/${TOOLCHAIN}-gcc
export CGO_ENABLED=1
strip_bin=/usr/bin/${TOOLCHAIN}-strip
fi
GOARCH=${ARCH} go build -tags netgo -installsuffix netgo -ldflags "-X github.com/rancher/os/config.VERSION=${VERSION} -linkmode external -extldflags -static" -o ${ros}
${strip_bin} --strip-all ${ros}