File infiniband-diags.spec of Package infiniband-diags

#
# spec file for package infiniband-diags
#
# Copyright (c) 2011-2014 SUSE LINUX Products 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/
#

# norootforbuild


Name:           infiniband-diags
Summary:        OpenIB InfiniBand Diagnostic Tools
Version:        1.6.4
Release:        0
License:        GPL-2.0 or BSD-2-Clause
Group:          Productivity/Networking/Diagnostic
Source0:        %{name}-%{version}.tar.gz
Patch0:         infiniband-diags-configure.patch
Patch1:         infiniband-diags-automake_foreign.patch
Patch2:         infiniband-diags-help_for_ibnodes.patch
Url:            http://www.openfabrics.org
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildRequires:  glib2-devel libibverbs-devel libibmad-devel libibumad-devel opensm-devel
BuildRequires:  automake autoconf libtool pkg-config
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}
Group:         System/Libraries
Summary:       Infiniband Net Discovery runtime library

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


%package devel
Group:         Development/Libraries/C and C++
BuildRequires:  libibmad-devel libibumad-devel libibverbs-devel opensm-devel
Requires:       %name = %version
Summary:        OpenIB InfiniBand Diagnostic Tools SDK
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.

%package       devel-static
Group:         Development/Libraries/C and C++
Requires:      %name = %version
Summary:       Development package OpenIB InfiniBand Diagnostic Tools

%description devel-static
diags provides IB diagnostic programs and scripts needed to diagnose an
IB subnet. This package contains the static library.

%prep
%setup -q
%patch0
%patch1
%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}
make %{?_smp_mflags} V=1

%install
make DESTDIR=%buildroot install
#install -d %%buildroot/%%{perl_vendorarch}
#mv %%buildroot/usr/lib/perl/IBswcountlimits.pm %%buildroot/%%{perl_vendorarch}/IBswcountlimits.pm

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

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

%files
%defattr(-, root, root)
%doc COPYING
%config %{_sysconfdir}/infiniband-diags/error_thresholds
%dir %{_sysconfdir}/infiniband-diags
%config %{_sysconfdir}/infiniband-diags/ibdiag.conf
%_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

%files devel-static
%defattr(-, root, root)
%{_libdir}/*.a
%{_libdir}/*.la

%changelog
openSUSE Build Service is sponsored by