summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/build_final.sh71
1 files changed, 71 insertions, 0 deletions
diff --git a/scripts/build_final.sh b/scripts/build_final.sh
new file mode 100755
index 0000000..ae85030
--- /dev/null
+++ b/scripts/build_final.sh
@@ -0,0 +1,71 @@
+#!/bin/bash
+# This file is part of the 64k demo project.
+# Builds the final production binary with all stripping enabled.
+# Usage: ./scripts/build_final.sh
+
+set -e # Exit on error
+
+SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
+PROJECT_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
+BUILD_DIR="$PROJECT_ROOT/build_final"
+
+echo "========================================"
+echo " Building FINAL Production Binary"
+echo "========================================"
+echo ""
+echo "This build uses:"
+echo " - DEMO_FINAL_STRIP=ON (removes ALL error checking)"
+echo " - DEMO_STRIP_ALL=ON (removes debug features)"
+echo " - DEMO_SIZE_OPT=ON (maximum size optimization)"
+echo ""
+
+# Clean previous final build
+if [ -d "$BUILD_DIR" ]; then
+ echo "Cleaning previous final build..."
+ rm -rf "$BUILD_DIR"
+fi
+
+# Create fresh build directory
+mkdir -p "$BUILD_DIR"
+cd "$BUILD_DIR"
+
+# Configure with FINAL_STRIP
+echo "Configuring with FINAL_STRIP..."
+cmake "$PROJECT_ROOT" \
+ -DDEMO_FINAL_STRIP=ON \
+ -DDEMO_SIZE_OPT=ON \
+ -DCMAKE_BUILD_TYPE=Release
+
+# Build demo64k
+echo ""
+echo "Building demo64k..."
+cmake --build . --target demo64k -j8
+
+# Show result
+echo ""
+echo "========================================"
+echo " Final Build Complete!"
+echo "========================================"
+echo ""
+echo "Binary location:"
+ls -lh "$BUILD_DIR/demo64k"
+echo ""
+
+# Optional: Compare with stripped build (if exists)
+STRIP_BUILD="$PROJECT_ROOT/build_strip"
+if [ -f "$STRIP_BUILD/demo64k" ]; then
+ FINAL_SIZE=$(stat -f%z "$BUILD_DIR/demo64k" 2>/dev/null || stat -c%s "$BUILD_DIR/demo64k")
+ STRIP_SIZE=$(stat -f%z "$STRIP_BUILD/demo64k" 2>/dev/null || stat -c%s "$STRIP_BUILD/demo64k")
+ SAVED=$((STRIP_SIZE - FINAL_SIZE))
+
+ echo "Size comparison:"
+ echo " STRIP_ALL build: $STRIP_SIZE bytes"
+ echo " FINAL_STRIP build: $FINAL_SIZE bytes"
+ echo " Saved: $SAVED bytes"
+ echo ""
+fi
+
+echo "To run: $BUILD_DIR/demo64k"
+echo ""
+echo "⚠️ WARNING: This build has NO error checking!"
+echo " Use only for final release, not for development/testing."