From Fedora Project Wiki
Line 50: Line 50:
== Detailed Description ==
== Detailed Description ==
<!-- Expand on the summary, if appropriate.  A couple sentences suffices to explain the goal, but the more details you can provide the better. -->
<!-- Expand on the summary, if appropriate.  A couple sentences suffices to explain the goal, but the more details you can provide the better. -->
The %set_build_flags macro exports common environment variables used for building packages:
* CFLAGS
* CXXFLAGS
* FFLAGS
* FCFLAGS
* LDFLAGS
* LT_SYS_LIBRARY_PATH
* CC
* CXX
These environment variables are set to the list of compiler flags defined in the system RPM configuration.  This macro is currently implicitly called when packages use some of the build system helper macros, like %configure, %cmake, and %meson.  However, not all packages use these macros and so some packages do not use the correct compiler flags as required by the Fedora packaging guidelines[1].
This change will be implemented by updating the %__spec_build_pre and %__speck_check_pre macros in redhat-rpm-config to include %set_build_flags.  See the proposed implementation for more details.
The purpose for making this change in both the %build and %check sections is because sometimes test code gets built in the %check sections for unittests and this will ensure that the application code and its tests are built with the same set of flags.
[1] https://docs.fedoraproject.org/en-US/packaging-guidelines/#_compiler_flags


== Feedback ==
== Feedback ==

Revision as of 03:13, 4 December 2021

Important.png
Comments and Explanations
The page source contains comments providing guidance to fill out each section. They are invisible when viewing this page. To read it, choose the "view source" link.
Copy the source to a new page before making changes! DO NOT EDIT THIS TEMPLATE FOR YOUR CHANGE PROPOSAL.
Idea.png
Guidance
For details on how to fill out this form, see the documentation.


%set_build_flags for %build and %check

Summary

Call %set_build_flags macro automatically at the beginning of the %build and %check phases of RPM builds in Fedora Linux.

Owner


Current status

  • Targeted release: Fedora Linux 36
  • Last updated: 2021-12-04
  • FESCo issue: <will be assigned by the Wrangler>
  • Tracker bug: <will be assigned by the Wrangler>
  • Release notes tracker: <will be assigned by the Wrangler>

Detailed Description

The %set_build_flags macro exports common environment variables used for building packages:

  • CFLAGS
  • CXXFLAGS
  • FFLAGS
  • FCFLAGS
  • LDFLAGS
  • LT_SYS_LIBRARY_PATH
  • CC
  • CXX

These environment variables are set to the list of compiler flags defined in the system RPM configuration. This macro is currently implicitly called when packages use some of the build system helper macros, like %configure, %cmake, and %meson. However, not all packages use these macros and so some packages do not use the correct compiler flags as required by the Fedora packaging guidelines[1].

This change will be implemented by updating the %__spec_build_pre and %__speck_check_pre macros in redhat-rpm-config to include %set_build_flags. See the proposed implementation for more details.

The purpose for making this change in both the %build and %check sections is because sometimes test code gets built in the %check sections for unittests and this will ensure that the application code and its tests are built with the same set of flags.


[1] https://docs.fedoraproject.org/en-US/packaging-guidelines/#_compiler_flags

Feedback

Benefit to Fedora

Scope

  • Proposal owners:
  • Other developers:
  • Policies and guidelines: N/A (not needed for this Change)
  • Trademark approval: N/A (not needed for this Change)
  • Alignment with Objectives:

Upgrade/compatibility impact

How To Test

User Experience

Dependencies

Contingency Plan

  • Contingency mechanism: (What to do? Who will do it?) N/A (not a System Wide Change)
  • Contingency deadline: N/A (not a System Wide Change)
  • Blocks release? N/A (not a System Wide Change), Yes/No


Documentation

N/A (not a System Wide Change)

Release Notes