Skip to content

Instantly share code, notes, and snippets.

@Calinou
Last active January 9, 2022 18:59
Show Gist options
  • Save Calinou/4a5eded8c811193e4618ebe77f750b7f to your computer and use it in GitHub Desktop.
Save Calinou/4a5eded8c811193e4618ebe77f750b7f to your computer and use it in GitHub Desktop.
Compile Godot for HTML5 easily
#!/bin/sh -x
# This script must be run from a GNU/Linux system with the Emscripten SDK
# installed and configured.
# Place this script at the root of your Godot Git clone.
# CC0 1.0 Universal
export EMSCRIPTEN_ROOT="/opt/emsdk/emscripten/master"
# Build Godot for HTML5 in debug and release mode
scons p=javascript -j$(nproc) verbose=no tools=no target=release
scons p=javascript -j$(nproc) verbose=no tools=no target=release_debug
cd bin/
# Copy files around to prepare the export templates
# TODO: Check if folder exists before attempting to create it
mkdir javascript_debug/
mkdir javascript_release/
cp godot.javascript.opt.debug.js javascript_debug/godot.js
cp godot.javascript.opt.debug.html.mem javascript_debug/godot.mem
cp ../tools/dist/html_fs/* javascript_debug/
cp godot.javascript.opt.js javascript_release/godot.js
cp godot.javascript.opt.html.mem javascript_release/godot.mem
cp ../tools/dist/html_fs/* javascript_release/
# Compress into .zip to make the export template
cd javascript_debug/
zip -r9 ../javascript_debug.zip *
cd ../javascript_release/
zip -r9 ../javascript_release.zip *
# Copy to Godot's templates folder
cd ../
cp javascript_debug.zip javascript_release.zip $HOME/.godot/templates/
@microlabig
Copy link

How to compile in Windows?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment