%global common_desc \
Dibbler is a portable DHCPv6 implementation. It supports stateful (i.e. IPv6 \
address granting and IPv6 prefix delegation) as well as stateless (i.e. option \
granting) autoconfiguration for IPv6.
 
%if 0%{?rhel} < 7 && 0%{?rhel} > 0
%global _pkgdocdir %{_docdir}/%{name}
%endif
 
Name:		dibbler
Version:	1.0.1
Release:	1%{?dist}
Summary:	Portable DHCPv6 implementation
 
License:	GPLv2
URL:		https://github.com/tomaszmrugalski/dibbler
Source0:        http://klub.com.pl/dhcpv6/dibbler/dibbler-%{version}.tar.gz
 
BuildRequires:  gcc-c++
%description
%{common_desc}
 
 
%package client
Summary:	Dibbler, DHCPv6 client
 
 
%description client
%{common_desc}
 
This package contains DHCPv6 client.
 
 
%package relay
Summary:	Dibbler, DHCPv6 relay
 
 
%description relay
%{common_desc}
 
This package contains DHCPv6 relay.
 
 
%package requestor
Summary:	Dibbler, DHCPv6 request generator
 
 
%description requestor
%{common_desc}
 
This package contains DHCPv6 request generator.
 
 
%package server
Summary:	Dibbler, DHCPv6 server
 
 
%description server
%{common_desc}
 
This package contains DHCPv6 server.
 
 
%package docs
Summary:	Dibbler documentation
BuildArch:	noarch
 
 
%description docs
%{common_desc}
 
This package contains dibbler documentation.
 
 
%prep
%setup -q -n dibbler-%{version}
 
 
%build
%configure
make %{?_smp_mflags}
 
 
%install
make install DESTDIR=%{buildroot}
 
# We explicitly add license file to each sub-package, so no need to install it
# as documentation
rm %{buildroot}%{_pkgdocdir}/LICENSE
 
# Setup directories
install -p -d -m 755 %{buildroot}%{_sharedstatedir}/dibbler
install -p -d -m 755 %{buildroot}%{_sysconfdir}/dibbler
 
# Install configuration files
for config in client relay server; do
    cp -p doc/examples/$config.conf %{buildroot}%{_sysconfdir}/dibbler
done
 
# Kill example files irrelevant to Fedora Linux
for file in client-win32.conf server-win32.conf; do
    rm %{buildroot}%{_pkgdocdir}/examples/$file
done
 
for file in client-notify-bsd.sh client-notify-macos.sh; do
    rm %{buildroot}%{_pkgdocdir}/scripts/notify-scripts/$file
done
 
 
%files client
%license LICENSE
%{_sbindir}/dibbler-client
%{_mandir}/man8/dibbler-client.8*
%dir %{_sysconfdir}/dibbler
%config(noreplace) %{_sysconfdir}/dibbler/client.conf
%dir %{_sharedstatedir}/dibbler
 
 
%files relay
%license LICENSE
%{_sbindir}/dibbler-relay
%{_mandir}/man8/dibbler-relay.8*
%dir %{_sysconfdir}/dibbler
%config(noreplace) %{_sysconfdir}/dibbler/relay.conf
%dir %{_sharedstatedir}/dibbler
 
 
%files requestor
%license LICENSE
%{_sbindir}/dibbler-requestor
%dir %{_sharedstatedir}/dibbler
 
 
%files server
%license LICENSE
%{_sbindir}/dibbler-server
%{_mandir}/man8/dibbler-server.8*
%dir %{_sysconfdir}/dibbler
%config(noreplace) %{_sysconfdir}/dibbler/server.conf
%dir %{_sharedstatedir}/dibbler
 
 
%files docs
%license LICENSE
%dir %{_pkgdocdir}
%{_pkgdocdir}/CHANGELOG
%{_pkgdocdir}/RELNOTES
%{_pkgdocdir}/dibbler-user.pdf
%dir %{_pkgdocdir}/examples
%dir %{_pkgdocdir}/scripts
%{_pkgdocdir}/examples/*.conf
%{_pkgdocdir}/scripts/*

%changelog
* Tue Feb 23 2021 liusheng <liusheng2048@gmail.com>
- Initial package

