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

Added simple build script #141

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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")
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}