File mtr.spec of Package mtr

#
# spec file for package mtr
#
# 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:           mtr
Version:        0.86
Release:        0
Summary:        Ping and Traceroute Network Diagnostic Tool
License:        GPL-2.0
Group:          Productivity/Networking/Diagnostic
Url:            http://www.BitWizard.nl/mtr
Source:         ftp://ftp.bitwizard.nl/mtr/%{name}-%{version}.tar.gz
Source1:        xmtr.desktop
Patch1:         mtr-0.75-manmtr.patch
Patch2:         mtr-0.86-manxmtr.patch
Patch3:         mtr-0.75-nonvoid.patch
Patch4:         mtr-0.75-sec_snprintf.patch
Patch5:         mtr-0.82-capabilities.patch
# PATCH-FIX-UPSTREAM bnc#933854 kstreitova@suse.com -- fix mtr crash with --xml option
Patch6:         mtr-0.85-crash-with-xml-option.patch
BuildRequires:  automake
BuildRequires:  gtk2-devel
BuildRequires:  libcap-devel
BuildRequires:  ncurses-devel
BuildRequires:  update-desktop-files
BuildRequires:  xorg-x11-devel
Requires(post): permissions
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
Mtr is a network diagnostic tool that combines Ping and Traceroute into
one program. This package contains the mtr version with an ncurses
interface, in other words, the text mode version is usable in a shell
(telnet or SSH session, for example).

Find the graphical version in the mtr-gtk package.

%package gtk
Summary:        Ping and Traceroute Network Diagnostic Tool
Group:          Productivity/Networking/Diagnostic
Requires:       xdg-utils

%description gtk
Mtr is a network diagnostic tool which combines Ping and Traceroute
into one program. This package contains mtr with a GTK interface.
You'll find the text mode version in the mtr package.

%prep
%setup -q
cp mtr.8 xmtr.8
%patch1
%patch2 -p1
%patch3
%patch4
%patch5 -p1
%patch6 -p1

%build
autoreconf -vi

export CFLAGS="%{optflags} -fpie -fPIE"
export LDFLAGS="-pie -Wl,-z,relro,-z,now"

%configure \
	--enable-ipv6 \
	--with-gtk \
	--disable-gtktest
make %{?_smp_mflags}
mv mtr xmtr
make distclean %{?_smp_mflags}
#
# console version
%configure \
	--enable-ipv6 \
	--without-gtk
make %{?_smp_mflags}

%install
mkdir -p %{buildroot}%{_sbindir}
mkdir -p %{buildroot}/%{_mandir}/man8
make DESTDIR=%{buildroot} install %{?_smp_mflags}
install -m 4755 xmtr %{buildroot}%{_sbindir}
install -m 644 xmtr.8 %{buildroot}/%{_mandir}/man8
install -d -m 755 %{buildroot}%{_includedir}/X11/pixmaps/
install -m 644 img/mtr_icon.xpm %{buildroot}%{_includedir}/X11/pixmaps/xmtr_icon.xpm
install -d -m 755 %{buildroot}%{_datadir}/pixmaps/
install -m 644 img/mtr_icon.xpm %{buildroot}%{_datadir}/pixmaps/xmtr_icon.xpm
%suse_update_desktop_file -i xmtr Network Monitor

%files
%defattr(-,root,root)
%doc AUTHORS COPYING FORMATS NEWS README SECURITY TODO
%doc %{_mandir}/man8/mtr.8*
%verify(not mode caps) %attr(750,root,dialout) %{_sbindir}/mtr

%files gtk
%defattr(-,root,root)
%doc AUTHORS COPYING FORMATS NEWS README SECURITY TODO
%doc %{_mandir}/man8/xmtr.8*
%verify(not mode caps) %attr(750,root,dialout) %{_sbindir}/xmtr
%{_includedir}/X11/pixmaps
%{_datadir}/applications/*
%{_datadir}/pixmaps/*

%post
%set_permissions %{_sbindir}/mtr
%set_permissions %{_sbindir}/xmtr

%verifyscript
%verify_permissions -e %{_sbindir}/mtr
%verify_permissions -e %{_sbindir}/xmtr

%changelog
openSUSE Build Service is sponsored by