aboutsummaryrefslogtreecommitdiff
blob: 1975dd167de5ddf20bf767ea29604a43af1e92cd (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
76
77
78
79
# Copyright 2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8

PYTHON_COMPAT=( python3_{10..12} )
inherit desktop flag-o-matic python-any-r1

DESCRIPTION="Forward-port of the Crowther/Woods Adventure 2.5"
HOMEPAGE="http://www.catb.org/~esr/open-adventure/"
SRC_URI="https://gitlab.com/esr/${PN}/-/archive/${PV}/${P}.tar.bz2"

LICENSE="BSD-2"
SLOT="0"
KEYWORDS="~amd64"
IUSE="autosave +doc nosave test"
# autosave and nosave are mutually exclusive
# tests require that they are both disabled
REQUIRED_USE="
	?? ( autosave nosave )
	test? ( !autosave !nosave )
"
RESTRICT="!test? ( test )"

DEPEND="dev-libs/libedit"
RDEPEND="${DEPEND}"
BDEPEND="
	$(python_gen_any_dep 'dev-python/pyyaml[${PYTHON_USEDEP}]' )
	test? (
		dev-util/cppcheck
		$(python_gen_any_dep 'dev-python/pylint[${PYTHON_USEDEP}]')
	)
	doc? ( dev-ruby/asciidoctor )
"

DOCS=( NEWS.adoc hints.adoc history.adoc README.adoc notes.adoc )

python_check_deps() {
	python_has_version "dev-python/pyyaml[${PYTHON_USEDEP}]"
	use test && python_has_version "dev-python/pylint[${PYTHON_USEDEP}]"
}

src_prepare() {
	# remove uncommon flags
	sed -e 's/-D_FORTIFY_SOURCE=2 -fstack-protector-all $(CFLAGS) -g/$(CFLAGS)/' \
		-i Makefile || die "Makefile patching failed"

	eapply_user
}

src_compile() {
	if use autosave; then
		append-cflags "-DADVENT_AUTOSAVE"
	fi
	if use nosave; then
		append-cflags "-DADVENT_NOSAVE"
	fi

	emake advent

	use doc && emake advent.6
}

src_install() {
	if use doc; then
		einstalldocs
		doman advent.6
	fi

	dobin advent

	doicon -s scalable advent.svg
	domenu advent.desktop
}

src_test() {
	# parallel tests often fail
	emake -j1 check
}