summaryrefslogtreecommitdiff
blob: 4fab4379321ab49d319fe8eac39a7d24865cf685 (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
98
99
100
101
102
103
104
105
# Copyright 1999-2003 Gentoo Technologies, Inc.
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/sys-apps/net-tools/net-tools-1.60-r7.ebuild,v 1.2 2003/06/18 22:45:53 msterret Exp $

inherit eutils

DESCRIPTION="Standard Linux networking tools"
SRC_URI="http://www.tazenda.demon.co.uk/phil/net-tools/${P}.tar.bz2
	mirror://gentoo/${P}-gentoo-extra-1.tar.bz2"
HOMEPAGE="http://sites.inka.de/lina/linux/NetTools/"

SLOT="0"
LICENSE="GPL-2"
KEYWORDS="~x86 ~ppc ~sparc ~alpha ~hppa ~arm ~mips"
IUSE="nls build static"

DEPEND="nls? ( sys-devel/gettext )
	>=sys-apps/sed-4"

src_unpack() {

	if [ "`use static`" ] ; then
		CFLAGS="${CFLAGS} -static"
		LDFLAGS="${LDFLAGS} -static"
	fi

	PATCHDIR=${WORKDIR}/${P}-gentoo

	unpack ${A}
	cd ${S}

	# some redhat patches
	epatch ${PATCHDIR}/net-tools-1.54-ipvs.patch
	epatch ${PATCHDIR}/net-tools-1.57-bug22040.patch
	epatch ${PATCHDIR}/net-tools-1.60-manydevs.patch
	epatch ${PATCHDIR}/net-tools-1.60-miiioctl.patch
	epatch ${PATCHDIR}/net-tools-1.60-virtualname.patch
	epatch ${PATCHDIR}/net-tools-1.60-cycle.patch

	# GCC-3.3 Compile Fix
	epatch ${PATCHDIR}/${P}-multiline-string.patch

	cp ${PATCHDIR}/net-tools-1.60-config.h config.h
	cp ${PATCHDIR}/net-tools-1.60-config.make config.make

	sed -i \
		-e "s:-O2 -Wall -g:${CFLAGS}:" \
		-e "/^LOPTS =/ s/\$/${CFLAGS}/" Makefile ||
			die "sed Makefile failed"

	sed -i -e "s:/usr/man:/usr/share/man:" man/Makefile || \
		die "sed man/Makefile failed"

	cp -f ${PATCHDIR}/ether-wake.c ${S}
	cp -f ${PATCHDIR}/ether-wake.8 ${S}/man/en_US

	if [ -z "`use nls`" ] ; then
		sed -i -e 's:\(#define I18N\) 1:\1 0:' config.h || \
			die "sed config.h failed"

		sed -i -e 's:I18N=1:I18N=0:' config.make ||
			die "sed config.make failed"
	fi

	touch config.{h,make}		# sync timestamps
}

src_compile() {
	# Changing "emake" to "make" closes half of bug #820;
	# configure is run from *inside* the Makefile, sometimes
	# breaking parallel makes (if ./configure doesn't finish first)
	make || die

	if [ "`use nls`" ] ; then
		cd po
		make || die
	fi

	cd ${S}
	gcc ${CFLAGS} -o ether-wake ether-wake.c || die
}

src_install() {
	make BASEDIR=${D} install || die

	dosbin ether-wake
	mv ${D}/bin/* ${D}/sbin
	for i in hostname domainname netstat dnsdomainname ypdomainname nisdomainname
	do
		mv ${D}/sbin/${i} ${D}/bin
	done
	dodir /usr/bin
	dosym /bin/hostname /usr/bin/hostname

	if [ -z "`use build`" ]
	then
		dodoc COPYING README README.ipv6 TODO
	else
		#only install /bin/hostname
		rm -rf ${D}/usr
		rm -rf ${D}/sbin
		rm -f ${D}/bin/{domainname,netstat,dnsdomainname}
		rm -f ${D}/bin/{ypdomainname,nisdomainname}
	fi
}