Solution for sharing a build cache between modules, e.g. for Go
Checklist
- [X] I agree to follow the Code of Conduct that this project adheres to.
- [X] I have searched the issue tracker for a feature request that matches the one I want to file, without success.
Suggestion
When building Flatpaks for Go apps locally, it would be useful to be able to gain access to the Go build cache, usually located at $XDG_CACHE_HOME/go-build. Adding --filesystem=home to the build-args works, but this is not allowed when publishing to Flathub, so the only solution at the moment is to add it to the manifest file temporarily for local development and then remember to remove it before pushing to Flathub. My particular use case involves building an app that, thanks to some massive C dependencies, can take upwards of 20+ minutes to build. With cache access, builds after the first one take less than 5 seconds.
If it was possible to specify extra build-options, such as with a --build=--filesystem=home --build=--env=CC=gcc, it would make this much easier and less error-prone.
An alternative that I would be O.K. with, though it would be less flexible, would be some option similar to --ccache that allows each local build to re-use a cache specifically for the build sandbox. The cache wouldn't benefit at all from usage of Go outside of building the current package, but at least repeat builds of the package would be much, much faster. The cache location can be changed via the $GOCACHE environment variable, so that shouldn't be too hard to do.
If it was possible to specify extra build-options, such as with a --build=--filesystem=home --build=--env=CC=gcc, it would make this much easier and less error-prone.
This is the same thing as build-args. It is obviously a security bypass.
You'll need a smarter option that deals with cache directories in some way.