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

document and recommend building less stuff #491

Closed
skierpage opened this issue Jul 1, 2024 · 4 comments · Fixed by #492
Closed

document and recommend building less stuff #491

skierpage opened this issue Jul 1, 2024 · 4 comments · Fixed by #492

Comments

@skierpage
Copy link

I've made patches to keep the org.kde.skrooge flatpak working on flathub and kde-runtime-nightly. When I entered a shell in a running instance I found lots of files from modules that the app only needs when building. One module (sqlcipher) build system even requires tclsh, which means all kinds of tcl machinery showed up in the flatpak. I cry at all the wasted CPU cycles and disk space.

The flatpak Building docs talk about Cleanup these files, but in many cases it would be much better not to build them at all! I think adding something like the following in Cleanup, or in a build commands section.

Look at the built flatpak for unneeded files: man pages in /usr/share/man, documentation, other binaries in /app/bin , etc.

(I use flatpak enter <PID> /bin/bash to enter a working flatpak, but there's surely a way to look at the results of a flatpak build; there isn't a doc page about running a flatpak build.)

If the manifest is removing lots of files, it may be a sign that your manifest is building more artifacts in a module than the flatpak needs; use build-command, config-opts, make-args and other Module properties to build less stuff. It's a good idea to add a comment such as
"//": "flatpak only needs library xyz from this module"

(I have yet to figure out how to get the flatpak manifest to only build tclsh in its tcl module.)

@bbhtt
Copy link
Collaborator

bbhtt commented Jul 1, 2024

I'm not exactly sure what you want documented here?

"Building less stuff" and the "cleanups" are highly specific to an app and the source. Eg. One app may not need python bindings for some source, but an app written in python will need them.

It may be fine to cleanup typelib files for most, but some apps can use them at runtime. /share/docs is cleaned up for most apps but a documentation viewer app will need it.

It's hard to produce generic documentation that will cover all cases.

It's upto the maintainer to decide what should be build or not and what to cleanup. They know their app better.

@skierpage
Copy link
Author

I'm not exactly sure what you want documented here?

Add something like the text I put in quotes. I understand there's no recipe for this, but looking at flatpaks it seems many don't even know to try. I think those sentences would improve the documentation.

To help manifest writers do less stuff and cleanup, flatpak build documentation could explain what happens during module build (what files it copies, do cleanup commands run in the source or destination directory, etc.). It would also be useful to know what the default commands for each build type are. But that's a lot of work; one step at a time.

@bbhtt
Copy link
Collaborator

bbhtt commented Jul 2, 2024

Added a note to recommend building less stuff by default.

@bbhtt
Copy link
Collaborator

bbhtt commented Jul 2, 2024

(I use flatpak enter /bin/bash to enter a working flatpak,

Yea that's fine, you can also use flatpak run --command=sh $FLATPAK_ID or directly look at the files in ~/.local/share/flatpak/app/$FLATPAK_ID/current/active/files/ (for a user install) /var/lib/flatpak/app/$FLATPAK_ID/current/active/files/ (for a system install)

but there's surely a way to look at the results of a flatpak build;

You can just check the contents like above or check the contents of the build directory. It should be builddir/files from where you ran flatpak-builder builddir --force-clean manifest

there isn't a doc page about running a flatpak build.)

https://docs.flatpak.org/en/latest/first-build.html#test-the-build

flatpak build documentation could explain what happens during module build (what files it copies

Whatever you specify via build-commands, post-install or whatever cmake/ninja/make installs, is installed.

do cleanup commands run in the source or destination directory, etc.).

No cleanups are run by default unless you added the property asking for it.

It would also be useful to know what the default commands for each build type are.

This would be done when #101 is solved.

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 a pull request may close this issue.

2 participants