games-roguelike/angband: rework USE flag logic
authorStefan Strogin <stefan.strogin@gmail.com>
Mon, 4 Mar 2019 18:32:49 +0000 (20:32 +0200)
committerJames Le Cuirot <chewi@gentoo.org>
Sat, 9 Mar 2019 22:16:12 +0000 (22:16 +0000)
Add REQUIRED_USE "at least one of" X or ncurses, thanks to it we can
drop some tricky conditions in src_configure and RDEPEND.
Besides that angband simply cannot build with USE="-X -ncurses".

Add sound? ( sdl ) to REQUIRED_USE as SDL is needed for sound.
Add media-fonts/font-misc-misc to RDEPEND with USE=X.

Default USE flags in accordance with the upstream configure options:
set +X, +ncurses; disable sound.

Package-Manager: Portage-2.3.62, Repoman-2.3.12
Signed-off-by: Stefan Strogin <stefan.strogin@gmail.com>
Signed-off-by: James Le Cuirot <chewi@gentoo.org>
games-roguelike/angband/angband-4.1.3.ebuild

index 34d75a13d94dfc988cba840094f211d52bcfe700..830cddc683f48736cc4f6e677969e1ab5d81c6b8 100644 (file)
@@ -14,9 +14,15 @@ SRC_URI="https://rephial.org/downloads/${MAJOR_PV}/${P}.tar.gz"
 LICENSE="GPL-2"
 SLOT="0"
 KEYWORDS="~amd64 ~x86"
-IUSE="ncurses sdl +sound X"
+IUSE="+ncurses sdl sound +X"
 
-RDEPEND="!ncurses? ( !X? ( !sdl? ( sys-libs/ncurses:0=[unicode] ) ) )
+REQUIRED_USE="sound? ( sdl )
+       || ( X ncurses )"
+
+RDEPEND="X? (
+               media-fonts/font-misc-misc
+               x11-libs/libX11
+       )
        ncurses? ( sys-libs/ncurses:0=[unicode] )
        sdl? (
                media-libs/libsdl[video,X]
@@ -26,8 +32,7 @@ RDEPEND="!ncurses? ( !X? ( !sdl? ( sys-libs/ncurses:0=[unicode] ) ) )
                        media-libs/libsdl[sound]
                        media-libs/sdl-mixer[mp3]
                )
-       )
-       X? ( x11-libs/libX11 )"
+       )"
 DEPEND="${RDEPEND}
        dev-python/docutils
        virtual/pkgconfig"
@@ -54,23 +59,16 @@ src_prepare() {
 }
 
 src_configure() {
-       local myconf
-
-       if use sdl; then
-               myconf="$(use_enable sound sdl-mixer)"
-       else
-               myconf="--disable-sdl-mixer"
-       fi
+       local myconf=(
+               --bindir="${EPREFIX}"/usr/bin
+               --with-private-dirs
+               $(use_enable X x11)
+               $(use_enable sdl)
+               $(use_enable sound sdl-mixer)
+               $(use_enable ncurses curses)
+       )
 
-       econf \
-               --bindir="${EPREFIX}"/usr/bin \
-               --with-private-dirs \
-               $(use_enable X x11) \
-               $(use_enable sdl) \
-               $(use_enable ncurses curses) \
-               $(use !sdl && use !ncurses && use !X && \
-                       echo --enable-curses) \
-               ${myconf}
+       econf "${myconf[@]}"
 }
 
 src_install() {