Name: dublin-traceroute
Version: 0.4.2
Release: 5%{?dist}.4sunshine
Summary: Dublin Traceroute is a NAT-aware multipath tracerouting tool
Source0: https://github.com/insomniacslk/%{name}/archive/v%{version}.tar.gz#/%{name}-%{version}.tar.gz
Patch0: https://raw.githubusercontent.com/teknoraver/specfiles/master/%{name}/01-static.patch
Patch1: https://raw.githubusercontent.com/teknoraver/specfiles/master/%{name}/02-cond_cxx11.patch
License: BSD
BuildRequires: gcc-c++
BuildRequires: cmake%{?rhel:3}
BuildRequires: libtins-devel >= 3.4
BuildRequires: pkgconfig(jsoncpp)
BuildRequires: libpcap-devel
# FIXME why does "make" detect a target /usr/lib*/libssl.so?
BuildRequires: openssl-devel

%description
Dublin Traceroute is a NAT-aware multipath traceroute tool.

Dublin Traceroute uses the techniques invented by the authors of
Paris-traceroute to enumerate the paths of ECMP flow-based load balancing,
but introduces a new technique for NAT detection.

%prep
%autosetup -p1

%build
%if 0%{?rhel} && 0%{?rhel} < 8
%global cmake %cmake3
%global cmake_build %cmake3_build
%global cmake_install %cmake3_install
%global ctest %ctest3
%endif
%cmake
%cmake_build

%install
%cmake_install

%check
%ctest

%files
%license COPYING
%doc documentation/readme/
%caps(cap_net_raw+ep) %{_bindir}/%{name}
# FIXME how do these land in the build?
%exclude /usr/lib/
%exclude %{_includedir}/

%changelog
* Fri Sep 22 2023 Moritz Barsnick <moritz+rpm@barsnick.net> 0.4.2-5.4sunshine
- fix %%changelog
- drop the tins_include patch, it's fixed in libtins 4.5

* Fri Sep 22 2023 Moritz Barsnick <moritz+rpm@barsnick.net> 0.4.2-5.3sunshine
- rebuild for new libtins

* Tue Jan 24 2023 Moritz Barsnick <moritz+rpm@barsnick.net> 0.4.2-5.2sunshine
- add a patch tins_include to work around a buggy tins header missing an include
- BR cmake3 on RHEL/EPEL, and use their corresponding macros

* Tue Jan 24 2023 Moritz Barsnick <moritz+rpm@barsnick.net> 0.4.2-5.1sunshine
- import from COPR teknoraver/networking
- add %%changelog
- adapt, modernize and clean up SPEC
- BR openssl-devel, which is mysteriously pulled in
- replace %%post setcap with %%caps