From 2da74dd34d468c278481bf8f953d5672f088d798 Mon Sep 17 00:00:00 2001 From: Jarrad Hope Date: Sat, 18 Jun 2016 20:28:08 +0200 Subject: [PATCH] env work --- .gitignore | 35 +++++++++++++++++++++++++++++++++++ Makefile | 11 ++++++----- build/env.sh | 32 ++++++++++++++++++++++++++++++++ 3 files changed, 73 insertions(+), 5 deletions(-) create mode 100644 .gitignore create mode 100755 build/env.sh diff --git a/.gitignore b/.gitignore new file mode 100644 index 000000000..d4d4c9e7b --- /dev/null +++ b/.gitignore @@ -0,0 +1,35 @@ +# See http://help.github.com/ignore-files/ for more about ignoring files. +# +# If you find yourself ignoring temporary files generated by your text editor +# or operating system, you probably want to add a global ignore instead: +# git config --global core.excludesfile ~/.gitignore_global + +/tmp +*/**/*un~ +*/**/*.test +*un~ +.DS_Store +*/**/.DS_Store +.ethtest +*/**/*tx_database* +*/**/*dapps* +Godeps/_workspace/pkg +Godeps/_workspace/bin + +#* +.#* +*# +*~ +.project +.settings + +# used by the Makefile +/build/_workspace/ +/build/bin/ + +# travis +profile.tmp +profile.cov + +# vagrant +.vagrant diff --git a/Makefile b/Makefile index fd821a091..96d5ea9a7 100644 --- a/Makefile +++ b/Makefile @@ -1,13 +1,14 @@ +GOBIN = build/bin GO ?= latest statusgo: - go install - @echo "Done installing status go." - @echo "Run \"statusgo\" to view available commands" + build/env.sh go build -i -o $(GOBIN)/statusgo ./ + @echo "status go compilation done." + @echo "Run \"build/bin/statusgo\" to view available commands" statusgo-android: xgo - xgo --go=$(GO) --targets=android-16/aar ./ + build/env.sh $(GOBIN)/xgo --go=$(GO) --dest=$(GOBIN) --targets=android-16/aar ./ @echo "Android cross compilation done:" xgo: - go get github.com/karalabe/xgo + build/env.sh go get github.com/karalabe/xgo diff --git a/build/env.sh b/build/env.sh new file mode 100755 index 000000000..a9a0fbc88 --- /dev/null +++ b/build/env.sh @@ -0,0 +1,32 @@ +#!/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 fake Go workspace if it doesn't exist yet. +workspace="$PWD/build/_workspace" +root="$PWD" +ethdir="$workspace/src/github.com/ethereum" +if [ ! -L "$ethdir/go-ethereum" ]; then + mkdir -p "$ethdir" + cd "$ethdir" + ln -s ../../../../../. go-ethereum + cd "$root" +fi + +# Set up the environment to use the workspace. +# Also add Godeps workspace so we build using canned dependencies. +GOPATH="$ethdir/go-ethereum/Godeps/_workspace:$workspace" +GOBIN="$PWD/build/bin" +export GOPATH GOBIN + +# Run the command inside the workspace. +cd "$ethdir/go-ethereum" +PWD="$ethdir/go-ethereum" + +# Launch the arguments with the configured environment. +exec "$@" \ No newline at end of file