summaryrefslogtreecommitdiff
blob: c7bc0bcc68c6d08ae25a4ef89d865a8a75d601ab (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
# Copyright 1999-2004 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/sys-apps/nictools/nictools-20030719.ebuild,v 1.8 2004/07/15 02:01:40 agriffis Exp $

inherit eutils

DESCRIPTION="nictools - diagnostic tools for a variety of ISA and PCI network cards"
HOMEPAGE="http://www.scyld.com/diag/index.html"
# The tarball is a slightly modified version compiled of the _latest_ versions
# of the files from all of the debian package, and the entirely of the Scyld
# website.
# It has a vastly modified Makefile to make it easy to build on Gentoo
SRC_URI="mirror://gentoo/${P}.tbz2
		 mirror://gentoo/${P}-gcc33-multilinestring.patch"
LICENSE="GPL-2"
SLOT="0"
KEYWORDS="x86"
IUSE="static"
DEPEND=""

nictools_grabvar() {
	gmake VAR="${1}" printvar
}

nictools_setupcards() {
	if [ -z "${NICTOOLS_CARDS}" ]; then
		NICTOOLS_CARDS="pci isa"
	fi
	for card in ${NICTOOLS_CARDS}; do
		UPPER=`echo ${card} | tr '[:lower:]' '[:upper:]'`
		NICTOOLS_INSTALL="${NICTOOLS_INSTALL} `nictools_grabvar ${UPPER}`"
		NICTOOLS_INSTALL="${NICTOOLS_INSTALL} `nictools_grabvar ${card}`"
	done
	NICTOOLS_INSTALL="${NICTOOLS_INSTALL} `nictools_grabvar UTILS`"
	NICTOOLS_INSTALL="`echo ${NICTOOLS_INSTALL} | xargs -n1 | sort | uniq |xargs`"
}

pkg_setup() {
	einfo "If you want the configuration tools for only PCI or ISA cards, "
	einfo "do: 'NICTOOLS_CARDS=\"pci\" emerge nictools' or 'NICTOOLS_CARDS=\"isa\" emerge nictools'"
}

src_unpack() {
	unpack ${P}.tbz2
	epatch ${DISTDIR}/${P}-gcc33-multilinestring.patch
}

src_compile() {
	nictools_setupcards
	use static && CFLAGS="${CFLAGS} -static"
	emake ${NICTOOLS_INSTALL} || die "emake failed"
}

src_install() {
	nictools_setupcards
	# we do this as the user might not have /usr mounted and they might want
	# the tool to configure the network card so they can use it!
	into /
	for i in ${NICTOOLS_INSTALL}; do
		dosbin ${i}
	done
	into /usr
	doman netdiag.8
}