From 92274bd9cc016cf236f3ba6ba1170aa722a6e066bbc499a8930fb91b0be9bd7b Mon Sep 17 00:00:00 2001 From: Dirk Mueller Date: Thu, 26 Oct 2023 06:40:59 +0000 Subject: [PATCH] Accepting request 1119169 from home:jengelh:branches:devel:tools:building - Stick -DNDEBUG back into CMAKE_C_FLAGS. Can't find a spontaneous resolution for projects relying on its presence. OBS-URL: https://build.opensuse.org/request/show/1119169 OBS-URL: https://build.opensuse.org/package/show/devel:tools:building/cmake?expand=0&rev=551 --- cmake.changes | 6 ++++++ cmake.macros | 17 +++++++++++------ 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/cmake.changes b/cmake.changes index fb97e2c..2845b14 100644 --- a/cmake.changes +++ b/cmake.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Fri Oct 20 07:25:25 UTC 2023 - Jan Engelhardt + +- Stick -DNDEBUG back into CMAKE_C_FLAGS. Can't find a spontaneous + resolution for projects relying on its presence. + ------------------------------------------------------------------- Fri Oct 13 08:06:23 UTC 2023 - Paolo Stivanin diff --git a/cmake.macros b/cmake.macros index 3fb5f11..1fb9674 100644 --- a/cmake.macros +++ b/cmake.macros @@ -10,6 +10,11 @@ %__cmake_make_prefix_relative() %{lua:print((string.gsub((rpm.expand("%1")), ((rpm.expand("%{_prefix}")) .. "/"), "", 1)))} %__cmake_make_root_relative() %{lua:print((string.gsub((rpm.expand("%1")), "/", "", 1)))} +# +# Some cmake-using software has an unfortunate reliance on -DNDEBUG being +# present (when cmake is used without explicitly selecting a build type or +# cflags). Cf. https://bugzilla.redhat.com/show_bug.cgi?id=1692426 +# %cmake \ find %__sourcedir -type f -name CMakeLists.txt \\\ -exec sed -i -re '/^[[:blank:]]*[sS][eE][tT][[:blank:]]*\\\([[:blank:]]*(CMAKE_BUILD_TYPE|CMAKE_COLOR_MAKEFILE|CMAKE_INSTALL_PREFIX|CMAKE_VERBOSE_MAKEFILE).*\\\)/{s/^/#IGNORE /}' {} + \ @@ -37,12 +42,12 @@ -DSYSCONF_INSTALL_DIR:PATH=%{_sysconfdir} \\\ -DSHARE_INSTALL_PREFIX:PATH=%{_datadir} \\\ -DCMAKE_BUILD_TYPE=RelWithDebInfo \\\ - -DCMAKE_C_FLAGS="${CFLAGS:-%optflags}" \\\ - -DCMAKE_C_FLAGS_RELWITHDEBINFO="${CFLAGS:-%optflags}" \\\ - -DCMAKE_CXX_FLAGS="${CXXFLAGS:-%optflags}" \\\ - -DCMAKE_CXX_FLAGS_RELWITHDEBINFO="${CXXFLAGS:-%optflags}" \\\ - -DCMAKE_Fortran_FLAGS="${FFLAGS:-%optflags%{?_fmoddir: -I%_fmoddir}}" \\\ - -DCMAKE_Fortran_FLAGS_RELWITHDEBINFO="${FFLAGS:-%optflags%{?_fmoddir: -I%_fmoddir}}" \\\ + -DCMAKE_C_FLAGS="-DNDEBUG ${CFLAGS:-%optflags}" \\\ + -DCMAKE_C_FLAGS_RELWITHDEBINFO="-DNDEBUG ${CFLAGS:-%optflags}" \\\ + -DCMAKE_CXX_FLAGS="${CXXFLAGS:--DNDEBUG %optflags}" \\\ + -DCMAKE_CXX_FLAGS_RELWITHDEBINFO="${CXXFLAGS:--DNDEBUG %optflags}" \\\ + -DCMAKE_Fortran_FLAGS="${FFLAGS:--DNDEBUG %optflags%{?_fmoddir: -I%_fmoddir}}" \\\ + -DCMAKE_Fortran_FLAGS_RELWITHDEBINFO="${FFLAGS:--DNDEBUG %optflags%{?_fmoddir: -I%_fmoddir}}" \\\ -DCMAKE_EXE_LINKER_FLAGS="%{?build_ldflags} -Wl,--as-needed -Wl,-z,now" \\\ -DCMAKE_MODULE_LINKER_FLAGS="%{?build_ldflags} -Wl,--as-needed" \\\ -DCMAKE_SHARED_LINKER_FLAGS="%{?build_ldflags} -Wl,--as-needed -Wl,-z,now" \\\