1
0
mirror of https://github.com/rancher/os.git synced 2025-06-21 20:47:04 +00:00
os/scripts/build
2015-02-14 09:35:46 -07:00

32 lines
599 B
Bash
Executable File

#!/bin/bash -e
if [[ ! -x "$(which go)" && -x /usr/local/go/bin/go ]]; then
PATH=/usr/local/go/bin:${PATH}
fi
cd $(dirname $0)/..
if [ -f ./build/bootstrap.envs ];then
. ./build/bootstrap.envs
fi
if [ -z "$ROS_CUSTOM_GOPATH" ]; then
export GOPATH=$(pwd)/Godeps/_workspace:$(pwd)/gopath
fi
PACKAGE=./gopath/src/$(<.package)
if [ -L ${PACKAGE} ]; then
rm ${PACKAGE}
fi
if [ ! -e ${PACKAGE} ]; then
mkdir -p $(dirname $PACKAGE)
ln -s $(pwd) $PACKAGE
fi
echo export GOPATH=$GOPATH
mkdir -p bin
go build -ldflags "-linkmode external -extldflags -static" -o bin/rancheros