10baf010b5f3fa1b7700e4b080e17c13e3adcd05
[gentoo.git] / games-misc / fortune-mod / fortune-mod-1.99.1-r2.ebuild
1 # Copyright 1999-2020 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=5
5 inherit eutils toolchain-funcs
6
7 DESCRIPTION="The notorious fortune program"
8 HOMEPAGE="http://www.redellipse.net/code/fortune"
9 SRC_URI="http://www.redellipse.net/code/downloads/${P}.tar.gz"
10
11 LICENSE="BSD"
12 SLOT="0"
13 KEYWORDS="~alpha amd64 arm ~arm64 hppa m68k ~mips ppc64 x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~x86-solaris"
14 IUSE="offensive elibc_glibc"
15
16 DEPEND="app-text/recode"
17 RDEPEND="${DEPEND}"
18
19 src_prepare() {
20         epatch "${FILESDIR}"/${P}-gentoo.patch \
21                 "${FILESDIR}"/01_all_fortune_all-fix.patch
22
23         sed -i \
24                 -e 's:/games::' \
25                 -e 's:/fortunes:/fortune:' \
26                 -e '/^FORTDIR=/s:=.*:=$(prefix)/usr/bin:' \
27                 -e '/^all:/s:$: fortune/fortune.man:' \
28                 -e "/^OFFENSIVE=/s:=.*:=`use offensive && echo 1 || echo 0`:" \
29                 Makefile || die "sed Makefile failed"
30
31         if ! use elibc_glibc ; then
32                 [[ ${CHOST} == *-*bsd* ]] && local reglibs="-lcompat"
33                 [[ ${CHOST} == *-darwin* ]] && local reglibs="-lc"
34                 has_version "app-text/recode[nls]" && reglibs="${reglibs} -lintl"
35                 sed -i \
36                         -e "/^REGEXLIBS=/s:=.*:= ${reglibs}:" \
37                         Makefile \
38                         || die "sed REGEXLIBS failed"
39         fi
40         if [[ ${CHOST} == *-solaris* ]] ; then
41                 sed -i -e 's:u_int:uint:g' util/strfile.h || die "sed strfile.h failed"
42         fi
43         if [[ ${CHOST} == *-darwin* ]] ; then
44                 sed -i -e 's/-DBSD_REGEX/-DPOSIX_REGEX/' Makefile || die "sed Makefile failed"
45         fi
46 }
47
48 src_compile() {
49         local myrex=
50         [[ ${CHOST} == *-interix* ]] && myrex="REGEXDEFS=-DNO_REGEX"
51         emake prefix="${EPREFIX}" CC="$(tc-getCC)" $myrex
52 }
53
54 src_install() {
55         emake prefix="${ED}" install
56         dodoc ChangeLog INDEX Notes Offensive README TODO cookie-files
57 }