summaryrefslogtreecommitdiff
blob: 9a1d9cfc1da1ab4d99ac439525102accce034aa6 (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
# Copyright 1999-2005 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/app-text/an/an-0.95.3.ebuild,v 1.4 2005/12/01 20:37:50 metalgod Exp $

inherit eutils toolchain-funcs versionator

DESCRIPTION="Very fast anagram generator with dictionary lookup"
HOMEPAGE="http://packages.debian.org/stable/games/an"

MY_PV="$(get_version_component_range 1-2)"
SRC_URI="http://ftp.debian.org/debian/pool/main/a/an/${PN}_${MY_PV}.orig.tar.gz"

LICENSE="GPL-2 LGPL-2"
SLOT="0"
KEYWORDS="~amd64 ~hppa ~ppc64 ~x86"
IUSE=""

RDEPEND="sys-apps/miscfiles"

S="${WORKDIR}/${PN}-${MY_PV}"

src_unpack() {
	unpack ${A}
	cd ${S}

	# Patching to -r3:
	MY_PL="$(replace_version_separator 2 -)"
	epatch "${FILESDIR}"/${PN}_${MY_PL}.diff.gz

	ebegin "Patching an to use toolchain and custom CFLAGS"
	sed -e "s:gcc:$(tc-getCC):" \
		-e "s:-O2.*:${CFLAGS}:" \
		-i Makefile lib/Makefile
	eend ${?}

	# sys-apps/miscfiles doesn't have /usr/dict/words:
	sed \
		-e 's:/usr/dict/words:/usr/share/dict/words:' \
		-i README || die
}
src_compile() {
	emake || die
}

src_install() {
	dobin ${PN} || die
	doman ${PN}.6 || die
	dodoc \
		debian/changelog \
		debian/README.Debian \
		DICTIONARY \
		EXAMPLE.ANAGRAMS \
		HINTS \
		INSTALL \
		README \
		TODO || die
}

pkg_postinst() {
	ewarn "If you merged sys-apps/miscfiles with USE=minimal,"
	ewarn "an will NOT work properly, as /usr/share/dict/words"
	ewarn "will then be a symlink to a gzipped file. an currently"
	ewarn "does not support gzipped dictionary files and will"
	ewarn "only produce garbage."
	ewarn "Do 'USE=-minimal emerge sys-apps/miscfiles', or run an"
	ewarn "with the -d /path/to/dictionary option, perhaps using"
	ewarn "one of the files mentioned below."
	echo

	einfo "Helpful note from an's author:"
	einfo "   If you do not have a dictionary you can obtain one from the"
	einfo "   following site: ftp://ftp.funet.fi/pub/doc/dictionaries/"
	einfo "   You will find a selection of dictionaries in many different"
	einfo "   languages here."
}