From e345575f97c879471985b410ff962dc24b90d9cf Mon Sep 17 00:00:00 2001 From: Pavel Raiskup Date: Thu, 28 Mar 2019 13:37:17 +0100 Subject: [PATCH] %set_build_flags: define LT_SYS_LIBRARY_PATH This config is to let libtool recognize that our 64bit variant of %_libdir is actually on the standard/default library path, so libtool doesn't think it has to be hard-wired as RPATH. This is proper solution for libtool RPATH issues described in: https://docs.fedoraproject.org/en-US/packaging-guidelines/#_removing_rpath The libtool script/macros (new enough, v2.4.6+) honor this variable when it isn't possible to detect the system-wide default library path. It is e.g. able to parse /etc/ld.so.* configuration, but there's no info about /usr/lib64 on Fedora. So to not force everybody to do: %configure LT_SYS_LIBRARY_PATH=... ... rather set this system-wide. This is low-risk change since older libtool scripts don't use this variable, and really no other tools should. --- buildflags.md | 9 ++++++--- macros | 4 +++- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/buildflags.md b/buildflags.md index 01ba183..177bd59 100644 --- a/buildflags.md +++ b/buildflags.md @@ -15,9 +15,9 @@ This will invoke the `./configure` with arguments (such as `--prefix=/usr`) to adjust the paths to the packaging defaults. As a side effect, this will set the environment variables `CFLAGS`, -`CXXFLAGS`, `FFLAGS`, `FCFLAGS`, and `LDFLAGS`, so they can be used by -makefiles and other build tools. (However, existing values for this -variables are not overwritten.) +`CXXFLAGS`, `FFLAGS`, `FCFLAGS`, `LDFLAGS` and `LT_SYS_LIBRARY_PATH`, +so they can be used by makefiles and other build tools. (However, +existing values for these variables are not overwritten.) If your package does not use autoconf, you can still set the same environment variables using @@ -43,6 +43,9 @@ Individual build flags are also available through RPM macros: driver. At the start of the `%build` section, the environment variable `RPM_LD_FLAGS` is set to this value. +The variable `LT_SYS_LIBRARY_PATH` is defined here to prevent the `libtool` +script (v2.4.6+) from hardcoding %_libdir into the binaries' RPATH. + These RPM macros do not alter shell environment variables. For some other build tools separate mechanisms exist: diff --git a/macros b/macros index c1965e9..cd06548 100644 --- a/macros +++ b/macros @@ -52,12 +52,14 @@ # variables CFLAGS, CXXFLAGS, FFLAGS, FCFLAGS, LDFLAGS if they have # not been set already. RPM_OPT_FLAGS and RPM_LD_FLAGS have already # been set implicitly at the start of the %%build section. +# LT_SYS_LIBRARY_PATH is used by libtool script. %set_build_flags \ CFLAGS="${CFLAGS:-%{build_cflags}}" ; export CFLAGS ; \ CXXFLAGS="${CXXFLAGS:-%{build_cxxflags}}" ; export CXXFLAGS ; \ FFLAGS="${FFLAGS:-%{build_fflags}}" ; export FFLAGS ; \ FCFLAGS="${FCFLAGS:-%{build_fflags}}" ; export FCFLAGS ; \ - LDFLAGS="${LDFLAGS:-%{build_ldflags}}" ; export LDFLAGS + LDFLAGS="${LDFLAGS:-%{build_ldflags}}" ; export LDFLAGS ; \ + LT_SYS_LIBRARY_PATH="${LT_SYS_LIBRARY_PATH:-%_libdir:}" ; export LT_SYS_LIBRARY_PATH # Internal-only. Do not use. Expand a variable and strip the flags # not suitable to extension builders.