commit:     019f1a2752e9e2ff0e3b8b03be4059e161498c77
Author:     Nicola Smaniotto <smaniotto.nicola <AT> gmail <DOT> com>
AuthorDate: Mon Nov 27 17:55:01 2023 +0000
Commit:     Nicola Smaniotto <smaniotto.nicola <AT> gmail <DOT> com>
CommitDate: Mon Nov 27 18:11:25 2023 +0000
URL:        https://gitweb.gentoo.org/repo/proj/guru.git/commit/?id=019f1a27

games-rpg/open-adventure: expose compilation flags

Signed-off-by: Nicola Smaniotto <smaniotto.nicola <AT> gmail.com>

 games-rpg/open-adventure/metadata.xml              |  4 ++++
 .../open-adventure/open-adventure-1.16.ebuild      | 25 +++++++++++++++++++++-
 2 files changed, 28 insertions(+), 1 deletion(-)

diff --git a/games-rpg/open-adventure/metadata.xml 
b/games-rpg/open-adventure/metadata.xml
index a4448d805b..31d3db3238 100644
--- a/games-rpg/open-adventure/metadata.xml
+++ b/games-rpg/open-adventure/metadata.xml
@@ -5,6 +5,10 @@
                <email>[email protected]</email>
                <name>Nicola Smaniotto</name>
        </maintainer>
+       <use>
+               <flag name="autosave">Build with auto-save/resume enabled</flag>
+               <flag name="nosave">Build with save/resume disabled</flag>
+       </use>
        <upstream>
                <remote-id type="gitlab">esr/open-adventure</remote-id>
        </upstream>

diff --git a/games-rpg/open-adventure/open-adventure-1.16.ebuild 
b/games-rpg/open-adventure/open-adventure-1.16.ebuild
index 051da13c62..2fde826c47 100644
--- a/games-rpg/open-adventure/open-adventure-1.16.ebuild
+++ b/games-rpg/open-adventure/open-adventure-1.16.ebuild
@@ -4,7 +4,7 @@
 EAPI=8
 
 PYTHON_COMPAT=( python3_{10..12} )
-inherit desktop python-any-r1
+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/";
@@ -13,6 +13,14 @@ 
SRC_URI="https://gitlab.com/esr/${PN}/-/archive/${PV}/${P}.tar.bz2";
 LICENSE="BSD-2"
 SLOT="0"
 KEYWORDS="~amd64"
+IUSE="autosave 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}"
@@ -26,7 +34,22 @@ python_check_deps() {
        python_has_version "dev-python/pyyaml[${PYTHON_USEDEP}]"
 }
 
+src_prepare() {
+       eapply_user
+
+       # Add missing semicolon
+       sed -e 's/rspeak(SAVERESUME_DISABLED)/rspeak(SAVERESUME_DISABLED);/' \
+               -i saveresume.c
+}
+
 src_compile() {
+       if use autosave; then
+               append-cflags "-DADVENT_AUTOSAVE"
+       fi
+       if use nosave; then
+               append-cflags "-DADVENT_NOSAVE"
+       fi
+
        emake advent advent.6
 }
 

Reply via email to