File infiniband-diags.spec of Package infiniband-diags

#
# spec file for package infiniband-diags
#
# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
#
# 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 http://bugs.opensuse.org/
#


Name:           infiniband-diags
Summary:        OpenFabrics Alliance InfiniBand Diagnostic Tools
License:        GPL-2.0 or BSD-2-Clause
Group:          Productivity/Networking/Diagnostic
Version:        1.6.7
Release:        0
Source0:        https://www.openfabrics.org/downloads/management/%{name}-%{version}.tar.gz
Source99:       %{name}-rpmlintrc
Patch2:         infiniband-diags-help_for_ibnodes.patch
Url:            http://www.openfabrics.org
BuildRequires:  autoconf
BuildRequires:  automake
BuildRequires:  glib2-devel
BuildRequires:  libibmad-devel
BuildRequires:  libtool
BuildRequires:  opensm-devel
BuildRequires:  pkg-config
BuildRequires:  rdma-core-devel
BuildRequires:  systemd-rpm-macros
BuildRequires:  pkgconfig(libudev)
Requires:       perl = %{perl_version}

%define so_major 5

%description
diags provides IB diagnostic programs and scripts needed to diagnose an
IB subnet.

%package    -n libibnetdisc%{so_major}
Summary:        Infiniband Net Discovery runtime library
Group:          System/Libraries

%description -n libibnetdisc%{so_major}
This package contains the Infiniband Net Discovery runtime library needed
mainly by infiniband-diags.


%package devel
BuildRequires:  libibmad-devel
BuildRequires:  opensm-devel
BuildRequires:  rdma-core-devel
Requires:       %name = %version
Summary:        OpenIB InfiniBand Diagnostic Tools SDK
Group:          Development/Libraries/C and C++
Provides:       infiniband-diags:%{_libdir}/libibnetdisc.so

%description devel
diags provides IB diagnostic programs and scripts needed to diagnose an
IB subnet. This package contains all files needed for development.

%prep
%setup -q
# rename to silence automake
%patch2

# Avoid unnecessary rebuilds of the package
FAKE_BUILDDATE=$(LC_ALL=C date -u -r %{_sourcedir}/%{name}.changes '+%%b %%e %%Y')
FAKE_BUILDTIME=$(LC_ALL=C date -u -r %{_sourcedir}/%{name}.changes '+%%H:%%M:%%S')
sed -i -e "s/__DATE__/\"$FAKE_BUILDDATE\"/" -e "s/__TIME__/\"$FAKE_BUILDTIME\"/" src/ibdiag_common.c

%build
autoreconf -fi
export CFLAGS="%{optflags}"
%configure --with-perl-installdir=%{perl_vendorarch} --disable-static
make %{?_smp_mflags} V=1

%install
make DESTDIR=%buildroot install
rm -f %{buildroot}%{_libdir}/*.la
#Remove rdma-ndd stuff which is provided by rdma-core
rm -f %{buildroot}%{_sbindir}/rdma-ndd
rm -f %{buildroot}%{_unitdir}/rdma-ndd.service
rm -f %{buildroot}%{_mandir}/man8/rdma-ndd.8*

%post -n libibnetdisc%{so_major} -p /sbin/ldconfig
%postun -n libibnetdisc%{so_major} -p /sbin/ldconfig

%files
%defattr(-, root, root)
%doc COPYING README ChangeLog
%config %{_sysconfdir}/infiniband-diags/error_thresholds
%dir %{_sysconfdir}/infiniband-diags
%config(noreplace) %{_sysconfdir}/infiniband-diags/*
%_sbindir/*
%_mandir/man8/*
%_mandir/man3/*
%{perl_vendorarch}/IBswcountlimits.pm

%files -n libibnetdisc%{so_major}
%defattr(-, root, root)
%{_libdir}/*.so.*

%files devel
%defattr(-, root, root)
%{_includedir}/infiniband/*.h
%{_libdir}/*.so

%changelog
openSUSE Build Service is sponsored by