From d4860608d4bf4d47c3054ab971dd26df0d0eca89 Mon Sep 17 00:00:00 2001 From: Changcheng Liu Date: Mon, 8 Nov 2021 20:55:42 +0800 Subject: [PATCH] BUILD/RPM: enable build rpm with optional debug function Signed-off-by: Changcheng Liu --- contrib/buildrpm.sh | 7 +++++++ ucx.spec.in | 21 ++++++++++++++++----- 2 files changed, 23 insertions(+), 5 deletions(-) diff --git a/contrib/buildrpm.sh b/contrib/buildrpm.sh index 7b958199431..06aed875f49 100755 --- a/contrib/buildrpm.sh +++ b/contrib/buildrpm.sh @@ -12,6 +12,7 @@ rpmopts="--buildroot='${WS}/_rpm'" opt_tarball=0 opt_srcrpm=0 opt_binrpm=0 +opt_dbgrpm=0 opt_no_dist=0 opt_no_deps=0 defines="" @@ -21,6 +22,7 @@ while test "$1" != ""; do --tarball|-t) opt_tarball=1 ;; --srcrpm|-s) opt_srcrpm=1 ;; --binrpm|-b) opt_binrpm=1 ;; + --dbgrpm|-d) opt_dbgrpm=1 ;; --no-dist) opt_no_dist=1 ;; --nodeps) opt_no_deps=1 ;; --define|-d) defines="$defines --define '$2'"; shift ;; @@ -33,6 +35,7 @@ Valid arguments: --tarball|-t Create tarball --srcrpm|-s Create src.rpm --binrpm|-b Create bin.rpm +--dbgrpm|-d Create bin.rpm with debug function --no-dist Undefine %{dist} tag --nodeps Ignore build-time dependencies --define|-d Add a define to rpmbuild @@ -49,6 +52,10 @@ if [ $opt_no_dist -eq 1 ]; then rpmmacros="$rpmmacros '--undefine=dist'" fi +if [ $opt_dbgrpm -eq 1 ]; then + rpmmacros="--define 'debug 1' ${rpmmacros}" +fi + if [ $opt_no_deps -eq 1 ]; then rpmopts="$rpmopts --nodeps" fi diff --git a/ucx.spec.in b/ucx.spec.in index 98c79e59fd3..a0e1f7ac8f2 100644 --- a/ucx.spec.in +++ b/ucx.spec.in @@ -17,7 +17,7 @@ Name: ucx Version: @VERSION@ -Release: 1%{?dist}%{?devel:.devel} +Release: 1%{?dist}%{?debug:.debug} Summary: UCX is a communication library implementing high-performance messaging Group: System Environment/Libraries @@ -63,6 +63,9 @@ BuildRequires: xpmem-devel %if %{with java} BuildRequires: maven %endif +%if "%{debug}" == "1" +BuildRequires: valgrind-devel +%endif %description UCX stands for Unified Communication X. UCX provides an optimized communication @@ -94,10 +97,18 @@ Provides header files and examples for developing with UCX. %define _with_arg() %{expand:%%{?with_%{1}:--with-%{2}}%%{!?with_%{1}:--without-%{2}}} %define _enable_arg() %{expand:%%{?with_%{1}:--enable-%{2}}%%{!?with_%{1}:--disable-%{2}}} %configure --disable-optimizations \ - %{!?devel:--disable-logging} \ - %{!?devel:--disable-debug} \ - %{!?devel:--disable-assertions} \ - %{!?devel:--disable-params-check} \ + %{!?debug:--disable-logging} \ + %{!?debug:--disable-debug} \ + %{!?debug:--disable-assertions} \ + %{!?debug:--disable-params-check} \ + %{!?debug:--disable-params-check} \ + %{?debug:--with-valgrind} \ + %{?debug:--enable-profiling} \ + %{?debug:--enable-frame-pointer} \ + %{?debug:--enable-stats} \ + %{?debug:--enable-fault-injection} \ + %{?debug:--enable-debug-data} \ + %{?debug:--enable-mt} \ %_enable_arg cma cma \ %_with_arg cuda cuda \ %_with_arg gdrcopy gdrcopy \