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

Add support for Flatpak automatic generation #20

Merged
merged 4 commits into from
Dec 15, 2024

Conversation

skadge
Copy link
Contributor

@skadge skadge commented Dec 8, 2024

Flatpak (https://flatpak.org/) is becoming the dominant application distribution mechanism on Linuxes.

This PR depends on (and indeed, includes) PR #19 and #21 .

This PR:

  • add supports for building FlatFab as a flatpak
  • add a github workflow action to automatically build the flatpak when a tag is pushed

image

Example result (on fake tags I created for testing):

image

TODO:

  • the resulting flatpak does not currently work due to a dynamic linking issue (libGLU.so.1 inside of the flatbak container is not found, unclear why, a workaround would be to start FlatFab from a script that add /app/lib64 to LD_LIBRARY_PATH)
  • we should probably only run this workflow for tagged releases

Optional:

  • ideally, we should automatically publish the flatpak on flathub (https://flathub.org/) which is the leading 'app store' for open-source flatpaks. I haven't looked into it yet.

@JamesMcCrae please let me know if you think this is a useful direction, and if you feel like providing this kind of distribution channel (this would definitely make it much easier to install and update FlatFab on linux, without having to care too much about the different linux distributions)

@skadge skadge force-pushed the flatpak branch 4 times, most recently from dc78b9d to 4104077 Compare December 10, 2024 23:54
@skadge skadge changed the title Draft: Add support for Flatpak automatic generation Add support for Flatpak automatic generation Dec 10, 2024
@skadge skadge mentioned this pull request Dec 11, 2024
@skadge
Copy link
Contributor Author

skadge commented Dec 11, 2024

For reference, the generate binary is only ~1.5MB big! (this is possible as all the Qt libraries are manage by flatpak as shared runtimes, thus massively reducing the size of the package)

Copy link
Owner

@JamesMcCrae JamesMcCrae left a comment

Choose a reason for hiding this comment

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

This seems like a great initiative, as it will streamline distribution of latest releases on Linux moving forward. A few comments just relating to further removal of Network/Webengine from these automation files, and then happy to approve the changes.

CMakeLists.txt Outdated
@@ -9,7 +9,7 @@ set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOUIC ON)

find_package(Qt5 COMPONENTS Core Gui OpenGL Widgets Network WebEngineWidgets REQUIRED)
find_package(Qt5 COMPONENTS Core Gui OpenGL Widgets Network REQUIRED)
Copy link
Owner

Choose a reason for hiding this comment

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

Can "Network" also be removed here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

good catch. Fixed in #21

CMakeLists.txt Outdated
@@ -78,10 +78,16 @@ target_link_libraries(${PROJECT_NAME}
Qt5::OpenGL
Qt5::Widgets
Qt5::Network
Copy link
Owner

Choose a reason for hiding this comment

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

Remove "Qt5::Network" here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

same. Fixed in #21

README.md Outdated
- install `flatpak` and `flatpak-builder`
- `flatpak install org.kde.Sdk/x86_64/5.15-24.08`
- `flatpak install org.kde.Platform/x86_64/5.15-24.08`
- `flatpak install io.qt.qtwebengine.BaseApp/x86_64/5.15-24.08`
Copy link
Owner

Choose a reason for hiding this comment

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

Should this line be removed, as it appears specific to webengine?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed, thanks

@JamesMcCrae
Copy link
Owner

Re: GLU library issue, where does the Flatpak-generated build look for the library? When I run "ldd FlatFab" locally I get:

libGLU.so.1 => /lib/x86_64-linux-gnu/libGLU.so.1 (0x00007f5df29ef000)

While here, clean up CI/CD script a little
@skadge
Copy link
Contributor Author

skadge commented Dec 13, 2024

Re: GLU library issue, where does the Flatpak-generated build look for the library? When I run "ldd FlatFab" locally I get:

libGLU.so.1 => /lib/x86_64-linux-gnu/libGLU.so.1 (0x00007f5df29ef000)

As you might have seen in the flatpak manifest, I build manually libGLU when building the flatpak. The library end up in /app/lib64. For some reason (and I could not figure out why), the FlatFab binary happily compiles against this library, but fails to launch, as /app/lib64 is not in the LD_LIBRARY_PATH of the built flatpak. So in flatpak/flatfab-launch.sh, I manually append this path the the LD_LIBRARY_PATH before launching FlatFab.

Uses the latest Qt 5.15 runtime; builds manually Eigen and GLU.

To build:

- install flatpak and flatpak-builder
- install kde Sdk and Runtime 5.15-24.08 (cf README)
- flatpak-builder --force-clean --install --user flatpak-build com.flatfab.FlatFab.yml

Run with:
flatpak run com.flatfab.FlatFab
- creates a GitHub release everytime a 'vX.Y.Z' tag is pushed
- generates Linux flatpak and upload it to the release
@skadge
Copy link
Contributor Author

skadge commented Dec 13, 2024

@JamesMcCrae : I've renamed the flatpak id from com.flatfab.FlatFab to edu.toronto.dgp.FlatFab.

@JamesMcCrae JamesMcCrae merged commit 4251eca into JamesMcCrae:master Dec 15, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants