Created a script to build statically-linked binaries on Linux

This commit is contained in:
2024-03-09 21:33:49 -05:00
parent f23f307e17
commit 9881567009

26
create_static_linux.sh Executable file
View File

@@ -0,0 +1,26 @@
#!/bin/bash
# This script creates and packages a statically-linked build of the game, for Linux.
# It must be placed in the root of the source code.
set -o errexit # Stop executing when a command fails
BASE_DIR=$(dirname 0)
REL_DIR="$BASE_DIR/release/static/pong"
mkdir -p "$REL_DIR"
# Set the default build target to static
meson configure -Ddefault_library=static "$BASE_DIR/build/"
# Build the application
meson compile -C "$BASE_DIR/build/"
# Package the application:
# 1. Copy the executable to REL_DIR
# 2. Create a tarball
cp "$BASE_DIR/build/pong" "$REL_DIR"
tar -czf "$BASE_DIR/release/pong.tar.gz" "$REL_DIR"
# Reset default build target to shared
meson configure -Ddefault_library=shared "$BASE_DIR/build/"