File libzfcphbaapi0.spec of Package libzfcphbaapi0

#
# spec file for package libzfcphbaapi0
#
# Copyright (c) 2023 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/
#


Name:           libzfcphbaapi0
BuildRequires:  autoconf
BuildRequires:  automake
BuildRequires:  doxygen
BuildRequires:  gcc-c++
BuildRequires:  libHBAAPI2-devel
BuildRequires:  libsgutils-devel
BuildRequires:  libtool
BuildRequires:  linux-glibc-devel
BuildRequires:  sysfsutils
URL:            http://hbaapi.sourceforge.net
Summary:        zfcp HBA API library
License:        CPL-1.0
Group:          System/Libraries
Version:        2.2.0
Release:        0
Source:         lib-zfcp-hbaapi-%{version}.tar.bz2
Patch0:         fix-build-errors.patch
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
ExclusiveArch:  s390 s390x
%define _zfcp_hbaapi lib-zfcp-hbaapi-%{version}

%description
The zfcp device driver is a FCP device driver for Linux for zSeries.
The whole implementation of FC-HBA for the zfcp device driver is called
zfcp HBA API. It is a shared library which provides the API defined in
FC-HBA.

Authors:
--------
    Sven Schuetz <sven@de.ibm.com> (active maintainer)
    Andreas Herrmann <aherrman@de.ibm.com>
    Stefan Voelkel <Stefan.Voelkel@millenux.com>

%prep
if file /bin/bash | grep 32-bit.*390 && [ `arch` != s390 ]; then exit 1;fi
%setup -q -n %{_zfcp_hbaapi}
%patch0 -p1
chmod a-x README ChangeLog
autoreconf -iv

%build
CFLAGS="$RPM_OPT_FLAGS" ./configure --prefix=%{_prefix} --libdir=%{_libdir} --mandir=%{_mandir} --enable-vendor-lib --disable-static
make CFLAGS="$RPM_OPT_FLAGS -fno-strict-aliasing"

%install
make DESTDIR=$RPM_BUILD_ROOT install

# Get rid of a couple unnecessary files
rm -f $RPM_BUILD_ROOT/%{_libdir}/libzfcphbaapi.la
rm -f $RPM_BUILD_ROOT/%{_libdir}/libzfcphbaapi.so

# Get rid of some "doc" files that are already in /usr/share/packages/doc
rm -f $RPM_BUILD_ROOT/usr/share/zfcp-hbaapi-2.1.1/README
rm -f $RPM_BUILD_ROOT/usr/share/zfcp-hbaapi-2.1.1/COPYING

%post
ldconfig
ORG=com.ibm.libzfcphbaapi
LIB=%{_libdir}/libzfcphbaapi.so.0
STR="$ORG       $LIB"
CONF=/etc/hba.conf
if test -f $CONF; then
    ORIG=$(sed -n "s/^[[:space:]]*$ORG[[:space:]]*\(.*\)/\1/p" $CONF)
    if [ "$ORIG" != "$LIB" ] ; then
        echo $STR >> $CONF
    else
        echo "** $CONF already configured"
        echo "** system configuration not updated"
    fi;
else
    echo "** WARNING: $CONF does not exist"
    echo "** system configuration not updated"
fi

%postun
ldconfig
CONF=/etc/hba.conf
ORG=com.ibm.libzfcphbaapi

if [ "${1}" = "0" ]; then	# Keep the entry for an upgrade, remove it for an uninstall
  if test -f $CONF; then
    sed -i -e "/^$ORG /d" $CONF
  fi
fi

%clean
rm -rf $RPM_BUILD_ROOT

%files
%defattr(-,root,root)
%{_bindir}/zfcp_*
%{_libdir}/libzfcphbaapi.so.0*
%doc README ChangeLog
%license COPYING
%doc %{_mandir}/man3/*.3.gz
%doc %{_mandir}/man8/*.8.gz
%dir /usr/share/zfcp-hbaapi-%{version}
/usr/share/zfcp-hbaapi-%{version}/*

%changelog
openSUSE Build Service is sponsored by