Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Manifest: Build Godot Engine from source #12

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# EditorConfig <http://EditorConfig.org>
root = true

[*.yml,*.yaml]
charset = utf-8
end_of_line = lf
indent_size = tab
indent_style = space
insert_final_newline = true
max_line_length = 80
tab_width = 2
119 changes: 93 additions & 26 deletions com.github.elliegames.sanctify-game.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
app-id: com.github.elliegames.sanctify-game
runtime: io.elementary.Platform
runtime-version: '8'
base: org.godotengine.godot.BaseApp
base-version: '4.3'
sdk: io.elementary.Sdk
command: com.github.elliegames.sanctify-game
finish-args:
Expand All @@ -14,36 +12,105 @@ finish-args:
- '--device=all'
# Required for GPU Acceleration
- '--device=dri'
- '--filesystem=home'
build-options:
env:
# SCons flags common to all builds
# Shouldn't be quoted when used as it's a single string, not an array
SCONS_FLAGS: >
platform=linuxbsd
CCFLAGS=-I/app/include
prefix=/app
unix_global_settings_path=/app
progress=no
builtin_freetype=no
builtin_libogg=no
builtin_libpng=no
builtin_libtheora=no
builtin_libvorbis=no
builtin_libwebp=no
builtin_openssl=no
builtin_libvpx=no
builtin_zlib=no
builtin_graphite=no
builtin_harfbuzz=no
udev=no
arch:
x86_64:
env:
# Only enable when targeting x86_64 (causes issues on other architectures)
SCONS_FLAGS_EXTRA: production=yes
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you only use production=yes for the template_release build and not the editor, you'll probably get a slight build speedup. Since the editor executable isn't included in the final flatpak, it probably doesn't need to be optimized.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good call, thanks!


modules:
- name: sanctify-game
buildsystem: simple
- name: glu
buildsystem: meson
sources:
- type: archive
url: https://archive.mesa3d.org/glu/glu-9.0.3.tar.xz
sha256: bd43fe12f374b1192eb15fe20e45ff456b9bc26ab57f0eee919f96ca0f8a330f
cleanup:
- /include
- /lib/*.a
- /lib/*.la
- /lib/pkgconfig
Comment on lines +44 to +54
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- name: glu
buildsystem: meson
sources:
- type: archive
url: https://archive.mesa3d.org/glu/glu-9.0.3.tar.xz
sha256: bd43fe12f374b1192eb15fe20e45ff456b9bc26ab57f0eee919f96ca0f8a330f
cleanup:
- /include
- /lib/*.a
- /lib/*.la
- /lib/pkgconfig

AFAICT, this is no longer required to build godot: godotengine/godot@587826f

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, interesting. It's still included in the Flathub BaseApp manifest; I've reported that here: flathub/org.godotengine.godot.BaseApp#47


- name: scons
buildsystem: simple
cleanup:
- '*'
sources:
- type: archive
sha256: 6e928fc97984e719814270f6863f2183b3b72180b0162a5ed09db68c9994100c
url: https://downloads.sourceforge.net/project/scons/scons/4.8.0/SCons-4.8.0.tar.gz
build-commands:
- ./Godot_v4.3-stable_linux.x86_64 --path sanctify --headless --verbose --export-pack "Linux" "sanctify.pck"
- install -Dm755 run.sh /app/bin/com.github.elliegames.sanctify-game
- install -D sanctify/sanctify.pck /app/share/com.github.elliegames.sanctify-game/sanctify.pck
- install -D data/icons/16/com.github.elliegames.sanctify-game.svg /app/share/icons/hicolor/16x16/apps/com.github.elliegames.sanctify-game.svg
- install -D data/icons/16/com.github.elliegames.sanctify-game.svg /app/share/icons/hicolor/16x16@2/apps/com.github.elliegames.sanctify-game.svg
- install -D data/icons/24/com.github.elliegames.sanctify-game.svg /app/share/icons/hicolor/24x24/apps/com.github.elliegames.sanctify-game.svg
- install -D data/icons/24/com.github.elliegames.sanctify-game.svg /app/share/icons/hicolor/24x24@2/apps/com.github.elliegames.sanctify-game.svg
- install -D data/icons/32/com.github.elliegames.sanctify-game.svg /app/share/icons/hicolor/32x32/apps/com.github.elliegames.sanctify-game.svg
- install -D data/icons/32/com.github.elliegames.sanctify-game.svg /app/share/icons/hicolor/32x32@2/apps/com.github.elliegames.sanctify-game.svg
- install -D data/icons/48/com.github.elliegames.sanctify-game.svg /app/share/icons/hicolor/48x48/apps/com.github.elliegames.sanctify-game.svg
- install -D data/icons/48/com.github.elliegames.sanctify-game.svg /app/share/icons/hicolor/48x48@2/apps/com.github.elliegames.sanctify-game.svg
- install -D data/icons/64/com.github.elliegames.sanctify-game.svg /app/share/icons/hicolor/64x64/apps/com.github.elliegames.sanctify-game.svg
- install -D data/icons/64/com.github.elliegames.sanctify-game.svg /app/share/icons/hicolor/64x64@2/apps/com.github.elliegames.sanctify-game.svg
- install -D data/icons/128/com.github.elliegames.sanctify-game.svg /app/share/icons/hicolor/128x128/apps/com.github.elliegames.sanctify-game.svg
- install -D data/icons/128/com.github.elliegames.sanctify-game.svg /app/share/icons/hicolor/128x128@2/apps/com.github.elliegames.sanctify-game.svg
- install -D data/icons/symbolic/com.github.elliegames.sanctify-game.svg /app/share/icons/hicolor/symbolic/apps/com.github.elliegames.sanctify-game.svg
- install -D data/com.github.elliegames.sanctify-game.desktop /app/share/applications/com.github.elliegames.sanctify-game.desktop
- install -D data/com.github.elliegames.sanctify-game.appdata.xml /app/share/appdata/com.github.elliegames.sanctify-game.appdata.xml
- pip3 install --no-index --no-build-isolation --prefix=/app .

- name: godot
buildsystem: simple
cleanup:
- /bin/godot-tools
sources:
- type: archive
url: https://downloads.tuxfamily.org/godotengine/4.3/Godot_v4.3-stable_linux.x86_64.zip
sha256: 7de56444b130b10af84d19c7e0cf63cf9e9937ee4ba94364c3b7dd114253ca21

url: https://github.com/godotengine/godot/releases/download/4.3-stable/godot-4.3-stable.tar.xz
sha256: 751e55bfad8e04b846f9cf7b6eb80e058986a2cb1b103fc0fe6a4d8526a20e56

build-commands:
# Tools, to export the PCK file from source at build time
- python3 /app/bin/scons $SCONS_FLAGS $SCONS_FLAGS_EXTRA tools=yes target=editor -j "$FLATPAK_BUILDER_N_JOBS"
- install -Dm755 bin/godot.linuxbsd.editor.* /app/bin/godot-tools

# Runner, to be shipped in the Flatpak as the binary
- python3 /app/bin/scons $SCONS_FLAGS $SCONS_FLAGS_EXTRA tools=no target=template_release -j "$FLATPAK_BUILDER_N_JOBS"
- install -Dm755 bin/godot.linuxbsd.template_release.* /app/bin/${FLATPAK_ID}

# Export templates, used at build-time to export the PCK file
- touch _sc_
- mkdir -p ./editor_data/export_templates
- mv bin/ editor_data/export_templates/4.3.stable

- name: sanctify-game
buildsystem: simple
sources:
- type: dir
path: .

build-commands:
# Export the PCK file and install it alongside the Godot Engine runner
- godot-tools --path sanctify --headless --verbose --export-pack "Linux" ${FLATPAK_ID}.pck
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you --export here instead of --export-pack, and pass /app/bin/${FLATPAK_ID} as the dest, you can export the .pck and the correctly named executable at the same time, meaning you don't have to export the executable as part of the godot module above, allowing cleanup: [*], which maybe makes that module a bit cleaner to drop into other manifests.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't --export require export templates? Or is that produced as part of the godot build step?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, the previous module sets up the export template.

I'm using --export in my PR and it's tested and working.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@davidmhewitt ah yeah, I was coming from the Flathub world where a BaseApp provides the runner, so you only provide the PCK file. But of course if you're building it all from source anyway… this makes sense.

- install -Dm644 sanctify/${FLATPAK_ID}.pck ${FLATPAK_DEST}/bin/${FLATPAK_ID}.pck

- install -D data/icons/16/${FLATPAK_ID}.svg /app/share/icons/hicolor/16x16/apps/${FLATPAK_ID}.svg
- install -D data/icons/16/${FLATPAK_ID}.svg /app/share/icons/hicolor/16x16@2/apps/${FLATPAK_ID}.svg
- install -D data/icons/24/${FLATPAK_ID}.svg /app/share/icons/hicolor/24x24/apps/${FLATPAK_ID}.svg
- install -D data/icons/24/${FLATPAK_ID}.svg /app/share/icons/hicolor/24x24@2/apps/${FLATPAK_ID}.svg
- install -D data/icons/32/${FLATPAK_ID}.svg /app/share/icons/hicolor/32x32/apps/${FLATPAK_ID}.svg
- install -D data/icons/32/${FLATPAK_ID}.svg /app/share/icons/hicolor/32x32@2/apps/${FLATPAK_ID}.svg
- install -D data/icons/48/${FLATPAK_ID}.svg /app/share/icons/hicolor/48x48/apps/${FLATPAK_ID}.svg
- install -D data/icons/48/${FLATPAK_ID}.svg /app/share/icons/hicolor/48x48@2/apps/${FLATPAK_ID}.svg
- install -D data/icons/64/${FLATPAK_ID}.svg /app/share/icons/hicolor/64x64/apps/${FLATPAK_ID}.svg
- install -D data/icons/64/${FLATPAK_ID}.svg /app/share/icons/hicolor/64x64@2/apps/${FLATPAK_ID}.svg
- install -D data/icons/128/${FLATPAK_ID}.svg /app/share/icons/hicolor/128x128/apps/${FLATPAK_ID}.svg
- install -D data/icons/128/${FLATPAK_ID}.svg /app/share/icons/hicolor/128x128@2/apps/${FLATPAK_ID}.svg
- install -D data/icons/symbolic/${FLATPAK_ID}.svg /app/share/icons/hicolor/symbolic/apps/${FLATPAK_ID}.svg

- install -D data/${FLATPAK_ID}.desktop /app/share/applications/${FLATPAK_ID}.desktop
- install -D data/${FLATPAK_ID}.metainfo.xml /app/share/metainfo/${FLATPAK_ID}.metainfo.xml
13 changes: 0 additions & 13 deletions run.sh

This file was deleted.

Loading