commit:     18e0de0e6777e2210f505e3cc6640326cba799e1
Author:     Eli Schwartz <eschwartz93 <AT> gmail <DOT> com>
AuthorDate: Mon Mar 11 01:25:07 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Mon Mar 11 14:22:47 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=18e0de0e

dev-db/mydumper: use a real patch to fix ignored CFLAGS

Using seds just ended up nastily failing to do anything:

 * SED: the following did not cause any changes
 *     sed -i -e 's|-O3 -g -Werror|${CMAKE_C_FLAGS}|' CMakeLists.txt || die;
 * no-op: -e s|-O3 -g -Werror|${CMAKE_C_FLAGS}|

But patch files are reliable since they will die if they don't apply
anymore.

Closes: https://bugs.gentoo.org/894494
Signed-off-by: Eli Schwartz <eschwartz93 <AT> gmail.com>
Signed-off-by: Sam James <sam <AT> gentoo.org>

 ...per-0.14-Do-not-overwrite-the-user-CFLAGS.patch | 29 ++++++++++++++++++++++
 ...per-0.15-Do-not-overwrite-the-user-CFLAGS.patch | 25 +++++++++++++++++++
 dev-db/mydumper/mydumper-0.14.5.2.ebuild           |  7 +++---
 dev-db/mydumper/mydumper-0.15.2.8.ebuild           |  5 ++--
 4 files changed, 59 insertions(+), 7 deletions(-)

diff --git 
a/dev-db/mydumper/files/mydumper-0.14-Do-not-overwrite-the-user-CFLAGS.patch 
b/dev-db/mydumper/files/mydumper-0.14-Do-not-overwrite-the-user-CFLAGS.patch
new file mode 100644
index 000000000000..fe5fc15378d8
--- /dev/null
+++ b/dev-db/mydumper/files/mydumper-0.14-Do-not-overwrite-the-user-CFLAGS.patch
@@ -0,0 +1,29 @@
+From a7630737a37c11478de265e69605befa89b910b4 Mon Sep 17 00:00:00 2001
+From: Eli Schwartz <[email protected]>
+Date: Sun, 10 Mar 2024 21:12:29 -0400
+Subject: [PATCH] Do not overwrite the user CFLAGS
+
+---
+ CMakeLists.txt | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 088811c..c051a31 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -35,10 +35,10 @@ if (WITH_ZSTD)
+ endif (WITH_ZSTD)
+ 
+ if (WITH_ZSTD)
+-  set(CMAKE_C_FLAGS "-Wall -Wno-deprecated-declarations -Wunused 
-Wwrite-strings -Wno-strict-aliasing -Wextra -Wshadow -g -DZWRAP_USE_ZSTD=1 
-Werror -Wno-discarded-qualifiers ${MYSQL_CFLAGS}")
++  set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wno-deprecated-declarations 
-Wunused -Wwrite-strings -Wextra -Wshadow -DZWRAP_USE_ZSTD=1 
-Wno-discarded-qualifiers ${MYSQL_CFLAGS}")
+   include_directories(${MYDUMPER_SOURCE_DIR} ${MYSQL_INCLUDE_DIR} 
${GLIB2_INCLUDE_DIR} ${PCRE_INCLUDE_DIR} ${ZLIB_INCLUDE_DIRS} 
${ZSTD_INCLUDE_DIR} )
+ else (WITH_ZSTD)
+-  set(CMAKE_C_FLAGS "-Wall -Wno-deprecated-declarations -Wunused 
-Wwrite-strings -Wno-strict-aliasing -Wextra -Wshadow -g -Werror 
${MYSQL_CFLAGS}")
++  set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wno-deprecated-declarations 
-Wunused -Wwrite-strings -Wextra -Wshadow ${MYSQL_CFLAGS}")
+   include_directories(${MYDUMPER_SOURCE_DIR} ${MYSQL_INCLUDE_DIR} 
${GLIB2_INCLUDE_DIR} ${PCRE_INCLUDE_DIR} ${ZLIB_INCLUDE_DIRS} )
+ endif (WITH_ZSTD)
+ 
+-- 
+2.43.2
+

diff --git 
a/dev-db/mydumper/files/mydumper-0.15-Do-not-overwrite-the-user-CFLAGS.patch 
b/dev-db/mydumper/files/mydumper-0.15-Do-not-overwrite-the-user-CFLAGS.patch
new file mode 100644
index 000000000000..5d6ba09a4df4
--- /dev/null
+++ b/dev-db/mydumper/files/mydumper-0.15-Do-not-overwrite-the-user-CFLAGS.patch
@@ -0,0 +1,25 @@
+From 925d052aa05cf7d97fe474d7cf64b8491ced68ae Mon Sep 17 00:00:00 2001
+From: Eli Schwartz <[email protected]>
+Date: Sun, 10 Mar 2024 21:17:16 -0400
+Subject: [PATCH] Do not overwrite the user CFLAGS
+
+---
+ CMakeLists.txt | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 1fbf228..7741aa9 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -39,7 +39,7 @@ if (MARIADB_FOUND AND NOT MARIADB_SSL AND WITH_SSL)
+     set(WITH_SSL OFF)
+ endif()
+ 
+-set(CMAKE_C_FLAGS "-std=gnu99 -Wall -Wno-deprecated-declarations -Wunused 
-Wwrite-strings -Wno-strict-aliasing -Wextra -Wshadow -g -Werror 
${MYSQL_CFLAGS}")
++set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu99 -Wall 
-Wno-deprecated-declarations -Wunused -Wwrite-strings -Wextra -Wshadow 
${MYSQL_CFLAGS}")
+ include_directories(${MYDUMPER_SOURCE_DIR} ${MYSQL_INCLUDE_DIR} 
${GLIB2_INCLUDE_DIR} ${PCRE_INCLUDE_DIR} ${ZLIB_INCLUDE_DIRS} )
+ 
+ OPTION(WITH_ASAN "Build with ASAN" OFF)
+-- 
+2.43.2
+

diff --git a/dev-db/mydumper/mydumper-0.14.5.2.ebuild 
b/dev-db/mydumper/mydumper-0.14.5.2.ebuild
index 8777ec59b286..844529b624db 100644
--- a/dev-db/mydumper/mydumper-0.14.5.2.ebuild
+++ b/dev-db/mydumper/mydumper-0.14.5.2.ebuild
@@ -1,4 +1,4 @@
-# Copyright 1999-2023 Gentoo Authors
+# Copyright 1999-2024 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI=8
@@ -30,12 +30,11 @@ BDEPEND="virtual/pkgconfig
 
 PATCHES=(
        "${FILESDIR}/${PN}-0.13.1-atomic.patch" #654314
+
+       "${FILESDIR}"/${PN}-0.14-Do-not-overwrite-the-user-CFLAGS.patch
 )
 
 src_prepare() {
-       # respect user cflags; do not expand ${CMAKE_C_FLAGS} (!)
-       sed -i -e 's|-O3 -g -Werror|${CMAKE_C_FLAGS}|' CMakeLists.txt || die
-
        # fix doc install path
        sed -i -e "s|share/doc/mydumper|share/doc/${PF}|" docs/CMakeLists.txt 
|| die
 

diff --git a/dev-db/mydumper/mydumper-0.15.2.8.ebuild 
b/dev-db/mydumper/mydumper-0.15.2.8.ebuild
index 1a99e5e9f244..49dc02ff90ea 100644
--- a/dev-db/mydumper/mydumper-0.15.2.8.ebuild
+++ b/dev-db/mydumper/mydumper-0.15.2.8.ebuild
@@ -30,12 +30,11 @@ BDEPEND="virtual/pkgconfig
 
 PATCHES=(
        "${FILESDIR}/${PN}-0.13.1-atomic.patch" #654314
+
+       "${FILESDIR}"/${PN}-0.15-Do-not-overwrite-the-user-CFLAGS.patch
 )
 
 src_prepare() {
-       # respect user cflags; do not expand ${CMAKE_C_FLAGS} (!)
-       sed -i -e 's|-g -Werror|${CMAKE_C_FLAGS}|' CMakeLists.txt || die
-
        # fix doc install path
        sed -i -e "s|share/doc/mydumper|share/doc/${PF}|" docs/CMakeLists.txt 
|| die
 

Reply via email to