Note: Due to technical difficulties, the Archives are currently not up to date.
GMANE provides an alternative service for most mailing lists. c.f. bug 424647
List Archive: gentoo-devhelp
On 01/31/2010 12:22 PM, Mike Frysinger wrote:
> On Saturday 30 January 2010 18:31:35 Nikos Chantziaras wrote:
>> What's the best way to have an ebuild abort if two mutually exclusive
>> USE flags are both set?
>>
>> I'm trying the modify the mozilla-firefox and xulrunner ebuilds to
>> support building with OSS instead of ALSA (sadly, the current versions
>> of the ebuilds in Portage only allow ALSA to be enabled, not OSS), but
>> the build system of Xulrunner/Firefox does not allow to build with both.
>> So I need to abort when both "alsa" and "oss" are set rather than having
>> the build proceed and the user getting a compilation error later on.
>
> put a check into pkg_setup() that does ewarn's on conflicting USE flags, and
> then have the rest of the ebuild pick a sensible default. in the case of oss
> vs alsa, the latter would be the sensible default.
> -mike
OK, this what I ended up with. Please note that my scripting skills are
a bit rusty :P
(The wrong line breaks don't appear in the actual ebuild and tabs are
used to indent.)
In pkg_setup():
if use alsa && use oss ; then
einfo
ewarn "You have enabled both the \"alsa\" as well as the \"oss\" USE
flags. It"
ewarn "is not possible to build mozilla-firefox or xulrunner with
support for"
ewarn "both. ALSA will be used in this case. If you want OSS
support, unset the"
ewarn "\"alsa\" USE flag and leave only \"oss\" set."
fi
In src_prepare():
# Switch from ALSA to OSS
if use oss && ! use alsa; then
ebegin "Switching from ALSA to Open Sound System"
sed -i 's/sydney_audio_alsa/sydney_audio_oss/' \
media/libsydneyaudio/src/Makefile.in || die "sed failed!" \
&& sed -i '/alsa\//d' config/system-headers || die "sed failed!" \
&& sed -i '/alsa\//d' \
js/src/config/system-headers || die "sed failed!" \
&& sed -i '/LIB(asound/d' configure.in || die "sed failed!"
eend $?
fi
In src_configure():
# Enable/Disable audio in firefox
if use alsa || use oss ; then
mozconfig_annotate '' --enable-ogg
mozconfig_annotate '' --enable-wave
fi
In this last one, I'm not sure how to pass something to the first
argument of mozconfig_annotate. The original was:
mozconfig_use_enable alsa ogg
which translates into:
mozconfig_annotate 'alsa' --enable-ogg
The point is that the user will see which USE flags are responsible for
"--enable-*" and "--disable-*" options. Unfortunately, this:
mozconfig_use_enable ( alsa || oss ) ogg
is not possible. Should I therefore write the block twice in a nested
if block or leave it as is (and losing the information about which USE
flag resulted in "--enable-ogg|wave"?)
|
|