From 60f52e68e91c2aa3a40e84d42643362a84f8d42b Mon Sep 17 00:00:00 2001 From: EvgeniyPatlan Date: Mon, 30 Mar 2026 13:13:35 +0300 Subject: [PATCH] Consolidate duplicated cmake flags in MySQL DEB packaging using shared variable The debug and release build sections in rules.in and deb_debug.cmake contained two near-identical cmake invocations with the same flags repeated. Any cmake flag change required updating both places. Extract the common cmake flags into a CMAKE_COMMON_FLAGS Make variable in rules.in, referenced by both the release build block and the debug build block generated from deb_debug.cmake. Each build now contains only its unique flags (build type, compilation comment, PGO profile, maintainer mode). This also fixes two issues in the original debug cmake block: - MYSQL_MAINTAINER_MODE=0 was listed twice (lines 31 and 43) - INSTALL_DOCDIR was set explicitly but is unnecessary since INSTALL_LAYOUT=DEB already defines it --- packaging/deb-in/deb_debug.cmake | 17 ++--------------- packaging/deb-in/rules.in | 28 ++++++++++++++++------------ 2 files changed, 18 insertions(+), 27 deletions(-) diff --git a/packaging/deb-in/deb_debug.cmake b/packaging/deb-in/deb_debug.cmake index 2e0742adc261..645f2e5db454 100644 --- a/packaging/deb-in/deb_debug.cmake +++ b/packaging/deb-in/deb_debug.cmake @@ -25,24 +25,11 @@ SET (DEB_RULES_DEBUG_CMAKE " mkdir debug && cd debug && \\ cmake .. \\ - -DBUILD_CONFIG=mysql_release \\ - -DCMAKE_INSTALL_PREFIX=/usr \\ -DCMAKE_BUILD_TYPE=Debug \\ -DMYSQL_MAINTAINER_MODE=0 \\ - -DINSTALL_DOCDIR=share/mysql/docs \\ - -DINSTALL_LIBDIR=lib/$(DEB_HOST_MULTIARCH) \\ - -DSYSCONFDIR=/etc/mysql \\ - -DMYSQL_UNIX_ADDR=/var/run/mysqld/mysqld.sock \\ - -DWITH_MECAB=system \\ - -DWITH_ZLIB=${DEB_ZLIB_OPTION} \\ - -DWITH_NUMA=ON \\ + $(CMAKE_COMMON_FLAGS) \\ -DCOMPILATION_COMMENT=\"MySQL ${DEB_PRODUCTNAMEC} - ${DEB_LICENSENAME} - Debug\" \\ - -DCOMPILATION_COMMENT_SERVER=\"MySQL ${DEB_PRODUCTNAMEC} Server - ${DEB_LICENSENAME} - Debug\" \\ - -DINSTALL_LAYOUT=DEB \\ - -DREPRODUCIBLE_BUILD=OFF \\ - -DMYSQL_MAINTAINER_MODE=0 \\ - -DDEB_PRODUCT=${DEB_PRODUCT} \\ - ${DEB_CMAKE_EXTRAS} + -DCOMPILATION_COMMENT_SERVER=\"MySQL ${DEB_PRODUCTNAMEC} Server - ${DEB_LICENSENAME} - Debug\" ") SET (DEB_RULES_DEBUG_MAKE diff --git a/packaging/deb-in/rules.in b/packaging/deb-in/rules.in index 497ab64d7179..629790437df4 100644 --- a/packaging/deb-in/rules.in +++ b/packaging/deb-in/rules.in @@ -41,16 +41,8 @@ else endif -override_dh_auto_configure: - @echo "RULES.$@" - - @DEB_RULES_DEBUG_CMAKE@ - - @DEB_RULES_PROFILE_GENERATE@ - - mkdir release && cd release && \ - cmake .. \ - $(PROFILE) \ +# Common cmake flags shared between debug and release builds +CMAKE_COMMON_FLAGS = \ -DBUILD_CONFIG=mysql_release \ -DCMAKE_INSTALL_PREFIX=/usr \ -DINSTALL_LIBDIR=lib/$(DEB_HOST_MULTIARCH) \ @@ -59,13 +51,25 @@ override_dh_auto_configure: -DWITH_MECAB=system \ -DWITH_ZLIB=@DEB_ZLIB_OPTION@ \ -DWITH_NUMA=ON \ - -DCOMPILATION_COMMENT="MySQL @DEB_PRODUCTNAMEC@ - @DEB_LICENSENAME@" \ - -DCOMPILATION_COMMENT_SERVER="MySQL @DEB_PRODUCTNAMEC@ Server - @DEB_LICENSENAME@" \ -DINSTALL_LAYOUT=DEB \ -DREPRODUCIBLE_BUILD=OFF \ -DDEB_PRODUCT=@DEB_PRODUCT@ \ @DEB_CMAKE_EXTRAS@ +override_dh_auto_configure: + @echo "RULES.$@" + + @DEB_RULES_DEBUG_CMAKE@ + + @DEB_RULES_PROFILE_GENERATE@ + + mkdir release && cd release && \ + cmake .. \ + $(PROFILE) \ + $(CMAKE_COMMON_FLAGS) \ + -DCOMPILATION_COMMENT="MySQL @DEB_PRODUCTNAMEC@ - @DEB_LICENSENAME@" \ + -DCOMPILATION_COMMENT_SERVER="MySQL @DEB_PRODUCTNAMEC@ Server - @DEB_LICENSENAME@" + touch $@ override_dh_auto_build: