summaryrefslogtreecommitdiff
blob: 4d142100f6e0deed87ecafb92ad08d09cf6bf2c9 (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
# Copyright 1999-2005 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/games-misc/fortune-mod/fortune-mod-1.99.1-r1.ebuild,v 1.6 2005/08/27 17:56:51 corsair Exp $

inherit eutils toolchain-funcs

DESCRIPTION="The notorious fortune program"
HOMEPAGE="http://www.redellipse.net/code/fortune"
SRC_URI="http://www.redellipse.net/code/downloads/${P}.tar.gz"

LICENSE="BSD"
SLOT="0"
KEYWORDS="alpha amd64 hppa mips ppc ~ppc-macos ppc64 sparc x86"
IUSE="offensive"

DEPEND="virtual/libc
	app-text/recode"

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

	epatch ${FILESDIR}/${P}-gentoo.patch

	sed -i \
		-e 's:/games::' \
		-e 's:/fortunes:/fortune:' \
		-e 's:FORTDIR=$(prefix)/usr:FORTDIR=$(prefix)/usr/bin:' \
		-e 's:^CFLAGS=.*$:CFLAGS=$(DEFINES) $(E_CFLAGS):' \
		-e '/^all:/s:$: fortune/fortune.man:' \
		Makefile \
		|| die "sed Makefile failed"
	sed -i \
		-e 's:char a, b;:short int a, b;:' util/rot.c \
		|| die "sed util/rot.c failed"

	# fixes the '-m' segfault problem on _my_ computer,
	# it might screw something else up i don't know about.
	sed -i \
		-e '/if (fp->utf8_charset)/{
			N
			/free (output);/d
		}' fortune/fortune.c \
		|| die "sed fortune/fortune.c failed"
	use offensive && off=1 || off=0
}

src_compile() {
	emake \
		CC=$(tc-getCC) \
		REGEXDEFS='-DHAVE_REGEX_H -DPOSIX_REGEX'
		E_CFLAGS="${CFLAGS}" \
		LDFLAGS="${LDFLAGS}" \
		OFFENSIVE="${off}" \
		|| die "emake failed"
}

src_install() {
	make \
		OFFENSIVE="${off}" \
		prefix="${D}" \
		install \
		|| die "make install failed"

	dodoc ChangeLog INDEX Notes Offensive README TODO cookie-files
}