www-client/firefox-bin: add alsa support
authorThomas Deutschmann <whissi@gentoo.org>
Thu, 13 Feb 2020 14:43:54 +0000 (15:43 +0100)
committerThomas Deutschmann <whissi@gentoo.org>
Thu, 13 Feb 2020 14:49:51 +0000 (15:49 +0100)
Thanks-to: Vitaly Zdanevich <zdanevich.vitaly@ya.ru>
Closes: https://github.com/gentoo/gentoo/pull/14278
Package-Manager: Portage-2.3.88, Repoman-2.3.20
Signed-off-by: Thomas Deutschmann <whissi@gentoo.org>
www-client/firefox-bin/firefox-bin-68.5.0.ebuild
www-client/firefox-bin/firefox-bin-73.0.ebuild

index a4bbc5254737eb0e4025f0f219a1b5b7f9b9d39c..030cfc8b6b156b398c8164c07c83bc00797928cb 100644 (file)
@@ -35,9 +35,14 @@ RESTRICT="strip mirror"
 KEYWORDS="-* amd64 x86"
 SLOT="0"
 LICENSE="MPL-2.0 GPL-2 LGPL-2.1"
-IUSE="+ffmpeg +pulseaudio selinux startup-notification"
-
-DEPEND="app-arch/unzip"
+IUSE="alsa +ffmpeg +pulseaudio selinux startup-notification"
+REQUIRED_USE="alsa? ( !pulseaudio )"
+
+DEPEND="app-arch/unzip
+       alsa? (
+               dev-util/patchelf
+               media-sound/apulse
+       )"
 RDEPEND="dev-libs/atk
        >=sys-apps/dbus-0.60
        >=dev-libs/dbus-glib-0.72
@@ -129,6 +134,11 @@ src_install() {
                MOZ_INSTALL_L10N_XPIFILE="1" \
                mozlinguas_src_install
 
+       if use alsa ; then
+               local apulselib="/usr/$(get_libdir)/apulse"
+               patchelf --set-rpath "${apulselib}" "${ED}"${MOZILLA_FIVE_HOME}/libxul.so || die
+       fi
+
        # Create /usr/bin/firefox-bin
        dodir /usr/bin/
        local apulselib=$(usex pulseaudio "/usr/$(get_libdir)/apulse:" "")
@@ -162,7 +172,14 @@ pkg_postinst() {
                einfo
        fi
        use ffmpeg || ewarn "USE=-ffmpeg : HTML5 video will not render without media-video/ffmpeg installed"
-       use pulseaudio || ewarn "USE=-pulseaudio : audio will not play without pulseaudio installed"
+
+       local HAS_AUDIO=0
+       use pulseaudio && HAS_AUDIO=1
+       use alsa && HAS_AUDIO=1
+
+       if [[ ${HAS_AUDIO} -eq 0 ]] ; then
+               ewarn "USE=-pulseaudio & USE=-alsa : For audio please either set USE=pulseaudio or USE=alsa!"
+       fi
 
        # Update mimedb for the new .desktop file
        xdg_desktop_database_update
index 1f61fc71c8b4a173035f7c7336bd2574a99670ef..b83288b7f7e64c06eea79dc8a25e24840b8470f6 100644 (file)
@@ -35,9 +35,14 @@ RESTRICT="strip mirror"
 KEYWORDS="-* amd64 x86"
 SLOT="0"
 LICENSE="MPL-2.0 GPL-2 LGPL-2.1"
-IUSE="+ffmpeg +pulseaudio selinux startup-notification"
-
-DEPEND="app-arch/unzip"
+IUSE="alsa +ffmpeg +pulseaudio selinux startup-notification"
+REQUIRED_USE="alsa? ( !pulseaudio )"
+
+DEPEND="app-arch/unzip
+       alsa? (
+               dev-util/patchelf
+               media-sound/apulse
+       )"
 RDEPEND="dev-libs/atk
        >=sys-apps/dbus-0.60
        >=dev-libs/dbus-glib-0.72
@@ -129,6 +134,11 @@ src_install() {
                MOZ_INSTALL_L10N_XPIFILE="1" \
                mozlinguas_src_install
 
+       if use alsa ; then
+               local apulselib="/usr/$(get_libdir)/apulse"
+               patchelf --set-rpath "${apulselib}" "${ED}"${MOZILLA_FIVE_HOME}/libxul.so || die
+       fi
+
        # Create /usr/bin/firefox-bin
        dodir /usr/bin/
        local apulselib=$(usex pulseaudio "/usr/$(get_libdir)/apulse:" "")
@@ -167,7 +177,14 @@ pkg_postinst() {
        fi
 
        use ffmpeg || ewarn "USE=-ffmpeg : HTML5 video will not render without media-video/ffmpeg installed"
-       use pulseaudio || ewarn "USE=-pulseaudio : audio will not play without pulseaudio installed"
+
+       local HAS_AUDIO=0
+       use pulseaudio && HAS_AUDIO=1
+       use alsa && HAS_AUDIO=1
+
+       if [[ ${HAS_AUDIO} -eq 0 ]] ; then
+               ewarn "USE=-pulseaudio & USE=-alsa : For audio please either set USE=pulseaudio or USE=alsa!"
+       fi
 
        local show_doh_information