File: build

package info (click to toggle)
acbuild 0.4.0+dfsg-3
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 740 kB
  • sloc: sh: 170; makefile: 24
file content (36 lines) | stat: -rwxr-xr-x 1,070 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/usr/bin/env bash
set -e

# Gets the directory that this script is stored in.
# https://stackoverflow.com/questions/59895/can-a-bash-script-tell-what-directory-its-stored-in
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"

ORG_PATH="github.com/appc"
REPO_PATH="${ORG_PATH}/acbuild"
VERSION=$(cd "${DIR}" && git describe --dirty)
GLDFLAGS="-X github.com/appc/acbuild/lib.Version=${VERSION}"

if [ ! -h gopath/src/${REPO_PATH} ]; then
	mkdir -p gopath/src/${ORG_PATH}
	ln -s ../../../.. gopath/src/${REPO_PATH} || exit 255
fi

export GOBIN=${DIR}/bin
export GOPATH=${DIR}/gopath

export GO15VENDOREXPERIMENT=1

eval $(go env)
export GOOS GOARCH

if [ "${GOOS}" = "freebsd" ]; then
    # /usr/bin/cc is clang on freebsd, but we need to tell it to go to
    # make it generate proper flavour of code that doesn't emit
    # warnings.
    export CC=clang
fi

echo "Building acbuild..."
go build -o $GOBIN/acbuild -ldflags "${GLDFLAGS}" ${ACBUILD_BUILD_TAGS} ${REPO_PATH}/acbuild
ln -f $GOBIN/acbuild $GOBIN/acbuild-script
ln -f $GOBIN/acbuild $GOBIN/acbuild-chroot