summaryrefslogtreecommitdiff
blob: 1fc51b012160ec64bbea038b58b4f448e8044eed (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
# Copyright 1999-2004 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/sys-apps/iproute2/iproute2-2.4.7.20020116-r1.ebuild,v 1.2 2004/09/15 21:29:45 vapier Exp $

inherit eutils flag-o-matic

# Deb patches have been stripped/updated from the 13 deb release
SRCFILE="iproute2-2.4.7-now-ss020116-try.tar.gz"
DESCRIPTION="kernel routing and traffic control utilities"
HOMEPAGE="http://www.worldbank.ro/ip-routing/"
SRC_URI="http://ftp.iasi.roedu.net/mirrors/ftp.inr.ac.ru/ip-routing/${SRCFILE}
	ftp://ftp.inr.ac.ru/ip-routing/${SRCFILE}
	mirror://gentoo/${P}-manpages.patch.bz2"

LICENSE="GPL-2"
SLOT="0"
KEYWORDS="x86 ppc sparc mips alpha arm hppa amd64 ia64"
IUSE="atm doc"

RDEPEND="virtual/libc
	=sys-libs/db-1*
	atm? ( net-dialup/linux-atm )"
DEPEND="${RDEPEND}
	>=virtual/os-headers-2.4.21
	>=sys-apps/sed-4
	doc? ( virtual/tetex )"

S=${WORKDIR}/iproute2

src_unpack() {
	unpack ${SRCFILE}
	cd ${S}

	# Enable HFSC scheduler #45274
	if [ ! -z "`grep tc_service_curve ${ROOT}/usr/include/linux/pkt_sched.h`" ] ; then
		epatch ${FILESDIR}/${PV}-hfsc.patch
	else
		ewarn "Your linux-headers in /usr/include/linux are too old to"
		ewarn "support the HFSC scheduler.  It has been disabled."
	fi

	# Enable HTB scheduler (stripped from debian patch)
	epatch ${FILESDIR}/${PV}-htb.patch
	# Add a few debian fixes
	epatch ${FILESDIR}/${PV}-misc-deb-fixes.patch
	# Add manpages from debian
	epatch ${DISTDIR}/${P}-manpages.patch.bz2

	# Make sure we use glibc tcp.h instead of kernel tcp.h
	sed -i '/include/s:linux/tcp\.h:netinet/tcp.h:' misc/ss.c || die "sed ss.c failed"

	# Now a little hack to handle kernel headers and stupid defines ...
	echo '#define __constant_htons(x) htons(x)' >> include-glibc/glibc-bugs.h
	append-flags -D_LINUX_BYTEORDER_LITTLE_ENDIAN_H -D_LINUX_BYTEORDER_BIG_ENDIAN_H

	# Fix local DoS exploit #34294
	epatch ${FILESDIR}/${PV}-local-exploit-fix.patch

	# Fix db and glibc includes
	sed -i \
		-e "s:-O2:${CFLAGS}:g" \
		-e 's:-I\.\./include-glibc::g' \
		-e 's:db3:db1:g' \
		Makefile || die "sed Makefile failed"
	sed -i 's:-ldb:-ldb1:' misc/Makefile || die "sed misc/Makefile failed"

	# Enable diffserv/atm support
	if use atm ; then
		sed -i 's:=n$:=y:' Config || die "sed Config failed"
	fi
}

src_compile() {
	emake KERNEL_INCLUDE="${ROOT}/usr/include" || die
}

src_install() {
	into /
	cd ${S}/ip
	dosbin ifcfg ip routef routel rtmon rtpr || die "dosbin ip failed"
	cd ${S}/misc
	dosbin arpd ifstat nstat rtacct rtstat ss || die "dosbin misc failed"
	cd ${S}/tc
	dosbin tc || die "dosbin tc failed"
	cd ${S}

	doman debian/manpages/*

	dodoc README* RELNOTES
	docinto examples ; dodoc examples/*
	docinto examples/diffserv ; dodoc examples/diffserv/*
	dodir /etc/iproute2
	insinto /etc/iproute2 ; doins ${S}/etc/iproute2/*
	if use doc && [ -n "`ls doc/*.ps`" ] ; then
		docinto ps ; dodoc doc/*.ps
	fi
}