Flatpak spec file fixes
This page lists fixes that were needed to make packages rebuild and work properly with a prefix of /app, which is needed to include them in an application flatpak. See the Fedora Flatpak documentation.
Fixing RPM Macros
Macros installed in /usr/lib/rpm/macros.d should reference the %{_bindir} of the tool, not the %{_bindir} of the package being compiled:
✓ meson Fix binddir usage in macros.meson
✓ ninja-build Fix binddir usage in macros.ninja
✓ qt5 always refer to binaries in their installed location
Not using %{_prefix} for build dependencies
Similarly, sometimes spec files use %{_prefix} to refer to the location of their dependencies:
✓ endless-sky scons is in /usr/bin, even if we're compiling with a different %{_prefix}
✓ SDL Remove manual updating of config.{guess,sub}
Respecting the build environment
Overwriting an environment variable like PKG_CONFIG_PATH will cause the paths to /app in the build environment not to take effect:
✓ OpenEXR In %check, augment PKG_CONFIG_PATH, not replace it
✓ phonon In %check, augment PKG_CONFIG_PATH, not replace it
endless-sky Fix compilation with CPLUS_INCLUDE_PATH set for Flatpak builds (Scons doesn't pass environment variables through by default)
Fixing installation
Often spec files need minor adjustment to make sure everything get installed under %{_prefix}
✓ kde-settings Handle %{_prefix} != /usr
✓ glew Fix installation with prefix=/app
✓ libgee Fix installation with /usr != /usr
✓ libnatpmp Fix to properly install into %{_bindir} / %{_includedir}
✓ libvpx Avoid hardcoding prefix=/usr
✓ phonon Pass Qt paths we'll use in the file list to CMake
✓ polkit Fix installation with prefix != /usr
Fixing man pages
rpm-build's brp-compress doesn't find manual packages in /app/share/man, so if a package hard codes the .gz suffix for man pages in the file list (the recommendation is to use globbing), then building fails. There is an accepted upstream PR to fix brp-compress.
✓ jbig2dec Handle both compressed and uncompressed man pages
✓ libidn Handle uncompressed info pages
✓ libraw1394 Handle both compressed and uncompressed man pages
✓ mcpp Handle both compressed and uncompressed manual pages
stellarium Handle both compressed and uncompressed man pages
Stripping down dependencies
Sometimes you run into big dependency chains or other complexity that can be determined to just not matter in the flatpak context. In this case, conditionalization: %if 0%{?flatpak}
is the easiest approach.
✓ boost Disable openmpi and mpich for Flatpak-bundled builds
✓ kf5-kio Disable help/ghelp protocols for Flatpak builds
✓ pycairo Disable xpyb support
✓ qt Disable qtchooser for Flatpak builds
✓ rawtherapee Don't explicitly require fftw
✓ SuperLU Remove gcc-gfortran as required package
✓ fluidsynth Disable jack for Flatpak builds
Other changes
perl Make builds for inclusion in an application Flatpak work (add a /usr/bin/perl symlink and look for modules in /usr/ as well as /app.)
lua-posix Use RPM macros from lua-devel