public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
From: Michal Schorm <mschorm@redhat.com>
To: git-commits@fedoraproject.org
Subject: [rpms/mariadb-connector-c] f44: [bugfix] Fix debug build flag overrides using package-specific macros
Date: Thu, 25 Jun 2026 18:19:37 GMT	[thread overview]
Message-ID: <178241157744.1.3337855078697501227.rpms-mariadb-connector-c-e8e07befbe81@fedoraproject.org> (raw)

            A new commit has been pushed.

            Repo   : rpms/mariadb-connector-c
            Branch : f44
            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=f44

            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

                 reply	other threads:[~2026-06-25 18:19 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=178241157744.1.3337855078697501227.rpms-mariadb-connector-c-e8e07befbe81@fedoraproject.org \
    --to=mschorm@redhat.com \
    --cc=git-commits@fedoraproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox