Skip to content

Commit

Permalink
BUILD/RPM: enable build rpm with optional debug function
Browse files Browse the repository at this point in the history
Signed-off-by: Changcheng Liu <jerrliu@nvidia.com>
  • Loading branch information
changchengx committed Nov 11, 2021
1 parent 644cdae commit d486060
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 5 deletions.
7 changes: 7 additions & 0 deletions contrib/buildrpm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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=""
Expand All @@ -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 ;;
Expand All @@ -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 <arg> Add a define to rpmbuild
Expand All @@ -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
Expand Down
21 changes: 16 additions & 5 deletions ucx.spec.in
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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 \
Expand Down

0 comments on commit d486060

Please sign in to comment.