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.