Git Product home page Git Product logo

cross-compile-godot-raspberry-pi's Introduction

Cross-compile Godot binaries for the Raspberry Pi

GitHub release (latest by date) GitHub license

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.

Cross-compile Godot binaries for the Raspberry Pi

Table of contents

Requirements:

Dependencies

  • curl
  • git
  • jq
  • tar
  • wget
  • zip

Limitations

The toolchain this script uses has a few limitations at the moment:

  • Only supports cross-compilation for 32 bit binaries and Raspberry Pi verions 3 and 4.
  • Can't compile Godot 2.x because it requires gcc < 6 and the toolchain only has gcc 10.2.

πŸ€– Pre-compiled binaries

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.

πŸ› οΈ Setup

Install the scripts

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

Update the scripts

cd cross-compile-godot-raspberry-pi
git pull

πŸš€ Usage

./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/.

πŸ“– Options

  • --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 or godot-toolchain.
    • Path (optional): Path to the directory where the files will be stored.
    • Default path: Same folder as this script.
  • --source-dir [path]: Sets the Godot source files directory.
    • Default: ./godot.
  • --toolchain-dir [path]: Sets the Godot toolchain directory.
    • Default: ./arm-godot-linux-gnueabihf_sdk-buildroot.
  • --binaries-dir [path]: Sets the Godot compiled binaries directory.
    • Default: ./compiled-binaries.
  • --godot-versions [version/s]: Sets the Godot version/s to compile.
    • Version/s: Use --get-tags to see the available versions.
  • --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.
  • --binaries [binary type/s]: Sets the different types of Godot binaries to compile.
    • Binary type/s: editor export-template headless server.
  • --scons-jobs [number|string]: Sets the jobs (CPUs) to use in SCons.
    • Number: 1-∞.
    • String: all (use all the available CPUs).
    • Default: 1.
  • --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.

πŸ’ Examples

  • Compile:
    • The Godot editor (version 3.2.3-stable).
    • For the Raspberry Pi 4.
    • Using 4 CPU cores.
./cross-compile-godot-raspberry-pi.sh --godot-versions "3.2.3-stable" --rpi-versions "4" --binaries "editor" --scons-jobs "4"
  • Compile:
    • The Godot editor (version 3.2.3-stable) and the 4f891b706027dc800f6949bec413f448defdd20d commit (which is 3.2.4 RC 3).
    • For the Raspberry Pi 4.
    • Using 4 CPU cores.
./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 (version 3.2.3-stable).
    • For the Raspberry Pi 3 and 4.
    • Using 8 CPU cores.
    • With LTO enabled.
./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 the export templates (versions 3.1.2-stable and 3.2.3-stable).
    • For the Raspberry Pi 3 and 4.
    • Using all the available CPU cores.
    • With LTO enabled.
./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 the export templates (versions 3.1.2-stable and 3.2.3-stable).
    • For the Raspberry Pi 3 and 4.
    • Using all the available CPU cores.
    • With LTO enabled.
    • Where the Godot source files are located in /path/to/the/godot/source/files.
./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

πŸ“‹ Config file

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 = ""

Transfer files to the Raspberry Pi

Requirements:

Dependencies

  • rsync

πŸš€ Usage

./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/.

πŸ“– Options

  • --help: Prints the help message.
  • --version: Prints the script version.
  • --binaries-dir [path]: Sets the Godot compiled binaries directory.
    • Default: ./compiled-binaries.
  • --remote-dir [path]: Sets the Raspberry Pi directory where the files will be transfered.
    • Default: ~/godot-binaries/ (note the trailing slash!).
  • --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 for master..
  • --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.
  • --binaries [binary type/s]: Sets the different types of Godot binaries to compile.
    • Binary type/s: editor export-template headless server.
  • --auto: Starts transferring taking the settings in the config file.

πŸ’ Examples

  • Transfer:
    • The Godot editor (version 3.2.3-stable).
    • For the Raspberry Pi 4.
    • To the Raspberry Pi with the username pi and the IP 192.168.1.100.
./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 (version 3.2.3-stable).
    • For the Raspberry Pi 4.
    • To the Raspberry Pi with the username pi and the IP 192.168.1.100.
    • And store the files in /path/to/the/folder/ (note the trailing slash!).
./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/"

πŸ“‹ Config file

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"

πŸ—’οΈ Changelog

See CHANGELOG.

πŸ‘€ Author

hiulit

🀝 Contributing

Feel free to:

πŸ™Œ Supporting this project

If you love this project or find it helpful, please consider supporting it through any size donations to help make it better ❀️.

Become a patron

Suppor me on Ko-Fi

Buy me a coffee

Donate Paypal

If you can't, consider sharing it with the world...

... or giving it a star ⭐️.

πŸ‘ Credits

Thanks to:

πŸ“ Licenses

cross-compile-godot-raspberry-pi's People

Contributors

burnsedia avatar hiulit avatar

Stargazers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.