Skip to content
This repository has been archived by the owner on Feb 26, 2020. It is now read-only.

Commit

Permalink
Added simple build script
Browse files Browse the repository at this point in the history
  • Loading branch information
kayrus committed Jul 18, 2017
1 parent 1a430ee commit 2b5b45c
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
.git/
releases/
dist/
gopath/
*.orig
*.swp
38 changes: 38 additions & 0 deletions scripts/build
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#!/bin/bash
set -e

CDIR=$(cd `dirname "$0"`/.. && pwd)
cd "$CDIR"

ORG_PATH="github.com/ovh"
REPO_PATH="${ORG_PATH}/svfs"

export GOPATH="${CDIR}/gopath"

export PATH="${PATH}:${GOPATH}/bin"

eval $(go env)

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

if [ -z "$1" ]; then
OS_PLATFORM_ARG=(-os="darwin linux windows")
else
OS_PLATFORM_ARG=($1)
fi

if [ -z "$2" ]; then
OS_ARCH_ARG=(-arch="386 amd64 arm ppc64le")
else
OS_ARCH_ARG=($2)
fi

if ! which gox > /dev/null ; then
go get github.com/mitchellh/gox
fi

cd "$GOPATH/src/${REPO_PATH}"
gox "${OS_PLATFORM_ARG[@]}" "${OS_ARCH_ARG[@]}" -output="dist/{{.OS}}/{{.Arch}}/{{.Dir}}" -ldflags="-w" ${REPO_PATH}

0 comments on commit 2b5b45c

Please sign in to comment.