Add conditional debug build support to configure Modifies configure script to optionally enable debug-related compile options: - --enable-debug - --enable-profiling - --enable-cassert - --enable-debug-extensions These flags are enabled when ENABLE_DEBUG=true is set in the environment. This provides flexibility to generate both debug and non-debug builds from the same script, defaulting to non-debug builds.
diff --git a/build_automation/cloudberry/scripts/configure-cloudberry.sh b/build_automation/cloudberry/scripts/configure-cloudberry.sh index 8c14243..587ba10 100755 --- a/build_automation/cloudberry/scripts/configure-cloudberry.sh +++ b/build_automation/cloudberry/scripts/configure-cloudberry.sh
@@ -51,6 +51,14 @@ # # Optional Environment Variables: # LOG_DIR - Directory for logs (defaults to ${SRC_DIR}/build-logs) +# ENABLE_DEBUG - Enable debug build options (true/false, defaults to +# false) +# +# When true, enables: +# --enable-debug +# --enable-profiling +# --enable-cassert +# --enable-debug-extensions # # Prerequisites: # - System dependencies must be installed: @@ -106,14 +114,20 @@ export LD_LIBRARY_PATH=/usr/local/cloudberry-db/lib:LD_LIBRARY_PATH log_section_end "Environment Setup" +# Add debug options if ENABLE_DEBUG is set to "true" +CONFIGURE_DEBUG_OPTS="" + +if [ "${ENABLE_DEBUG:-false}" = "true" ]; then + CONFIGURE_DEBUG_OPTS="--enable-debug \ + --enable-profiling \ + --enable-cassert \ + --enable-debug-extensions" +fi + # Configure build log_section "Configure" execute_cmd ./configure --prefix=/usr/local/cloudberry-db \ - --enable-debug \ - --enable-profiling \ --disable-external-fts \ - --enable-cassert \ - --enable-debug-extensions \ --enable-gpcloud \ --enable-ic-proxy \ --enable-mapreduce \ @@ -121,6 +135,7 @@ --enable-orca \ --enable-pxf \ --enable-tap-tests \ + ${CONFIGURE_DEBUG_OPTS} \ --with-gssapi \ --with-ldap \ --with-libxml \
diff --git a/scripts/build-rpm.sh b/scripts/build-rpm.sh index 1c2b0d8..3f070da 100755 --- a/scripts/build-rpm.sh +++ b/scripts/build-rpm.sh
@@ -87,8 +87,8 @@ shift ;; *) - echo "Unknown option: $1" - usage + echo "Unknown option: ($1)" + shift ;; esac done @@ -115,8 +115,6 @@ RPMBUILD_CMD="rpmbuild -bb \"$SPEC_FILE\" --define \"version $VERSION\" --define \"release $RELEASE\"" if [ "$DEBUG_BUILD" = true ]; then RPMBUILD_CMD+=" --with debug" -else - RPMBUILD_CMD+=" --without debug" fi # Dry-run mode