diff --git a/macros b/macros index 20abe4e..a2f5d8a 100644 --- a/macros +++ b/macros @@ -29,8 +29,9 @@ #============================================================================== # ---- configure and makeinstall. # +%_configure_libtool_hardening_hack 1 %_configure ./configure -%configure(--:-:ChnqV) \ +%configure \ CFLAGS="${CFLAGS:-%optflags}" ; export CFLAGS ; \ CXXFLAGS="${CXXFLAGS:-%optflags}" ; export CXXFLAGS ; \ FFLAGS="${FFLAGS:-%optflags -I%_fmoddir}" ; export FFLAGS ; \ @@ -39,6 +40,10 @@ for i in $(find . -name config.guess -o -name config.sub) ; do \ [ -f /usr/lib/rpm/redhat/$(basename $i) ] && %{__rm} -f $i && %{__cp} -fv /usr/lib/rpm/redhat/$(basename $i) $i ; \ done ; \ + [ "%_configure_libtool_hardening_hack" = 1 ] && [ x != "x%{_hardened_ldflags}" ] && \ + for i in $(find . -name ltmain.sh) ; do \ + %{__sed} -i.backup -e 's~compiler_flags=$~compiler_flags="%{_hardened_ldflags}"~' $i \ + done ; \ %{_configure} --build=%{_build} --host=%{_host} \\\ --program-prefix=%{?_program_prefix} \\\ --disable-dependency-tracking \\\ @@ -54,12 +59,7 @@ --localstatedir=%{_localstatedir} \\\ --sharedstatedir=%{_sharedstatedir} \\\ --mandir=%{_mandir} \\\ - --infodir=%{_infodir} \\\ - %{**} ; \ - [[ -f ./libtool && "x%{?%_hardened_ldflags}" != "x" ]] && \\\ - sed -i \\\ - -e 's! \\\\\\$compiler_flags !&%{?%_hardened_ldflags} !g' \\\ - ./libtool ; + --infodir=%{_infodir} %makeinstall \ %{__make} \\\ @@ -179,6 +179,7 @@ package or when debugging this package.\ %__find_requires /usr/lib/rpm/redhat/find-requires %_hardening_cflags -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 +# we don't escape symbols '~', '"', etc. so be careful when changing this %_hardening_ldflags -specs=/usr/lib/rpm/redhat/redhat-hardened-ld #_hardened_build 0