Skip to content

Commit

Permalink
Add build script since my editor hates multiple files in the main pac…
Browse files Browse the repository at this point in the history
…kage
  • Loading branch information
hashworks committed Jan 19, 2016
1 parent e9ae17f commit 6a59acc
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/usr/bin/env bash

if [ "$xREL_TERMINAL_CLIENT_CONSUMER_KEY" == "" ] || [ "$xREL_TERMINAL_CLIENT_CONSUMER_SECRET" == "" ]; then
echo You need to set the following env variables: xREL_TERMINAL_CLIENT_CONSUMER_KEY and xREL_TERMINAL_CLIENT_CONSUMER_SECRET. >&2
echo Get those from http://www.xrel.to/api-apps.html >&2
exit 1
fi

DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"

cd "$DIR"
commit="$(git rev-parse --short HEAD 2>/dev/null)"

if [ "$commit" != "" ]; then
version=dev-"$commit"
fi

rm -Rf ./bin/
mkdir ./bin/

go build -ldflags '-X main.VERSION='"$version"'
-X main.OAUTH_CONSUMER_KEY='"$xREL_TERMINAL_CLIENT_CONSUMER_KEY"'
-X main.OAUTH_CONSUMER_SECRET='"$xREL_TERMINAL_CLIENT_CONSUMER_SECRET" \
-o "./bin/xREL" "$DIR"/src/*.go

0 comments on commit 6a59acc

Please sign in to comment.