2020-05-11 12:43:12 -07:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
set -o errexit
|
|
|
|
set -o nounset
|
|
|
|
set -o pipefail
|
2020-03-10 12:20:34 -07:00
|
|
|
|
2020-05-26 05:56:52 -07:00
|
|
|
# Download dependencies
|
|
|
|
echo "Downloading dependencies..."
|
|
|
|
go mod download
|
2020-03-10 12:20:34 -07:00
|
|
|
|
2020-05-26 05:56:52 -07:00
|
|
|
# Set GOPATH
|
2020-05-25 11:00:23 -07:00
|
|
|
GOPATH="$(go env GOPATH)"
|
2020-03-10 12:20:34 -07:00
|
|
|
|
2020-05-26 05:56:52 -07:00
|
|
|
GECKO_PATH=$( cd "$( dirname "${BASH_SOURCE[0]}" )"; cd .. && pwd ) # Directory above this script
|
|
|
|
BUILD_DIR=$GECKO_PATH/build # Where binaries go
|
|
|
|
PLUGIN_DIR="$BUILD_DIR/plugins" # Where plugin binaries (namely coreth) go
|
|
|
|
|
2020-06-23 14:36:20 -07:00
|
|
|
CORETH_VER="0.2.5" # Should match coreth version in go.mod
|
2020-05-26 05:56:52 -07:00
|
|
|
CORETH_PATH="$GOPATH/pkg/mod/github.com/ava-labs/coreth@v$CORETH_VER"
|
|
|
|
|
|
|
|
# Build Gecko
|
|
|
|
echo "Building Gecko..."
|
|
|
|
go build -o "$BUILD_DIR/ava" "$GECKO_PATH/main/"*.go
|
|
|
|
|
|
|
|
# Build Coreth, which is run as a subprocess by Gecko
|
|
|
|
echo "Building Coreth..."
|
|
|
|
go build -o "$PLUGIN_DIR/evm" "$CORETH_PATH/plugin/"*.go
|
2020-04-16 08:39:20 -07:00
|
|
|
|
2020-05-26 05:56:52 -07:00
|
|
|
if [[ -f "$BUILD_DIR/ava" && -f "$PLUGIN_DIR/evm" ]]; then
|
2020-04-26 11:28:36 -07:00
|
|
|
echo "Build Successful"
|
|
|
|
else
|
|
|
|
echo "Build failure"
|
2020-05-18 11:57:31 -07:00
|
|
|
fi
|