Skip to content

Instantly share code, notes, and snippets.

@Sharaf5
Forked from Calinou/godot_mingw.sh
Created July 8, 2023 23:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Sharaf5/080ad88f67ebf7f780f88cc0041d9629 to your computer and use it in GitHub Desktop.
Save Sharaf5/080ad88f67ebf7f780f88cc0041d9629 to your computer and use it in GitHub Desktop.
Compile Godot using MinGW and generate Windows installers using InnoSetup (from Linux)
#!/bin/sh
set -euo pipefail
# Number of CPU threads to use for building
# Use `./godot_mingw.sh <number of threads>` to specify
THREADS=$1
# Godot Git clone path
GODOT_PATH="$HOME/Documents/Git/godotengine/godot"
# Godot InnoSetup files path
INSTALLER_PATH="$HOME/windows-installer"
# InnoSetup compiler path (requires WINE)
ISCC="$HOME/innosetup/ISCC.exe"
# Destination paths
EDITOR_PATH="$HOME/.godot/editor/3.0-alpha"
TEMPLATES_PATH="$HOME/.godot/templates/3.0-alpha"
cd "$GODOT_PATH"
# Clean up stuff before starting
# WARNING: This removes all untracked files in the Godot Git clone!
#git clean -dfx
#rm -rf "$GODOT_PATH/bin"
mkdir -p "$GODOT_PATH/bin"
# Create required directories
mkdir -p "$EDITOR_PATH" "$TEMPLATES_PATH"
# Build Godot
# Set the 2nd command-line argument to anything to disable building (and only generate installers)
if [ -z ${2+x} ]; then
git pull
scons platform=windows bits=64 tools=yes target=release_debug use_lto=yes -j$THREADS
scons platform=windows bits=64 tools=no target=release_debug use_lto=yes -j$THREADS
scons platform=windows bits=64 tools=no target=release use_lto=yes -j$THREADS
scons platform=windows bits=32 tools=yes target=release_debug use_lto=yes -j$THREADS
scons platform=windows bits=32 tools=no target=release_debug use_lto=yes -j$THREADS
scons platform=windows bits=32 tools=no target=release use_lto=yes -j$THREADS
fi
# Generate Windows installers using InnoSetup
# `godot.iss` can be found at <https://gist.github.com/Calinou/6f71d50cfc77b4a3967d1ccafa44d2c4>
cd "$INSTALLER_PATH"
cp "$GODOT_PATH/bin/godot.windows.opt.tools.64.exe" "godot.exe"
wine "$ISCC" "godot.iss"
cp "$GODOT_PATH/bin/godot.windows.opt.tools.32.exe" "godot.exe"
wine "$ISCC" "godot.iss" /DApp32Bit
# Copy installers to distribution directory
cp "$INSTALLER_PATH/Output/godot-windows-installer-x86_64.exe" "$EDITOR_PATH"
cp "$INSTALLER_PATH/Output/godot-windows-installer-x86.exe" "$EDITOR_PATH"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment