A script to easily cross-compile Godot binaries for the Raspberry Pi from Linux x86_64 and an extra script to easily transfer the compiled Godot binaries to the Raspberry Pi using rsync.
- Requirements
- Dependencies
- Limitations
- Pre-compiled binaries
- Setup
- Usage
- Options
- Examples
- Config file
- Transfer files to the Raspberry Pi
- Godot source files (can be downloaded with this script).
- Godot dependecies to compile for Linux.
- Godot toolchain to cross-compile for ARM (can be downloaded with this script).
curl
git
jq
tar
wget
zip
The toolchain this script uses has a few limitations at the moment:
- Only supports cross-compilation for
32 bit
binaries and Raspberry Pi verions3
and4
. - Can't compile Godot
2.x
because it requiresgcc < 6
and the toolchain only hasgcc 10.2
.
There's a good chance that if you came to this repository you want to compile your own Godot binaries. But if you just want to get pre-compiled binaries, I have another repository with unofficial Godot binaries for the Raspberry Pi.
git clone https://github.com/hiulit/cross-compile-godot-raspberry-pi.git
cd cross-compile-godot-raspberry-pi
sudo chmod +x cross-compile-godot-raspberry-pi.sh
sudo chmod +x transfer-files-raspberry-pi.sh
cd cross-compile-godot-raspberry-pi
git pull
./cross-compile-godot-raspberry-pi.sh [OPTIONS]
If no options are passed, you will be prompted with a usage example:
USAGE: ./cross-compile-godot-raspberry-pi.sh [OPTIONS]
Use './cross-compile-godot-raspberry-pi.sh --help' to see all the options.
Log files are stored in logs/
.
--help
: Prints the help message.--version
: Prints the script version.--get-tags
: Prints the Godot tags from GitHub available to compile.--get-jobs
: Prints the number of available jobs/CPUs.--download [file] [path]
: Downloads the Godot source files or the Godot toolchain.- File:
godot-source-files
orgodot-toolchain
. - Path (optional): Path to the directory where the files will be stored.
- Default path: Same folder as this script.
- File:
--source-dir [path]
: Sets the Godot source files directory.- Default:
./godot
.
- Default:
--toolchain-dir [path]
: Sets the Godot toolchain directory.- Default:
./arm-godot-linux-gnueabihf_sdk-buildroot
.
- Default:
--binaries-dir [path]
: Sets the Godot compiled binaries directory.- Default:
./compiled-binaries
.
- Default:
--godot-versions [version/s]
: Sets the Godot version/s to compile.- Version/s: Use
--get-tags
to see the available versions.
- Version/s: Use
--godot-commits [commit/s]
: Sets the Godot commit/s to compile.- Commit/s: SHA-1 hash/es.
--rpi-versions [version/s]
: Sets the Raspberry Pi version/s to compile.- Version/s:
3 4
.
- Version/s:
--binaries [binary type/s]
: Sets the different types of Godot binaries to compile.- Binary type/s:
editor export-template headless server
.
- Binary type/s:
--scons-jobs [number|string]
: Sets the jobs (CPUs) to use in SCons.- Number:
1-β
. - String:
all
(use all the available CPUs). - Default:
1
.
- Number:
--use-lto
: Enables using Link Time Optimization (LTO) when compiling.--pack
: Packs all the binaries of the same Godot version and the same Raspberry Pi version.--auto
: Starts compiling taking the settings in the config file.
- Compile:
- The Godot
editor
(version3.2.3-stable
). - For the Raspberry Pi
4
. - Using
4
CPU cores.
- The Godot
./cross-compile-godot-raspberry-pi.sh --godot-versions "3.2.3-stable" --rpi-versions "4" --binaries "editor" --scons-jobs "4"
- Compile:
- The Godot
editor
(version3.2.3-stable
) and the4f891b706027dc800f6949bec413f448defdd20d
commit (which is3.2.4 RC 3
). - For the Raspberry Pi
4
. - Using
4
CPU cores.
- The Godot
./cross-compile-godot-raspberry-pi.sh --godot-versions "3.2.3-stable" --godot-commits "4f891b706027dc800f6949bec413f448defdd20d" --rpi-versions "4" --binaries "editor" --scons-jobs "4"
- Compile:
- The Godot
editor
(version3.2.3-stable
). - For the Raspberry Pi
3
and4
. - Using
8
CPU cores. - With
LTO enabled
.
- The Godot
./cross-compile-godot-raspberry-pi.sh --godot-versions "3.2.3-stable" --rpi-versions "3 4" --binaries "editor" --scons-jobs "4" --use-lto
- Compile:
- The Godot
editor
and theexport templates
(versions3.1.2-stable
and3.2.3-stable
). - For the Raspberry Pi
3
and4
. - Using
all
the available CPU cores. - With LTO
enabled
.
- The Godot
./cross-compile-godot-raspberry-pi.sh --godot-versions "3.1.2-stable 3.2.3-stable" --rpi-versions "3 4" --binaries "editor export-template" --scons-jobs "all" --use-lto
- Compile:
- The Godot
editor
and theexport templates
(versions3.1.2-stable
and3.2.3-stable
). - For the Raspberry Pi
3
and4
. - Using
all
the available CPU cores. - With
LTO enabled
. - Where the Godot source files are located in
/path/to/the/godot/source/files
.
- The Godot
./cross-compile-godot-raspberry-pi.sh --source-dir "/path/to/the/godot/source/files" --godot-versions "3.1.2-stable 3.2.3-stable" --rpi-versions "3 4" --binaries "editor export-template" --scons-jobs "all" --use-lto
You can edit this file directly, instead of passing all the options mentioned above, and then run:
./cross-compile-godot-raspberry-pi.sh --auto
# Settings for "cross-compile-godot-raspberry-pi.sh".
# Godot source files directory.
# Default: "./godot".
godot_source_files_dir = ""
# Godot toolchain directory.
# Default: "./arm-godot-linux-gnueabihf_sdk-buildroot".
godot_toolchain_dir = ""
# Godot compiled binaries directory.
# Default: "./compiled-binaries".
godot_compiled_binaries_dir = ""
# Godot version/s to compile (separated by blank spaces).
# Use "--get-tags" to see the available versions.
# Version/s must end with the suffix "-stable", except for "master".
godot_versions = ""
# Godot commit/s to compile (separated by blank spaces).
# Commit/s: SHA-1 hash/es.
godot_commits = ""
# Raspberry Pi version/s to compile (separated by blank spaces).
# Version/s: "3 4".
raspberry_pi_versions = ""
# Types of Godot binaries to compile (separated by blank spaces).
# Binary type/s: "editor export-template headless server".
binaries = ""
# Jobs (CPUs) to use in SCons.
# Number: "1-β".
# String: "all" (use all the available CPUs).
# Default: "1".
scons_jobs = ""
# Use Link Time Optimization (LTO) when compiling.
# Option: "yes".
use_lto = ""
# Pack all the binaries of the same Godot version and the same Raspberry Pi version.
# Option: "yes".
pack = ""
- SSH key pair.
- SSH passwordless login (optional, but preferable) (https://linuxize.com/post/how-to-setup-passwordless-ssh-login/).
- Static IP on the Raspberry Pi (optional, but preferable).
rsync
./transfer-files-raspberry-pi.sh [OPTIONS]
If no options are passed, you will be prompted with a usage example:
USAGE: ./transfer-files-raspberry-pi.sh [OPTIONS]
Use './transfer-files-raspberry-pi.sh --help' to see all the options.
Log files are stored in logs/
.
--help
: Prints the help message.--version
: Prints the script version.--binaries-dir [path]
: Sets the Godot compiled binaries directory.- Default:
./compiled-binaries
.
- Default:
--remote-dir [path]
: Sets the Raspberry Pi directory where the files will be transfered.- Default:
~/godot-binaries/
(note the trailing slash!).
- Default:
--remote-username [username]
: Sets the username of the Raspberry Pi.--remote-ip [IP]
: Sets the IP of the Raspberry Pi.--godot-versions [version/s]
: Sets the Godot version/s to compile.- Version/s must end with the suffix
-stable
, except formaster
..
- Version/s must end with the suffix
--godot-commits [commit/s]
: Sets the Godot commit/s to compile.- Commit/s: SHA-1 hash/es.
--rpi-versions [version/s]
: Sets the Raspberry Pi version/s to compile.- Version/s:
3 4
.
- Version/s:
--binaries [binary type/s]
: Sets the different types of Godot binaries to compile.- Binary type/s:
editor export-template headless server
.
- Binary type/s:
--auto
: Starts transferring taking the settings in the config file.
- Transfer:
- The Godot
editor
(version3.2.3-stable
). - For the Raspberry Pi
4
. - To the Raspberry Pi with the username
pi
and the IP192.168.1.100
.
- The Godot
./transfer-files-raspberry-pi.sh --remote-username "pi" --remote-ip "192.168.1.100" --godot-versions "3.2.3-stable" --rpi-versions "4" --binaries "editor"
- Transfer:
- The Godot
editor
(version3.2.3-stable
). - For the Raspberry Pi
4
. - To the Raspberry Pi with the username
pi
and the IP192.168.1.100
. - And store the files in
/path/to/the/folder/
(note the trailing slash!).
- The Godot
./transfer-files-raspberry-pi.sh --remote-username "pi" --remote-ip "192.168.1.100" --godot-versions "3.2.3-stable" --rpi-versions "4" --binaries "editor" --remote-dir "/path/to/the/folder/"
You can edit this file directly, instead of passing all the options mentioned above, and then run:
./transfer-files-raspberry-pi.sh --auto
# Settings for "transfer-files-raspberry-pi.sh".
# Godot compiled binaries directory.
# Default: "./compiled-binaries".
godot_compiled_binaries_dir = ""
# Raspberry Pi directory where the files will be transfered.
# Default: "~/godot-binaries/" (note the trailing slash!).
remote_dir = ""
# Username of the Raspberry Pi
remote_username = ""
# IP of the Raspberry Pi
remote_ip = ""
# Godot version/s to be transfered (separated by blank spaces).
# Version/s must end with the suffix "-stable", except for "master".
godot_versions = ""
# Godot commit/s to transfer (separated by blank spaces).
# Commit/s: SHA-1 hash/es.
godot_commits = ""
# Raspberry Pi version/s to transfer (separated by blank spaces).
# Version/s: "3 4".
raspberry_pi_versions = ""
# Types of Godot binaries to transfer (separated by blank spaces).
# Binary type/s: "editor export-template headless server".
binaries = ""
# Transfer a pack of all the binaries of the same Godot version and the same Raspberry Pi version
# instead of transferring each binary separately.
# Only use it if you previously used the "--pack" option when compiling the binaries.
# Option: "yes".
pack = "yes"
See CHANGELOG.
hiulit
Feel free to:
- Open an issue if you find a bug.
- Create a pull request if you have a new cool feature to add to the project.
- Start a new discussion about a feature request.
If you love this project or find it helpful, please consider supporting it through any size donations to help make it better β€οΈ.
If you can't, consider sharing it with the world...
... or giving it a star βοΈ.
Thanks to:
- Juan Linietsky (@reduz), Ariel Manzur (@punto-), RΓ©mi Verschelde (@akien-mga) and all the Godot contributors - For creating and maintaining the Godot Engine.
- Hein-Pieter van Braam-Stewart - For the Godot Engine buildroot, which is the base of this script and for helping me figure out how to use it.
- RΓ©mi Verschelde - For helping me with compilation issues.
- Andrea CalabrΓ³ - For the Godot logo used on the banner.
- Ery Prihananto - For the CPU image used on the banner.
- worldvectorlogo - For the Tux image used on the banner.
- Raspberry Pi Foundation - For the Raspberry Pi logo used on the banner.
- Source code: MIT License.
- Godot - Game Engine: MIT License.
- Godot logo: CC-BY-4.0 International.