summaryrefslogtreecommitdiff
blob: 619ac073c69c7194cacd783fe562ed30d63a1fe0 (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
# Copyright 1999-2008 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $

inherit toolchain-funcs

DESCRIPTION="a growing collection of the unix tools that nobody thought to write thirty years ago"
HOMEPAGE="http://www.kitenet.net/~joey/code/moreutils.html"
SRC_URI="http://ftp.debian.org/debian/pool/main/m/moreutils/${P/-/_}.tar.gz"

LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~amd64 ~x86"
IUSE="doc"

DEPEND="doc? ( =app-text/docbook-xml-dtd-4.4*
		app-text/docbook2X )"
RDEPEND="dev-lang/perl"

S=${WORKDIR}/${PN}

src_unpack() {
	unpack ${A}
	sed -i \
		-e 's/^CFLAGS/#CFLAGS/' \
		-e 's/-s//' \
		-e 's/docbook2x-man $</docbook2man.pl $< >$@/g' \
		"${S}/Makefile" || die "sed failed"

	# Broken when $S has spaces.
	if use doc; then
		sed -i \
			-e 's#file.*/xml/\(.*docbookx.dtd\)#\1#g' \
			$(find "${S}" -iname *.docbook -printf '%p ') || die "sed failed"
	else
		sed -i \
			-e 's/^MANS/#/' \
			-e 's#install $(MANS) $(PREFIX)/usr/share/man/man1##' \
			-e 's#mkdir -p $(PREFIX)/usr/share/man/man1##' \
			"${S}/Makefile" || die "sed failed"
	fi
}

src_compile() {
	emake CC="$(tc-getCC)" || die "emake failed"
}

src_install() {
	emake PREFIX="${D}" install || die "emake install failed"
	dodoc README
}