public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [rpms/mariadb-connector-c] rawhide: [bugfix] Fix debug build flag overrides using package-specific macros
@ 2026-06-24  8:08 Michal Schorm
  0 siblings, 0 replies; only message in thread
From: Michal Schorm @ 2026-06-24  8:08 UTC (permalink / raw)
  To: git-commits

            A new commit has been pushed.

            Repo   : rpms/mariadb-connector-c
            Branch : rawhide
            Commit : e8e07befbe81f26e98008e4572c18125de806197
            Author : Michal Schorm <mschorm@redhat.com>
            Date   : 2026-06-24T00:40:24+02:00
            Stats  : +7/-8 in 1 file(s)
            URL    : https://src.fedoraproject.org/rpms/mariadb-connector-c/c/e8e07befbe81f26e98008e4572c18125de806197?branch=rawhide

            Log:
            [bugfix] Fix debug build flag overrides using package-specific macros

The old approach exported 'CFLAGS'/'CXXFLAGS' AFTER '%cmake' had already
configured the build, so the '-O0' flags were never actually picked up
by CMake. The flags were set too late in the build process.

Use the new '%_pkg_extra_cflags' / '%_pkg_extra_cxxflags' /
'%_pkg_extra_fflags' macros introduced in Fedora 43
(Changes/Package-specific_RPM_Macros_For_Build_Flags).
These are expanded inside '%{build_cflags}' before '%cmake' runs, so the
flags are correctly passed to CMake at configure time. GCC's "last flag
wins" behavior means '-O0' after '-O2' produces the intended '-O0' build.

https://fedoraproject.org/wiki/Changes/Package-specific_RPM_Macros_For_Build_Flags

Co-Authored-By: Claude AI <noreply@anthropic.com>

---
diff --git a/mariadb-connector-c.spec b/mariadb-connector-c.spec
index ee37077..31869ea 100644
--- a/mariadb-connector-c.spec
+++ b/mariadb-connector-c.spec
@@ -3,6 +3,13 @@
 # Enable building and packing of the testsuite
 %bcond_without  testsuite
 
+# Override all optimization flags when making a debug build
+%if %{with debug}
+%global _pkg_extra_cflags   -O0 -g
+%global _pkg_extra_cxxflags -O0 -g
+%global _pkg_extra_fflags   -O0 -g
+%endif
+
 
 
 Name:           mariadb-connector-c
@@ -134,14 +141,6 @@ rm -r win win-iconv external/zlib
        -DWITH_UNIT_TESTS=ON
 %endif
 
-# Override all optimization flags when making a debug build
-%if %{with debug}
-CFLAGS="$CFLAGS     -O0 -g"; export CFLAGS
-CXXFLAGS="$CXXFLAGS -O0 -g"; export CXXFLAGS
-FFLAGS="$FFLAGS     -O0 -g"; export FFLAGS
-FCFLAGS="$FCFLAGS   -O0 -g"; export FCFLAGS
-%endif
-
 cmake -B %__cmake_builddir -LAH
 
 %cmake_build

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-06-24  8:08 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-06-24  8:08 [rpms/mariadb-connector-c] rawhide: [bugfix] Fix debug build flag overrides using package-specific macros Michal Schorm

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox