packaging: ENABLE_RPATH_ORIGIN on Fedora RPM build

Fedora Linux recently turned on some hardcore RPATH hardening
that causes RPM build to fail with a wide variety of prefixes unless
$ORIGIN is enabled.

It builds fine with /usr as the prefix because in that case we disable
the RPATH.

In the long run perhaps we should have the rpm-package target use the
standard prefix of /usr instead of the CMAKE_INSTALL_PREFIX, but even
so we want the spec file to work if /usr/local is set as the prefix.
Fix #17830
This commit is contained in:
John Thacker 2022-01-04 21:28:17 -05:00
parent 007883408f
commit 98378d76d0
1 changed files with 6 additions and 0 deletions

View File

@ -300,6 +300,9 @@ development of Wireshark scripts and plugins.
# https://docs.fedoraproject.org/en-US/packaging-guidelines/CMake/
# https://fedoraproject.org/wiki/Changes/CMake_to_do_out-of-source_builds
# https://en.opensuse.org/openSUSE:Build_system_recipes#cmake
# Fedora's new RPATH hardening means we need to enable $ORIGIN if the
# prefix is anything other than /usr:
# https://fedoraproject.org/wiki/Changes/Broken_RPATH_will_fail_rpmbuild
%if 0%{?rhel} && ( 0%{?rhel} <= 7 )
cmake3 \
%else
@ -309,6 +312,9 @@ cmake \
%cmake \
%endif
%endif
%if 0%{?fedora} && ( "%{_prefix}" != "/usr" )
-DENABLE_RPATH_ORIGIN=ON \
%endif
%if %{with ccache}
-DENABLE_CCACHE=ON \
%endif