Skip to content

Commit

Permalink
fix: build script
Browse files Browse the repository at this point in the history
  • Loading branch information
BigJk committed Jan 23, 2024
1 parent 6794af0 commit 08d71ca
Showing 1 changed file with 23 additions and 4 deletions.
27 changes: 23 additions & 4 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

GOEXE=$(which go)
PKGXEXE=$(which pkgx)
PKGX_GO_VERSION="1.20"
PKGX_GO_VERSION="1.21.6"

# Function to setup pkgx
function setup_pkgx() {
eval "$(curl -Ssf https://pkgx.sh)"
export GOROOT="$(dirname $(dirname $(pkgx +go@1.20 which go)))"
export GOROOT="$(dirname $(dirname $(pkgx +go@$PKGX_GO_VERSION which go)))"
GOEXE="pkgx go@${PKGX_GO_VERSION}"
}

Expand Down Expand Up @@ -60,18 +60,37 @@ echo "======================================="

# Delete old binaries
rm -rf ./bin

# Create bin folder
mkdir -p ./bin

# Build binaries
echo "1. Building terminal version..."
$GOEXE build -o ./bin/end_of_eden$EXT ./cmd/game/
$GOEXE build -o ./bin/end_of_eden_win$EXT ./cmd/game/
$GOEXE build -o ./bin/end_of_eden_browser$EXT ./cmd/game_browser/

echo "2. Building windowed gl version..."
$GOEXE build -o ./bin/end_of_eden_win$EXT ./cmd/game_win/

echo "3. Building testing util..."
$GOEXE build -o ./bin/tester$EXT ./cmd/internal/tester/

echo "4. Building fuzzy testing util..."
$GOEXE build -o ./bin/fuzzy_tester$EXT ./cmd/internal/fuzzy_tester/

echo "5. Building wasm version..."
GOOS=js GOARCH=wasm $GOEXE build -o ./bin/eoe.wasm ./cmd/game_wasm/
cp "$($GOEXE env GOROOT)/misc/wasm/wasm_exec.js" "./bin/wasm_exec.js"
cp ./cmd/game_wasm/index.html ./bin/index.html

# Disable SSH version for now:
# go build -o ./bin/end_of_eden_ssh$EXT ./cmd/game_ssh/

# Build asset index
echo "6. Building asset index..."
./internal/misc/build_index.sh ./assets

# Copy /assets to /bin
echo "7. Copying assets..."
cp -r ./assets ./bin/assets

# Finished!
Expand Down

0 comments on commit 08d71ca

Please sign in to comment.