File opensm.spec of Package opensm

#
# spec file for package opensm (Version 3.3.16)
#
# Copyright (c) 2009-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/
#

%if %{?_with_console_socket:1}%{!?_with_console_socket:0}
%define _enable_console_socket --enable-console-socket
%endif
%if %{?_without_console_socket:1}%{!?_without_console_socket:0}
%define _disable_console_socket --disable-console-socket
%endif

%if %{?_with_perf_mgr:1}%{!?_with_perf_mgr:0}
%define _enable_perf_mgr --enable-perf-mgr
%endif
%if %{?_without_perf_mgr:1}%{!?_without_perf_mgr:0}
%define _disable_perf_mgr --disable-perf-mgr
%endif

%if %{?_with_event_plugin:1}%{!?_with_event_plugin:0}
%define _enable_event_plugin --enable-default-event-plugin
%endif
%if %{?_without_event_plugin:1}%{!?_without_event_plugin:0}
%define _disable_event_plugin --disable-default-event-plugin
%endif

%if %{?_with_node_name_map:1}%{!?_with_node_name_map:0}
%define _enable_node_name_map --with-node-name-map%{?_with_node_name_map}
%endif

Name:           opensm
Summary:        Infiniband Subnet Manager
Version:        3.3.17
Release:        0
License:        BSD-2-Clause or GPL-2.0
Group:          Productivity/Networking/System
Source0:        http://www.openfabrics.org/downloads/management/%{name}-%{version}.tar.gz
Source1:        conf.sysconfig
Source2:        sldd.sh
Source3:        opensmd
Patch0:         opensm-autotools.patch
Patch1:         opensm-type_punning.patch
Url:            http://www.openfabrics.org
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildRequires:  bison flex
BuildRequires:  gcc-c++
BuildRequires:  libibumad-devel libibverbs-devel
BuildRequires:  libtool automake autoconf
PreReq:         %fillup_prereq
Requires:       logrotate

%define so_major 3
%define opensm_libname libs%{so_major}


%description
OpenSM provides an implementation for an InfiniBand Subnet Manager and
Administration. Such a software entity is required to run for in order
to initialize the InfiniBand hardware (at least one per each InfiniBand
subnet).

%package        %{opensm_libname}
Group:          System/Libraries
Summary:        Opensm runtime libraries

%description  %{opensm_libname}
This package contains the opensm runtime libraries.

%package        devel
Group:          Development/Libraries/C and C++
Summary:        Development files for OpenSM
Requires:       %{name}-%{opensm_libname} = %{version} libibumad-devel

%description devel
Symlinks for the dynamic libraries and header files for OpenSM.

%package        devel-static
Group:          Development/Libraries/C and C++
Summary:        Static libraries for OpenSM
Requires:       %{name}-devel = %{version}

%description devel-static 
Static libraries and for OpenSM.

%prep
%setup -q
%patch0
%patch1

cp %{S:1} %{S:2} %{S:3} .
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\"/" opensm/osm_console.c

%build
autoreconf -fi
%configure \
        %{?_enable_console_socket} \
        %{?_disable_console_socket} \
        %{?_enable_perf_mgr} \
        %{?_disable_perf_mgr} \
        %{?_enable_event_plugin} \
        %{?_disable_event_plugin} \
        %{?_enable_node_name_map}
make %{?_smp_mflags} V=1

%install
export NO_BRP_STALE_LINK_ERROR=yes
make DESTDIR=%{buildroot} install
install -D -m 644 scripts/opensm.logrotate %{buildroot}%{_sysconfdir}/logrotate.d/opensm

# get rid of the included init script because we bring our own one
rm %{buildroot}%_sysconfdir/init.d/opensmd
install -m 755 opensmd %{buildroot}%_sysconfdir/init.d/
install -D sldd.sh %{buildroot}/%_bindir/sldd.sh
ln -s %_sysconfdir/init.d/opensmd %{buildroot}%{_sbindir}/rcopensmd

# install the sysconfig configuration file
install -m 644 -D conf.sysconfig %{buildroot}/var/adm/fillup-templates/sysconfig.%name

# and make a compat link
ln -s %_sysconfdir/sysconfig/opensm %{buildroot}/%_sysconfdir/opensm.conf
sed -i -e 's$-L/usr/src/packages/BUILD/%{name}-%{version}/complib$$g' %{buildroot}%{_libdir}/libosmvendor.la

%post
%{fillup_only}

%post %{opensm_libname} -p /sbin/ldconfig

%preun
%stop_on_removal opensmd

%postun
%restart_on_update opensmd
%insserv_cleanup

%postun %{opensm_libname} -p /sbin/ldconfig

%files
%defattr(-, root, root)
%_sysconfdir/opensm.conf
%doc COPYING
%_sysconfdir/init.d/opensmd
%config %_sysconfdir/logrotate.d/opensm
%_bindir/*
%_sbindir/*
%_mandir/man5/torus-2QoS.conf.5.gz
%_mandir/man8/torus-2QoS.8.gz
%_mandir/man8/opensm.8.gz
%_mandir/man8/osmtest.8.gz
/var/adm/fillup-templates/sysconfig.%name

%files %{opensm_libname}
%defattr(-, root, root)
%_libdir/libopensm.so.*
%_libdir/libosmcomp.so.*
%_libdir/libosmvendor.so.*

%files devel
%defattr(-,root,root)
%_includedir/infiniband/complib/
%_includedir/infiniband/iba/
%_includedir/infiniband/opensm/
%_includedir/infiniband/vendor/
%_libdir/libopensm.so
%_libdir/libosmcomp.so
%_libdir/libosmvendor.so

%files devel-static
%defattr(-,root,root)
%_libdir/libopensm.a
%_libdir/libopensm.la
%_libdir/libosmcomp.a
%_libdir/libosmcomp.la
%_libdir/libosmvendor.a
%_libdir/libosmvendor.la

%changelog
openSUSE Build Service is sponsored by