File sblim-smis-hba.spec of Package sblim-smis-hba

#
# spec file for package sblim-smis-hba
#
# Copyright (c) 2012 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/
#


%define cmpi_provider_dir %{_libdir}/cmpi

BuildRoot:      %{_tmppath}/%{name}-%{version}-build

Summary:        SBLIM smis-hba Instrumentation
License:        EPL-1.0
Url:            http://sblim.wiki.sourceforge.net/
Group:          Systems Management/Instrumentation
Name:           sblim-smis-hba
Version:        1.0.0
Release:        0

#!BuildIgnore: tog-pegasus
BuildRequires:  autoconf
BuildRequires:  automake
BuildRequires:  bison
BuildRequires:  flex
BuildRequires:  gcc-c++
BuildRequires:  libHBAAPI2-devel
BuildRequires:  libidn-devel
BuildRequires:  libtool
BuildRequires:  sblim-cmpi-base-devel
BuildRequires:  sblim-cmpi-devel
BuildRequires:  sblim-sfcb
BuildRequires:  sblim-testsuite

Requires:       bind
Requires:       cim-server
Provides:       sblim-cmpi-smis-hba

Source0:        http://sourceforge.net/projects/sblim/files/providers/%{name}/%{version}/%{name}-%{version}.tar.bz2
Source1:        %{name}-tests.tar.bz2
# hbaapi.h is not below sys/, kkaempf@suse.de
Patch0:         fix-hbaapi-include-path.patch
# drop %%{version} from docdir installation, kkaempf@suse.de
Patch1:         fix-docdir.patch

%Description
The cmpi-smis-hba package provides access to the smis-hba configuration data
via CIMOM technology/infrastructure.
It contains the smis-hba CIM Model, CMPI Provider with the Samba task specific
Resource Access.

###############################################################################
%package devel
Summary:        SBLIM WBEM-SMT smis-hba - Header Development Files
Group:          Development/Libraries/C and C++
Requires:       %{name} = %{version}-%{release}

%Description devel
SBLIM WBEM-SMT smis-hba Development Package contains header files and
link libraries for dependent provider packages

###############################################################################
%package test
Summary:        SBLIM WBEM-SMT smis-hba - Testcase Files
Group:          Systems Management/Instrumentation/Test
Requires:       %{name} = %{version}-%{release}

%Description test
SBLIM WBEM-SMT smis-hba Provider Testcase Files for the SBLIM Testsuite


%prep

%setup -n %{name}-%{version}

export PATCH_GET=0

%patch0 -p0
%patch1 -p0

%build

tar xf %{S:1}

autoreconf -f -i

# SLE 10 does not recognize --docdir
#   and cannot parse || expressions :-/

%configure \
   CFLAGS="$RPM_OPT_FLAGS" \
   TESTSUITEDIR=%{_datadir}/sblim-testsuite \
   CIMSERVER=sfcb \
   PROVIDERDIR=%{_libdir}/cmpi \
%if 0%{?suse_version} > 1010
  --docdir=%{_docdir}/%{name}
%else
%if 0%{?suse_version} == 0
%if (0%{?rhel_version} >= 600) || (0%{?centos_version} >= 600)
  --docdir=%{_docdir}/%{name}-%{version}
%endif
%endif
%endif

make CFLAGS="-fno-strict-aliasing" RPM_OPT_FLAGS="$(RPM_OPT_FLAGS)" 

%clean

if [ `id -ur` != 0 ]
then
# paranoia check 
	rm -rf $RPM_BUILD_ROOT 
fi

%install

mkdir -p $RPM_BUILD_ROOT/usr/%{_lib}/cmpi
mkdir -p $RPM_BUILD_ROOT/usr/include/cmpi
mkdir -p $RPM_BUILD_ROOT/usr/share/cmpi/mof

%if 0%{?suse_version}
make install DESTDIR=$RPM_BUILD_ROOT LIBDIR=%{_lib} docdir=%{_docdir}/%{name}
%else
make install DESTDIR=$RPM_BUILD_ROOT LIBDIR=%{_lib} docdir=%{_docdir}/%{name}-%{version}
%endif

rm -f $RPM_BUILD_ROOT/%{_libdir}/*a
rm -f $RPM_BUILD_ROOT/%{_libdir}/cmpi/*a

%define SCHEMA %{_datadir}/%{name}/Linux_SMIS_ECTP.mof %{_datadir}/%{name}/Linux_SMIS_HBA_HDR.mof
%define REGISTRATION %{_datadir}/%{name}/Linux_SMIS_ECTP.reg %{_datadir}/%{name}/Linux_SMIS_HBA_HDR.reg

%define INTEROP_SCHEMAS %{_datadir}/%{name}/Linux_smis-hba_Profile.mof
%define INTEROP_REGISTRATIONS %{_datadir}/%{name}/Linux_smis-hba_Profile.registration

%pre
# definition of schema and registration files
# If upgrading, deregister old version
if [ $1 -gt 1 ]
then
  %{_datadir}/%{name}/provider-register.sh -d \
	-r %{REGISTRATION} -m %{SCHEMA} > /dev/null ||:
fi

%post
# Register Schema and Provider - this is higly provider specific
# tog-pegasus needs some schemes registered first
if [ -x /usr/bin/peg-loadmof.sh ]; then
#FIXME	peg-loadmof.sh -n root/cimv2 /usr/share/mof/cim-current/*/{%{PEGASUS_MOF}}.mof
	rctog-pegasus try-restart
fi
# and then following script can handle registration for various providers
%{_datadir}/%{name}/provider-register.sh \
	-r %{REGISTRATION} -m %{SCHEMA} > /dev/null ||:
/sbin/ldconfig

%preun
# Deregister only if not upgrading 
if [ $1 -eq 0 ]
then
  %{_datadir}/%{name}/provider-register.sh -d \
	-r %{REGISTRATION} -m %{SCHEMA} > /dev/null ||:
fi

%postun
/sbin/ldconfig
exit 0

###############################################################################
%files
%defattr(-,root,root) 
%doc NEWS README AUTHORS
%{cmpi_provider_dir}/*.so.*
%dir %{_datadir}/%{name}
%{_datadir}/%{name}

%files devel
%defattr(-,root,root) 
%{cmpi_provider_dir}/*.so

%files test
%defattr(-,root,root,0755)
%{_datadir}/sblim-testsuite/test-sblim-hba.sh
%defattr(-,root,root,0644)
%{_datadir}/sblim-testsuite/cim/Linux_*
%{_datadir}/sblim-testsuite/system/linux/Linux_*

%changelog