File kronosnet.spec of Package kronosnet

%define realname kronosnet
%define srcext   tar.xz

%define so_ver   1

%if 0%{?suse_version} >= 1230 || 0%{?rhel} >= 7
%bcond_without systemd
%else
%bcond_with systemd
%endif

# Common info
Name:          kronosnet
Version:       1.8
Release:       wiz%{?extraver:0.}1%{?dist}
License:       GPL-2.0+
Group:         Productivity/Clustering/Computing
URL:           https://kronosnet.org/
Summary:       VPNs on steroids

# Install-time parameters
Provides:      knet = %{version}-%{release}
Obsoletes:     knet < %{version}-%{release}

# Build-time parameters
BuildRequires: pkg-config
BuildRequires: autoconf automake libtool
BuildRequires: pkgconfig(nss)
BuildRequires: pkgconfig(libcrypto) >= 1.1
BuildRequires: pkgconfig(liblz4)
BuildRequires: pkgconfig(liblzma)
BuildRequires: pkgconfig(libqb)
BuildRequires: pkgconfig(libxml-2.0)
BuildRequires: pkgconfig(libnl-3.0)
BuildRequires: zlib-devel
BuildRequires: lzo-devel >= 2.0
%if 0%{?suse_version}
BuildRequires: libbz2-devel
%else
BuildRequires: bzip2-devel
%endif
# Documentation
BuildRequires: doxygen
BuildRoot:     %{_tmppath}/%{name}-root
Source:        https://kronosnet.org/releases/%{name}-%{version}%{?extraver}.%{srcext}

%description
Kronosnet, often referred to as knet, is a network abstraction layer designed
for High Availability use cases, where redundancy, security, fault tolerance and
fast fail-over are the core requirements of your application.

%package -n libknet%{?so_ver}
License:       LGPL-2.1+
Group:         Productivity/Clustering/Computing
Summary:       Shared library of %{name}

%description -n libknet%{?so_ver}
Kronosnet, often referred to as knet, is a network abstraction layer designed
for High Availability use cases, where redundancy, security, fault tolerance and
fast fail-over are the core requirements of your application.

This package provides shared library of Kronosnet.

%package -n libnozzle%{?so_ver}
License:       LGPL-2.1+
Group:         Productivity/Clustering/Computing
Summary:       Library to manage a pool of tap devices

%description -n libnozzle%{?so_ver}
Kronosnet, often referred to as knet, is a network abstraction layer designed
for High Availability use cases, where redundancy, security, fault tolerance and
fast fail-over are the core requirements of your application.

This package provides a library to manage a pool of tap devices.

%package -n libknet-devel
License:       LGPL-2.1+
Group:         Development/Languages/C and C++
Summary:       Development files for %{name}
Requires:      libknet%{?so_ver} = %{version}-%{release}
Provides:      libknet%{?so_ver}-devel = %{version}-%{release}
Provides:      %{name}-devel

%description -n libknet-devel
Kronosnet, often referred to as knet, is a network abstraction layer designed
for High Availability use cases, where redundancy, security, fault tolerance and
fast fail-over are the core requirements of your application.

This package provides headers for Kronosnet shared library.

%package -n libnozzle-devel
License:       LGPL-2.1+
Group:         Development/Languages/C and C++
Summary:       Development files for libnozzle
Requires:      libnozzle%{?so_ver} = %{version}-%{release}
Provides:      libnozzle%{?so_ver}-devel = %{version}-%{release}

%description -n libnozzle-devel
Kronosnet, often referred to as knet, is a network abstraction layer designed
for High Availability use cases, where redundancy, security, fault tolerance and
fast fail-over are the core requirements of your application.

This package provides headers for library managing a pool of tap devices.

# Preparation step (unpackung and patching if necessary)
%prep
%setup -q -n %{realname}-%{version}%{?extraver}
if [ ! -x configure ]; then
    test -x autogen.sh && ./autogen.sh || autoreconf --force --install
fi

%build
%{__sed} -ri 's/Default-Start:/& 2 3 5/' init/*.in
%configure \
 --disable-static \
 \
 --disable-libknet-sctp \
 --enable-libnozzle \
 CFLAGS="%{optflags} %{gcc_lto}" \
 CXXFLAGS="%{optflags} %{gcc_lto}" \
 LDFLAGS="-Wl,--as-needed -Wl,--strip-all -Wl,--no-undefined -Wl,-z,now -Wl,-z,relro %{gcc_lto}"
%{__make} %{?_smp_mflags}

%install
%{__make} install DESTDIR=%{buildroot}
[ "%{buildroot}" != "/" ] && %{__rm} -rf %{buildroot}%{_datadir}/doc

%clean
[ "%{buildroot}" != "/" ] && rm -rf %{buildroot}

%files -n libknet%{?so_ver}
%defattr(-,root,root)
%doc COPYING.libraries COPYRIGHT README README.licence
%{_libdir}/libknet.so.%{so_ver}*
%dir %{_libdir}/kronosnet
%{_libdir}/kronosnet/*.so
%exclude %{_libdir}/libknet.la
%exclude %{_libdir}/kronosnet/*.la

%files -n libnozzle%{?so_ver}
%defattr(-,root,root)
%doc COPYING.libraries COPYRIGHT README README.licence
%{_libdir}/libnozzle.so.%{so_ver}*
%exclude %{_libdir}/libnozzle.la

%files -n libknet-devel
%defattr(-,root,root)
%doc COPYING.applications COPYRIGHT README README.licence
%{_libdir}/pkgconfig/libknet.pc
%{_includedir}/libknet.h
%{_libdir}/libknet.so
%doc %{_mandir}/man3/knet_*

%files -n libnozzle-devel
%defattr(-,root,root)
%doc COPYING.applications COPYRIGHT README README.licence
%{_libdir}/pkgconfig/libnozzle.pc
%{_includedir}/libnozzle.h
%{_libdir}/libnozzle.so
%doc %{_mandir}/man3/nozzle_*

%post   -n libknet%{?so_ver} -p /sbin/ldconfig
%postun -n libknet%{?so_ver} -p /sbin/ldconfig

%post   -n libnozzle%{?so_ver} -p /sbin/ldconfig
%postun -n libnozzle%{?so_ver} -p /sbin/ldconfig

%changelog
openSUSE Build Service is sponsored by