From Fedora Project Wiki

(Update status of changes)
(Add OpenEXR and a section about respecting the build environment)
Line 15: Line 15:
 
'''endless-sky''' [https://src.fedoraproject.org/rpms/endless-sky/pull-request/1 scons is in /usr/bin, even if we're compiling with a different %{_prefix}]  <br />
 
'''endless-sky''' [https://src.fedoraproject.org/rpms/endless-sky/pull-request/1 scons is in /usr/bin, even if we're compiling with a different %{_prefix}]  <br />
 
'''SDL''' [https://src.fedoraproject.org/rpms/SDL/c/ed85024942eb2e84f6496b59b11ca2d62ce07e7d Always look for automake scripts in /usr/share, not in %{_datadir}] <br />
 
'''SDL''' [https://src.fedoraproject.org/rpms/SDL/c/ed85024942eb2e84f6496b59b11ca2d62ce07e7d Always look for automake scripts in /usr/share, not in %{_datadir}] <br />
 +
 +
== 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''' [https://src.fedoraproject.org/rpms/OpenEXR/pull-request/1 In %check, augment PKG_CONFIG_PATH, not replace it ] <br />
 +
✓ '''phonon''' [https://src.fedoraproject.org/rpms/phonon/pull-request/1 In %check, augment PKG_CONFIG_PATH, not replace it] <br />
  
 
== Fixing installation ==
 
== Fixing installation ==
Line 24: Line 31:
 
✓ '''libnatpmp''' [https://src.fedoraproject.org/rpms/libnatpmp/pull-request/1 Fix to properly install into %{_bindir} / %{_includedir}] <br />
 
✓ '''libnatpmp''' [https://src.fedoraproject.org/rpms/libnatpmp/pull-request/1 Fix to properly install into %{_bindir} / %{_includedir}] <br />
 
✓ '''libvpx''' [https://src.fedoraproject.org/rpms/libvpx/pull-request/1 Avoid hardcoding prefix=/usr] <br />
 
✓ '''libvpx''' [https://src.fedoraproject.org/rpms/libvpx/pull-request/1 Avoid hardcoding prefix=/usr] <br />
✓ '''phonon''' [https://src.fedoraproject.org/rpms/phonon/pull-request/1 Pass Qt paths we'll use in the file list to CMake; In %check, augment PKG_CONFIG_PATH, not replace it] <br />
+
✓ '''phonon''' [https://src.fedoraproject.org/rpms/phonon/pull-request/1 Pass Qt paths we'll use in the file list to CMake] <br />
 
✓ '''polkit''' [https://src.fedoraproject.org/rpms/polkit/c/98744d97b3f3c305af250c59a8871a4b676c5eea?branch=master Fix installation with prefix != /usr] <br />
 
✓ '''polkit''' [https://src.fedoraproject.org/rpms/polkit/c/98744d97b3f3c305af250c59a8871a4b676c5eea?branch=master Fix installation with prefix != /usr] <br />
  

Revision as of 18:08, 1 October 2018

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 Always look for automake scripts in /usr/share, not in %{_datadir}

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

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
mcpp Handle both compressed and uncompressed manual pages
libidn Handle uncompressed info pages
libraw1394 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