You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
39 lines
1.2 KiB
Bash
39 lines
1.2 KiB
Bash
#!/bin/bash
|
|
|
|
# This script copies required DLLs, and the application itself into a folder called 'release'. It only runs on MinGW.
|
|
|
|
set -o errexit # Stop executing when a command fails
|
|
BASE_DIR=$(dirname $0)
|
|
REL_DIR="$BASE_DIR/release/dist/pong"
|
|
RAYLIB_DLL="$BASE_DIR/build/subprojects/raylib/libraylib.dll"
|
|
|
|
rm -r "$REL_DIR"; mkdir -p "$REL_DIR"
|
|
|
|
# Set up the build directory
|
|
meson setup build/
|
|
|
|
# Build the application
|
|
meson compile -C build/
|
|
|
|
# Parse the output of the 'ldd' command (using only DLLs that are found) and create a file with the required DLL paths.
|
|
ldd build/pong.exe | awk ' NF == 4 {print $3}' | grep -i "dll" > "$BASE_DIR/tmp_file.txt"
|
|
|
|
# Copy the required DLLs.
|
|
cp $(cat "$BASE_DIR/tmp_file.txt") "$REL_DIR"
|
|
|
|
# Copy the raylib DLL, if it does not exist in the directory
|
|
cp -n "$RAYLIB_DLL" "$REL_DIR"
|
|
|
|
# Copy the executable itself
|
|
cp "$BASE_DIR/build/pong" "$REL_DIR"
|
|
|
|
# Remove the temporary file.
|
|
rm "$BASE_DIR/tmp_file.txt"
|
|
|
|
# Go to the parent directory of $REL_DIR, and zip the $REL_DIR directory. This ensures
|
|
# that the parent directories aren't included in the zip file.
|
|
# The command is enclosed in parantheses, to ensure that the main shell's directory
|
|
# isn't changed.
|
|
(cd "$REL_DIR/.." && zip -r "./netpong-win.zip" "./pong")
|
|
|