On Mon, Jan 2, 2017 at 10:56 AM, Florian Weimer <fwei...@redhat.com> wrote:
> The final values of CFLAGS/LDFLAGS/… are set (as shell variables) by the
> %configure macro.  There is no other immediately obvious way to get those
> definitions.  This means that if you can't use %configure for some reason,
> you are out of luck.
>
> In this situation, this still works:
>
> %global %_configure :
> %configure
>
> As a result, %configure tries to run “:” instead of “./configure”, which is
> a NOP, and only the shell variable initialization remains.
>
> Is this the recommend way to initialize the compiler flags?
export CFLAGS="%{__global_cflags}"
export CXXFLAGS="%{__global_cxxflags}"
export LDFLAGS="%{__global_ldflags}"
and others (e.g. fortran flags)

It's not really portable way (it most likely will not work on other
RPM-based distros, but who cares). RPM itself define only %optflags.
export CFLAGS="${CFLAGS:-%__global_cflags}"
export CXXFLAGS="${CXXFLAGS:-%__global_cxxflags}"
export FFLAGS="${FFLAGS:-%__global_fflags}"
export FCFLAGS="${FCFLAGS:-%__global_fcflags}"
export LDFLAGS="${LDFLAGS:-%__global_ldflags}"
>
> Should we introduce a %setup_cflags macro to make this more explicit?
Would be helpful to not copy-paste exports over buildsystems.
>
> Thanks,
> Florian
> _______________________________________________
> devel mailing list -- devel@lists.fedoraproject.org
> To unsubscribe send an email to devel-le...@lists.fedoraproject.org



-- 
-Igor Gnatenko
_______________________________________________
devel mailing list -- devel@lists.fedoraproject.org
To unsubscribe send an email to devel-le...@lists.fedoraproject.org

Reply via email to