summaryrefslogtreecommitdiff
blob: db8c2d53ce8a7892d6c829480ab209c99bef4fda (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
# Copyright 1999-2004 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/sys-apps/sed/sed-4.0.9.ebuild,v 1.18 2004/09/16 02:23:44 pvdabeel Exp $

inherit gnuconfig

DESCRIPTION="Super-useful stream editor"
HOMEPAGE="http://www.gnu.org/software/sed/sed.html"
SRC_URI="mirror://gnu/sed/${P}.tar.gz"

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

RDEPEND="virtual/libc"
DEPEND="${RDEPEND}
	nls? ( sys-devel/gettext )"

src_compile() {
	# Needed for mips and probably others
	gnuconfig_update

	use macos && EXTRA_ECONF="--program-prefix=g"
	use ppc-macos && EXTRA_ECONF="--program-prefix=g"
	econf `use_enable nls` || die "Configure failed"
	if use static ; then
		emake LDFLAGS=-static || die "Static build failed"
	else
		emake || die "Shared build failed"
	fi
}

src_install() {
	into /
	dobin sed/sed
	if ! use build
	then
		einstall || die "Install failed"
		dodoc COPYING NEWS README* THANKS AUTHORS BUGS ChangeLog
		docinto examples
		dodoc ${FILESDIR}/dos2unix ${FILESDIR}/unix2dos
	else
		dodir /usr/bin
	fi

	rm -f ${D}/usr/bin/sed
	use macos && cd ${D} && for x in `find . -name 'sed*' -print`; do mv "$x" "${x//sed/gsed}"; done && cd ${WORKDIR}/${P}
	use macos && dosym ../../bin/gsed /usr/bin/gsed || dosym ../../bin/sed /usr/bin/sed
	use ppc-macos && cd ${D} && for x in `find . -name 'sed*' -print`; do mv "$x" "${x//sed/gsed}"; done && cd ${WORKDIR}/${P}
	use ppc-macos && dosym ../../bin/gsed /usr/bin/gsed || dosym ../../bin/sed /usr/bin/sed
}