ebuild(5) provides an example of the DEPEND string for a package which
can handle exactly one of several different video interfaces:

    || (
        sdl? ( media-libs/libsdl )
        svga? ( media-libs/svgalib )
        opengl? ( virtual/opengl )
        ggi? ( media-libs/libggi )
        virtual/x11
    )

I've been using a similar construct in one of my local ebuilds. My
build code is along the lines of:

    if use sdl >/dev/null
    then
        # stuff
    elif use svga >/dev/null
    then
        # stuff
    elif ...

However, a recently overheard conversation on IRC suggests that this
is incorrect. Would someone with slightly less intolerance for
clueless newbies be kind enough to explain why exactly this is wrong,
and how to handle things correctly? I don't see why it is necessary to
use has_version rather than use, and I can't find any relevant
documentation (I have been lead to believe that has_version should be
avoided if at all possible?). I can find several ebuilds in the tree
that appear to use the same technique, however. Are these buggy? Do I
still need to use has_version if I switch my DEPEND string to
something like:

    sdl? ( media-libs/libsdl )
    !sdl? ( svga? ( media-libs/svgalib ) )
    !sdl? ( !svga? ( opengl? ( virtual/opengl ) ) )
    # ...

or is the problem something that only occurs with the first form?

-- 
gentoo-dev@gentoo.org mailing list

Reply via email to