net-analyzer/mtr: Fix building with USE="-ipv6 -gtk".

Package-Manager: portage-2.3.0
This commit is contained in:
Jeroen Roovers
2016-08-04 16:07:17 +02:00
parent 2d16abba3a
commit 63d3dcfd13
4 changed files with 86 additions and 8 deletions

View File

@@ -0,0 +1,59 @@
--- a/net.c
+++ b/net.c
@@ -320,9 +320,13 @@
struct sockaddr_storage local;
struct sockaddr_storage remote;
struct sockaddr_in *local4 = (struct sockaddr_in *) &local;
+#ifdef ENABLE_IPV6
struct sockaddr_in6 *local6 = (struct sockaddr_in6 *) &local;
+#endif
struct sockaddr_in *remote4 = (struct sockaddr_in *) &remote;
+#ifdef ENABLE_IPV6
struct sockaddr_in6 *remote6 = (struct sockaddr_in6 *) &remote;
+#endif
socklen_t len;
ttl = index + 1;
@@ -437,9 +441,13 @@
struct sockaddr_storage local;
struct sockaddr_storage remote;
struct sockaddr_in *local4 = (struct sockaddr_in *) &local;
+#ifdef ENABLE_IPV6
struct sockaddr_in6 *local6 = (struct sockaddr_in6 *) &local;
+#endif
struct sockaddr_in *remote4 = (struct sockaddr_in *) &remote;
+#ifdef ENABLE_IPV6
struct sockaddr_in6 *remote6 = (struct sockaddr_in6 *) &remote;
+#endif
socklen_t len;
ttl = index + 1;
@@ -726,8 +734,12 @@
/* sendto() assumes packet length includes the IPv4 header but not the
IPv6 header. */
+#ifdef ENABLE_IPV6
spacketsize = abs(packetsize) -
( ( af == AF_INET ) ? 0 : sizeof (struct ip6_hdr) );
+#else
+ spacketsize = abs(packetsize);
+#endif
rv = sendto(sendsock, packet, spacketsize, 0, remotesockaddr, salen);
if (first && (rv < 0) && ((errno == EINVAL) || (errno == EMSGSIZE))) {
/* Try the first packet again using host byte order. */
@@ -1535,11 +1547,15 @@
struct sockaddr_in name_struct;
#endif
struct sockaddr_in * sa4;
+#ifdef ENABLE_IPV6
struct sockaddr_in6 * sa6;
+#endif
struct sockaddr * name = (struct sockaddr *) &name_struct;
struct sockaddr_storage remote;
struct sockaddr_in *remote4 = (struct sockaddr_in *) &remote;
+#ifdef ENABLE_IPV6
struct sockaddr_in6 *remote6 = (struct sockaddr_in6 *) &remote;
+#endif
socklen_t len;
int s;

View File

@@ -0,0 +1,12 @@
--- a/dns.c
+++ b/dns.c
@@ -49,7 +49,8 @@
#include <unistd.h>
#include <fcntl.h>
//#include <ctype.h>
-//#include <string.h>
+#include <string.h>
+#include <strings.h>
#include <stdio.h>
#include <stdlib.h>
#include <signal.h>

View File

@@ -30,6 +30,8 @@ DEPEND="
DOCS=( AUTHORS FORMATS NEWS README SECURITY TODO )
FILECAPS=( cap_net_raw /usr/sbin/mtr )
PATCHES=(
"${FILESDIR}"/${PN}-0.80-impl-dec.patch
"${FILESDIR}"/${PN}-9999-ipv6.patch
"${FILESDIR}"/${PN}-9999-tinfo.patch
)

View File

@@ -1,10 +1,9 @@
# Copyright 1999-2015 Gentoo Foundation
# Copyright 1999-2016 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Id$
EAPI=5
inherit eutils autotools fcaps flag-o-matic git-r3
EAPI=6
inherit autotools eutils fcaps flag-o-matic git-r3
DESCRIPTION="My TraceRoute, an Excellent network diagnostic tool"
HOMEPAGE="http://www.bitwizard.nl/mtr/"
@@ -31,6 +30,12 @@ DEPEND="
DOCS=( AUTHORS FORMATS NEWS README SECURITY TODO )
FILECAPS=( cap_net_raw /usr/sbin/mtr )
PATCHES=(
"${FILESDIR}"/${PN}-0.80-impl-dec.patch
"${FILESDIR}"/${PN}-9999-ipv6.patch
"${FILESDIR}"/${PN}-9999-strings.patch
"${FILESDIR}"/${PN}-9999-tinfo.patch
)
src_unpack() {
git-r3_src_unpack
@@ -38,16 +43,16 @@ src_unpack() {
}
src_prepare() {
epatch \
"${FILESDIR}"/${PN}-0.80-impl-dec.patch \
"${FILESDIR}"/${PN}-0.85-gtk.patch \
"${FILESDIR}"/${PN}-9999-tinfo.patch
default
sed -i -e "/^\s*xver=/s|$.*)|${EGIT_VERSION:0:8}|" Makefile.am || die
# Keep this comment and following mv, even in case ebuild does not need
# it: kept gtk-2.0.m4 in SRC_URI but you'll have to mv it before autoreconf
mv "${WORKDIR}"/gtk-2.0-for-mtr.m4 gtk-2.0.m4 || die #222909
eapply_user
AT_M4DIR="." eautoreconf
}