summaryrefslogtreecommitdiff
blob: 3b0a8f68e9ea6df909d25a39112b7bb9fb0cb7f6 (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
# Copyright 1999-2002 Gentoo Technologies, Inc.
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/sys-apps/sh-utils/sh-utils-2.0.15.ebuild,v 1.12 2003/02/11 19:33:12 gmsoft Exp $

IUSE="nls static build"

S=${WORKDIR}/${P}
DESCRIPTION="Your standard GNU shell utilities"
SRC_URI="ftp://alpha.gnu.org/gnu/fetish/${P}.tar.gz"
HOMEPAGE="http://www.gnu.org/software/shellutils/shellutils.html"

DEPEND="nls? ( sys-devel/gettext )"

SLOT="0"
LICENSE="GPL-2"
KEYWORDS="x86 ppc sparc alpha mips hppa"

src_unpack() {
	unpack ${P}.tar.gz
	cd ${S}

	# patch to remove Stallman's su/wheel group rant and to add processor
	# information in uname output

	# btw, this patch is b0rked on hppa
	use hppa || patch -p1 < ${FILESDIR}/${P}-gentoo.diff || die

	# This next line prevents our patched (and updated-mtime) uname.c 
	# from forcing a uname.1 man page regeneration, which requires perl 
	# (not available when creating a new build image... and we don't want 
	# this package dependent on perl anyway.
	#This problem can be fixed by fixing our patch at a future date.
	touch -d "20 Aug 1999" src/uname.c
}

src_compile() {
	local myconf=""
	use nls || myconf="--disable-nls"
	
	CFLAGS="${CFLAGS}" \
		econf \
			--without-included-regex \
			${myconf} || die
	
	if [ -z "`use static`" ]
	then
		emake || die
	else
		emake LDFLAGS=-static || die
	fi
}

src_install() {
	einstall || die
		
	rm -rf ${D}/usr/lib
	dodir /bin
	cd ${D}/usr/bin
	mv date echo false pwd stty su true uname sleep ${D}/bin

	if [ -z "`use build`" ]
	then
		cd ${S}
		dodoc AUTHORS COPYING ChangeLog ChangeLog.0 NEWS README THANKS TODO
	else
		rm -rf ${D}/usr/share
	fi
	#we must use hostname from net-base
	#hostname do not work with the -f switch ... this breaks gnome2 among things
	rm ${D}/usr/bin/hostname
	#we use the /bin/su from the sys-apps/shadow package
	rm ${D}/bin/su
	rm ${D}/usr/share/man/man1/su*
	#we use the /usr/bin/uptime from the sys-apps/procps package
	rm ${D}/usr/bin/uptime
	rm ${D}/usr/share/man/man1/uptime*
}

pkg_postinst() {
	#hostname do not get removed, as it is included with older stage1
	#tarballs, and net-tools installs to /bin
	if [ -e ${ROOT}/usr/bin/hostname ] && [ ! -L ${ROOT}/usr/bin/hostname ]
	then
		rm -f ${ROOT}/usr/bin/hostname
	fi
}