File libiscsi.spec of Package libiscsi
%define realname libiscsi
%define realver 1.20.2
%define srcext tar.gz
%define so_ver 11
# turn off the generation of debuginfo rpm (RH9) ??
%global debug_package %{nil}
# Common info
Name: %{realname}%{?so_ver}
Version: %{realver}
Release: wiz%{?extraver:0.}1%{?dist}
License: LGPL-2.1-or-later
Group: System/Libraries
URL: https://github.com/sahlberg/libiscsi
Summary: ISCSI client library
# Install-time parameters
Provides: %{realname}
# Build-time parameters
BuildRequires: autoconf automake libtool
BuildRequires: pkg-config
%if 0%{?suse_version}
BuildRequires: libxslt-tools libxml2-tools docbook-xsl-stylesheets
%endif
%if 0%{?rhel}
BuildRequires: libxslt docbook-style-xsl
%endif
Source0: https://codeload.github.com/sahlberg/libiscsi/%{srcext}/refs/tags/%{realver}#/%{realname}-%{realver}%{?extraver}.%{srcext}
%description
Libiscsi is a clientside library to implement the iSCSI protocol
that can be used to access resource of an iSCSI Target.
The library is fully async with regards to iscsi commands and scsi
tasks, but a sync layer is also provided for ease of use for simpler
applications.
%package -n %{realname}-utils
License: GPL-2.0-or-later
Group: Productivity/Networking/Other
Summary: CLI utilities for %{realname}
Provides: isci-utils
%description -n %{realname}-utils
Some utilities for %{realname}
%package -n %{realname}-devel
License: LGPL-2.1-or-later
Group: Development/Languages/C and C++
Summary: Development files for %{name}
Requires: %{name} = %{version}-%{release}
Provides: %{name}-devel = %{version}-%{release}
%description -n %{realname}-devel
Development files for %{name}
# Preparation step (unpackung and patching if necessary)
%prep
%setup -q -n %{realname}-%{realver}
test -d m4 || mkdir m4
autoreconf -f -i
%build
_CFLAGS='%{optflags} %{?gcc_lto}'
_LDFLAGS='-Wl,--as-needed -Wl,--strip-all -Wl,--no-undefined -Wl,-z,noexecstack -Wl,-z,now -Wl,-z,relro %{?gcc_lto}'
%configure \
--disable-static \
--disable-werror \
CFLAGS="$_CFLAGS" \
LDFLAGS="$_LDFLAGS"
%{__make} %{?_smp_mflags}
%install
%{__make} install DESTDIR=%{buildroot}
%clean
[ "%{buildroot}" != "/" ] && %{__rm} -rf %{buildroot}
%files
%defattr(-,root,root)
%license LICENCE-LGPL-2.1.txt
%doc README.md
%{_libdir}/%{realname}.so.%{?so_ver}*
%files -n %{realname}-utils
%defattr(-,root,root)
%license LICENCE-GPL-2.txt
%doc README.md
%{_bindir}/iscsi-*
%doc %{_mandir}/man1/*
# Development stuff
%files -n %{realname}-devel
%defattr(-,root,root)
%{_libdir}/pkgconfig/%{realname}.pc
%{_includedir}/iscsi/
%{_libdir}/%{realname}.so
%exclude %{_libdir}/*.la
%post -p /sbin/ldconfig
%postun -p /sbin/ldconfig
%changelog