env.sh 780 B

1234567891011121314151617181920212223242526272829303132
  1. #!/bin/sh
  2. set -e
  3. if [ ! -f "build/env.sh" ]; then
  4. echo "$0 must be run from the root of the repository."
  5. exit 2
  6. fi
  7. # Create fake Go workspace if it doesn't exist yet.
  8. workspace="$PWD/build/_workspace"
  9. root="$PWD"
  10. ethdir="$workspace/src/github.com/ethereum"
  11. if [ ! -L "$ethdir/go-ethereum" ]; then
  12. mkdir -p "$ethdir"
  13. cd "$ethdir"
  14. ln -s ../../../../../. go-ethereum
  15. cd "$root"
  16. fi
  17. # Set up the environment to use the workspace.
  18. # Also add Godeps workspace so we build using canned dependencies.
  19. GOPATH="$ethdir/go-ethereum/Godeps/_workspace:$workspace"
  20. GOBIN="$PWD/build/bin"
  21. export GOPATH GOBIN
  22. # Run the command inside the workspace.
  23. cd "$ethdir/go-ethereum"
  24. PWD="$ethdir/go-ethereum"
  25. # Launch the arguments with the configured environment.
  26. exec "$@"