status-go/build/env.sh

46 lines
954 B
Bash
Raw Normal View History

2016-06-18 18:28:08 +00:00
#!/bin/sh
set -e
if [ ! -f "build/env.sh" ]; then
echo "$0 must be run from the root of the repository."
exit 2
fi
# Create workspace (if necessary) and dump all dependencies to it
ROOT=$PWD
WS1="$ROOT/build/_workspace/deps"
WS2="$ROOT/build/_workspace/project"
# expose all vendored packages
if [ ! -d "$WS1/src" ]; then
mkdir -p "$WS1"
cd "$WS1"
ln -s "$ROOT/vendor" src
cd "$ROOT"
fi
# expose project itself
PROJECTDIR="$WS2/src/github.com/status-im"
if [ ! -L "$PROJECTDIR/status-go" ]; then
mkdir -p "$PROJECTDIR"
cd "$PROJECTDIR"
ln -s "$ROOT" status-go
2016-06-18 18:28:08 +00:00
cd "$root"
fi
# Set up the environment to use the workspace.
GOPATH="$WS1:$WS2"
2016-06-18 18:28:08 +00:00
GOBIN="$PWD/build/bin"
export GOPATH GOBIN
# Run the command inside the workspace.
cd "$PROJECTDIR/status-go"
# Linker options
export CGO_CFLAGS="-I/$JAVA_HOME/include -I/$JAVA_HOME/include/darwin"
2016-06-18 18:28:08 +00:00
# Launch the arguments with the configured environment.
2016-06-22 09:17:51 +00:00
exec "$@"