summaryrefslogtreecommitdiff
blob: 3d029dc31bf1c7abc984754a5e65439eda9dd37b (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
# Copyright 1999-2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8

inherit cmake

DESCRIPTION="The notorious fortune program"
HOMEPAGE="https://www.shlomifish.org/open-source/projects/fortune-mod/"
SRC_URI="
	https://www.shlomifish.org/open-source/projects/${PN}/arcs/${P}.tar.xz
	https://github.com/shlomif/fortune-mod/releases/download/${P}/${P}.tar.xz
"

LICENSE="BSD"
SLOT="0"
KEYWORDS="~amd64 ~arm ~arm64 ~hppa ~m68k ~mips ~ppc64 ~riscv ~sparc ~x86"
IUSE="offensive pcre test"
RESTRICT="!test? ( test )"

RDEPEND="
	!games-misc/fortune-mod-tao
	app-text/recode:=
	>=dev-libs/rinutils-0.10.2
	pcre? ( dev-libs/libpcre2 )
"
DEPEND="${RDEPEND}"
BDEPEND="
	app-text/App-XML-DocBook-Builder
	dev-lang/perl
	test? (
		dev-perl/File-Find-Object
		dev-perl/IO-All
		dev-perl/Test-Differences
		dev-perl/Test-Trap
	)
"

PATCHES=(
	"${FILESDIR}"/${PN}-3.14.0-valgrind-tests.patch
)

src_configure() {
	local mycmakeargs=(
		-DUSE_PCRE=$(usex pcre)
		-DNO_OFFENSIVE=$(usex !offensive)
		# bug #857246
		-DLOCALDIR="/usr/local/share/fortune"
		-DCOOKIEDIR="/usr/share/fortune"
	)

	cmake_src_configure
}

src_test() {
	cmake_src_compile check
}

src_install() {
	cmake_src_install

	# We don't want to create the dir if it doesn't exist
	rm -rf "${ED}"//usr/local || die

	mkdir -p "${ED}"/usr/bin || die
	mv "${ED}"/usr/games/fortune "${ED}"/usr/bin/fortune || die
	rm -rf "${ED}"/usr/games || die

	dodoc ChangeLog INDEX Notes Offensive README TODO cookie-files
}