4.0.4-alt105 Some C compiler flags (CFLAGS) are desired for compilation, but not when running ./configure (or similar scripts). Now CFLAGS et al. environment variables are set and exported by %configure. Examples: 1. Optimization flags may be unwanted in ./configure because they slow down the tests. (Instead, something like -O0 may be wanted if this is not the default.) 2. -Werror (added to %optflags by %def_enable Werror or by other ways) make the tests in ./configure behave differently. A mechanism should be thought up to "filter" out the flags which are bad for ./configure before running ./configure, but to add them back when running make. Perhaps, exporting CFLAGS two times (with different values) would work for most packages, but I need a closer look at the packages to find this out. (A BRP check that would check that the resulting files have been compiles with flags which include all %optflags would help to see whether the new mechanism would work as expected en masse.)
Проверка актуальности: не реализовано. В rpm-build 4.0.4.214-alt1 макрос %configure по-прежнему экспортирует CFLAGS/CXXFLAGS с полным набором %optflags (включая -O2 и добавленный пакетом -Werror), механизма отбора флагов «для configure» и «для make» нет.
I'd like to add yet another data point here. In February this year I made an attempt to establish common CFLAGS, CXXFLAGS, FFLAGS, FCFLAGS and others globally (more rigorously, for each package that makes use of C, CXX or Fortran toolchains respectively), moving those assignments out from %configure and other configure-step helpers. Prior to the change the environment variables were not set for "cargo build". Turned out rust-cargo flips over and goes haywire: https://git.altlinux.org/tasks/407662/build/200/x86_64/log I was unable to locate the source of that problem in reasonable time.
(In reply to Ivan Zakharyaschev from comment #0) > Examples: > > 1. Optimization flags may be unwanted in ./configure because they slow down > the tests. (Instead, something like -O0 may be wanted if this is not the > default.) > > 2. -Werror (added to %optflags by %def_enable Werror or by other ways) make > the tests in ./configure behave differently. Isn't that a misimplemented conftest at the end of the day? :) Wouldn't it be unwise to try to fix every upstream at once in a central place?
(Ответ для Arseny Maslennikov на комментарий #2) > Prior to the change the environment variables were not set for "cargo build". > Turned out rust-cargo flips over and goes haywire: > https://git.altlinux.org/tasks/407662/build/200/x86_64/log > I was unable to locate the source of that problem in reasonable time. I will check later when I get enough free time. Open a bug for rust-cargo. As far as I know, some packages may define their own logic for handling CFLAGS, etc., or Cargo may simply has overwritten the upstream CFLAGS with the ones from the environment.