#! /usr/bin/env bash ## Build & package all project targets for a debug release PROJECT_NAME="gfolf" HELPMSG=$(cat <&2; exit 1; fi eval set -- "$OPTS" while true; do case "$1" in -h | --help ) echo "$HELPMSG"; exit 0;; -f | --force ) FORCE=1; shift;; -- ) shift; break;; * ) break;; esac done VERSION_TAG=`git describe` BUILD_DIR="data_package/$VERSION_TAG" if [ -d $BUILD_DIR ] && [ ! $FORCE ]; then echo "(error) Build directory `$BUILD_DIR` exists! Aborting..." echo "(HINT: use -f to force overwrite!)" exit 1 fi echo "Packaging to: $BUILD_DIR" ## Shared build logic function build_project { TARGET="$1" TARGET_SHORT="$2" TARGET_EXT="$3" TARGET_SUBDIR="$PROJECT_NAME""_$TARGET_SHORT" TARGET_DIR="$BUILD_DIR/$TARGET_SUBDIR" TARGET_OUT="$TARGET_DIR/$PROJECT_NAME.$TARGET_EXT" echo "Building target '$TARGET' to: $TARGET_OUT" set -x rm -rf "$TARGET_DIR" mkdir -p $TARGET_DIR godot --headless --export-debug "$TARGET" $TARGET_OUT set +x ZIP_OUT="$PROJECT_NAME""_$VERSION_TAG""_$TARGET_SHORT.7z" echo "Packaging to: $ZIP_OUT" # TODO set -x (cd $BUILD_DIR && 7z a $ZIP_OUT $TARGET_SUBDIR) set +x } # Build linux build_project "Linux" "linux64" "x86_64" # Build OSX build_project "macOS" "osx" "app" # Build Michaelsoft Binbows build_project "Windows Desktop" "win64" "exe"