feat: add build script for cross-platform executables and update version to 0.3.0

This commit is contained in:
epic-64 2025-12-01 00:00:00 +01:00
parent a67d852437
commit 503f9eef0b
4 changed files with 49 additions and 2 deletions

1
.gitignore vendored
View File

@ -1,3 +1,4 @@
/target
/binbreak_highscores.txt
/.idea
/executables

2
Cargo.lock generated
View File

@ -40,7 +40,7 @@ dependencies = [
[[package]]
name = "binbreak"
version = "0.1.0"
version = "0.3.0"
dependencies = [
"color-eyre",
"crossterm 0.29.0",

View File

@ -1,6 +1,6 @@
[package]
name = "binbreak"
version = "0.1.0"
version = "0.3.0"
description = "A terminal based binary number guessing game"
authors = ["William Raendchen <william@holonaut.io>"]
license = "MIT"

46
build.sh Executable file
View File

@ -0,0 +1,46 @@
#!/bin/bash
# Build script for binbreak game
# Builds for Linux and Windows, copies executables to executables/ directory
set -e # Exit on error
echo "🔨 Building binbreak for multiple platforms..."
echo ""
# Create executables directory if it doesn't exist
EXEC_DIR="executables"
mkdir -p "$EXEC_DIR"
# Get version from Cargo.toml
VERSION=$(grep '^version' Cargo.toml | head -n1 | cut -d'"' -f2)
# Build for Linux (native)
echo "📦 Building for Linux (x86_64)..."
cargo build --release
LINUX_BIN="binbreak-v${VERSION}-linux-x86_64"
cp "target/release/binbreak" "$EXEC_DIR/$LINUX_BIN"
echo "✅ Linux build complete: $EXEC_DIR/$LINUX_BIN"
echo ""
# Build for Windows
echo "📦 Building for Windows (x86_64)..."
if ! rustup target list | grep -q "x86_64-pc-windows-gnu (installed)"; then
echo "⚠️ Installing Windows target (x86_64-pc-windows-gnu)..."
rustup target add x86_64-pc-windows-gnu
fi
cargo build --release --target x86_64-pc-windows-gnu
WINDOWS_BIN="binbreak-v${VERSION}-windows-x86_64.exe"
cp "target/x86_64-pc-windows-gnu/release/binbreak.exe" "$EXEC_DIR/$WINDOWS_BIN"
echo "✅ Windows build complete: $EXEC_DIR/$WINDOWS_BIN"
echo ""
# Print summary
echo "🎉 All builds complete!"
echo ""
echo "Executables:"
ls -lh "$EXEC_DIR" | tail -n +2
echo ""
echo "Location: $EXEC_DIR/"