File umr.spec of Package umr

#
# spec file for package umr
#
# Copyright (c) 2024 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via https://bugs.opensuse.org/
#


%global _lto_cflags %{?_lto_cflags} -ffat-lto-objects
%global optflags %optflags %{_lto_cflags}

%if 0%{?suse_version} <= 1315
%{error: This package cannot be built on SLE 12.x or older}
%endif

Name:           umr
Version:        1.0.10
Release:        0
Summary:        User Mode Register Debugger for AMDGPU Hardware
License:        MIT
Group:          Development/Tools/Other
URL:            https://gitlab.freedesktop.org/tomstdenis/umr
Source0:        https://gitlab.freedesktop.org/tomstdenis/umr/-/archive/%{version}/%{name}-%{version}.tar.gz
Patch0:         0000-re-add-installing-headers-and-libraries.patch

BuildRequires:  cmake >= 3.15
BuildRequires:  gcc-c++
BuildRequires:  fdupes
BuildRequires:  libedit-devel
BuildRequires:  libdrm-devel
BuildRequires:  libgbm-devel
BuildRequires:  libpciaccess-devel
BuildRequires:  libxml2-devel
BuildRequires:  libzstd-devel
BuildRequires:  llvm-devel
BuildRequires:  ncurses-devel
BuildRequires:  Mesa-libEGL-devel
BuildRequires:  Mesa-libGL-devel
BuildRequires:  SDL2-devel

# Server requires nanomsg --> Leap >= 15.5 || Tumbleweed
%if 0%{?sle_version} >= 150500 || 0%{?suse_version} > 1600
BuildRequires:  nanomsg-devel
%endif


%description
umr is a userspace debugging and diagnostic tool for AMD GPUs using
the AMDGPU kernel driver with limited support for driverless debugging
(via PCI direct access).

The tool allows reading/writing MMIO registers, analyzing wavefronts,
ring contents, as well as performance tracking.  It supports hardware
from SI based hardware onwards and requires a v4.10 kernel or newer
to function correctly.  Older kernels (not older than v4.8) may work
but with limited functionality/stability.  Older kernels are not supported
officially so please refrain from submitting bug reports in relation
to them.

# bash completion requires SLE > 12.5
%package bash-completion
Summary:        Bash Completion for %{name}
Group:          System/Shells
Requires:       %{name} = %{version}
Requires:       bash-completion
Supplements:    (%{name} and bash-completion)
BuildArch:      noarch

%description bash-completion
Bash command line completion support for %{name}.

%package devel-static
Summary:        Header files and static libs for umr
Group:          Development/Libraries/C and C++
Requires:       %{name} = %{version}
Obsoletes:	    %{name}-devel < %{version}

%description devel-static
Headers and static libs for UMR


%prep
%autosetup -p1

%build
%cmake \
  -DBUILD_SHARED_LIBS=OFF \
  -DUMR_GUI:BOOL=ON \
%if 0%{?sle_version} >= 150500 || 0%{?suse_version} > 1600
  -DUMR_SERVER:BOOL=ON \
%else
  -DUMR_SERVER:BOOL=OFF \
%endif

%cmake_build

%install
%cmake_install
%fdupes %{?buildroot}

%files
%doc README
%license LICENSE
%{_bindir}/%{name}
%{_bindir}/umrtest
%{_datadir}/%{name}
%{_mandir}/man?/%{name}.?%{?ext_man}
%{_bindir}/%{name}gui

%files bash-completion
%{_datadir}/bash-completion/completions/%{name}

%files devel-static
%{_includedir}/umr.h
%{_includedir}/umrapp.h
%{_includedir}/umr_rumr.h
%{_libdir}/libumrlow.a
%{_libdir}/libumrcore.a

%changelog
openSUSE Build Service is sponsored by