File trickle.spec of Package trickle

#
# spec file for package trickle
#
# Copyright (c) 2016 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:           trickle
Version:        1.07
Release:        0
Summary:        Portable lightweight userspace bandwidth shaper
License:        BSD-3-Clause
Group:          Productivity/Networking/System
Url:            https://github.com/mariusae/trickle
Source0:        %{name}-%{version}.tar.gz
Source1:        %{name}d.conf
Patch0:         %{name}-%{version}-include_netdb.patch
Patch1:         %{name}-%{version}-libdir.patch
Patch2:         %{name}-%{version}-CVE-2009-0415.patch
Patch3:         %{name}-%{version}-bwsta_getdelay-stop-if-no-packets.patch
# Fedora specific: https://bugzilla.redhat.com/show_bug.cgi?id=1037366
Patch4:         %{name}-%{version}-err-Werror=format-security.patch
BuildRequires:  libevent-devel
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
trickle is a portable lightweight userspace bandwidth shaper.
It can run in collaborative mode or in stand alone mode.

trickle works by taking advantage of the unix loader preloading.
Essentially it provides, to the application,
a new version of the functionality that is required
to send and receive data through sockets.
It then limits traffic based on delaying the sending
and receiving of data over a socket.
trickle runs entirely in userspace and does not require root privileges.

%prep
%setup -q
%patch0 -p1 -b .include_netdb
%patch1 -p1 -b .libdir
%patch2 -p1 -b .cve
%patch3 -p1
%patch4 -p1 -b .err-Werror=format-security.patch
touch -r configure aclocal.m4 Makefile.in stamp-h.in

iconv -f ISO88591 -t UTF8 < README > README.UTF8
mv README.UTF8 README

%build
%configure
make # %{?_smp_mflags} Parallel make is unsafe for this package, so %%{?_smp_mflags} is not used


%install
make DESTDIR=%{buildroot} install %{?_smp_mflags}
# for rpmlint warning : unstripped-binary-or-object
chmod +x %{buildroot}%{_libdir}/%{name}/%{name}-overload.so
mkdir -p %{buildroot}%{_sysconfdir}
install -m 644 -p %{SOURCE1} %{buildroot}%{_sysconfdir}


%files
%defattr(-,root,root,-)
%doc LICENSE README TODO
%dir %{_libdir}/%{name}
%config(noreplace) %{_sysconfdir}/%{name}d.conf
%{_bindir}/%{name}
%{_bindir}/%{name}ctl
%{_bindir}/%{name}d
%{_libdir}/%{name}/%{name}-overload.so
%{_mandir}/man1/%{name}.1.gz
%{_mandir}/man5/%{name}d.conf.5.gz
%{_mandir}/man8/%{name}d.8.gz

%changelog
openSUSE Build Service is sponsored by