File aiccu.spec of Package aiccu

#
# spec file for package aiccu
#
# Copyright (c) 2015 SUSE LINUX 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/
#


Name:           aiccu
Version:        20070115
Release:        0
Summary:        Automatic IPv6 Connectivity Client Utility
License:        BSD-3-Clause
Group:          Productivity/Networking/Routing
Url:            http://www.sixxs.net/tools/aiccu/
Source0:        http://www.sixxs.net/archive/sixxs/aiccu/unix/%{name}_%{version}.tar.gz
Source1:        aiccu.init
Source2:        aiccu.service
Patch0:         %{name}_%{version}.dif
Patch1:         %{name}_%{version}-sigaction.dif
Patch2:         aiccu-linkorder.dif
Patch3:         aiccu-pthread.dif
Patch4:         aiccu-systemd.dif
# patch from https://github.com/maximeh/buildroot/tree/master/package/aiccu
Patch5:         gnutls-and-uclibc-fixes.patch
BuildRequires:  gnutls-devel
Requires:       iproute2
Requires:       iputils
Requires:       module-init-tools
Requires:       net-tools
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
%if 0%{?suse_version} >= 1210
BuildRequires:  pkg-config
BuildRequires:  systemd-devel
BuildRequires:  pkgconfig(systemd)
%systemd_requires
%else
Requires(pre):  %fillup_prereq
Requires(pre):  %insserv_prereq
%endif

%description
AICCU -- Automatic IPv6 Connectivity Client Utility, makes it easy for
users to get IPv6 connectivity at http://www.sixxs.net/. After having
requested an account, tunnel and optionally a subnet, AICCU can be used
to automatically configure the tunnel.
AICCU supports TIC (Tunnel Information & Control protocol), which it
uses for retrieving the tunnel configuration information, AYIYA, which
allows tunnels to be created even behind firewalls and NAT's.

%prep
%setup -q -n %{name}
%patch0
%patch1
%patch2
%patch3
%if 0%{?suse_version} >= 1210
%patch4
%endif
%patch5 -p1

%build
RPM_OPT_FLAGS="%{optflags} -fPIE -pie"
export RPM_OPT_FLAGS
%if 0%{?suse_version} > 1210
make HAVE_SYSTEMD=1 %{?_smp_mflags}
%else
make %{?_smp_mflags}
%endif

%install
install -d -m 0755 %{buildroot}/%{_sbindir}
install -d -m 0755 %{buildroot}/%{_mandir}/man1
chmod 0644 doc/*
make install DESTDIR=%{buildroot} dirdoc=%{_defaultdocdir}/%{name}/ %{?_smp_mflags}
install -m0644  doc/aiccu.1 %{buildroot}/%{_mandir}/man1/

%if 0%{?suse_version} > 1210
install -D -m 0755  %{SOURCE2} %{buildroot}/%{_unitdir}/%{name}.service
ln -s  	%{_sbindir}/service %{buildroot}%{_sbindir}/rc%{name}
rm -rf 	%{buildroot}/%{_sysconfdir}/init.d/%{name}
%else
install -D -m 0755  %{SOURCE1} %{buildroot}/%{_sysconfdir}/init.d/%{name}
ln -s	%{_sysconfdir}/init.d/%{name} %{buildroot}/%{_sbindir}/rc%{name}
%endif

%pre
%if 0%{?suse_version} >= 1210
%service_add_pre %{name}.service
%endif

%post
%if 0%{?suse_version} >= 1210
%service_add_post %{name}.service
%else
%fillup_and_insserv %{name}
%endif

%preun
%if 0%{?suse_version} >= 1210
%service_del_preun %{name}.service
%else
%stop_on_removal %{name}
%endif

%postun
%if 0%{?suse_version} >= 1210
%service_del_postun %{name}.service
%else
%restart_on_update %{name}
%insserv_cleanup
%endif

%files
%defattr(-,root,root)
%doc doc/changelog
%doc doc/COPYRIGHT
%doc doc/LICENSE
%doc doc/README
%doc doc/HOWTO
%attr(0640,root,root) %config(noreplace) %{_sysconfdir}/aiccu.conf
%attr(0755,root,root) %{_sbindir}/aiccu
%if 0%{?suse_version} > 1210
%attr(0644,root,root) %{_unitdir}/%{name}.service
%else
%attr(0755,root,root) %config %{_sysconfdir}/init.d/%{name}
%endif
%attr(0755,root,root) %{_sbindir}/rcaiccu
%attr(0644,root,root) %{_mandir}/man1/aiccu.1*

%changelog
openSUSE Build Service is sponsored by