commit:     bfc291932bcbb73cce8aebf8d522778e1a417b1b
Author:     Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
AuthorDate: Sat May  2 15:01:14 2020 +0000
Commit:     Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
CommitDate: Sat May  2 17:11:39 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=bfc29193

media-libs/alsa-lib: Fix PCM device reordering bug

Thanks-to: Alan Swanson <reiver <AT> improbability.net>
Closes: https://bugs.gentoo.org/718106
Package-Manager: Portage-2.3.99, Repoman-2.3.22
Signed-off-by: Andreas Sturmlechner <asturm <AT> gentoo.org>

 media-libs/alsa-lib/alsa-lib-1.2.2-r1.ebuild       |  83 ++++++++++++++++
 ...lsa-lib-1.2.2-change-order-of-pcm-devices.patch |  80 +++++++++++++++
 .../alsa-lib-1.2.2-namehint-add-omit_noargs.patch  | 108 +++++++++++++++++++++
 3 files changed, 271 insertions(+)

diff --git a/media-libs/alsa-lib/alsa-lib-1.2.2-r1.ebuild 
b/media-libs/alsa-lib/alsa-lib-1.2.2-r1.ebuild
new file mode 100644
index 00000000000..d00305137f2
--- /dev/null
+++ b/media-libs/alsa-lib/alsa-lib-1.2.2-r1.ebuild
@@ -0,0 +1,83 @@
+# Copyright 1999-2020 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+PYTHON_COMPAT=( python2_7 python3_{6,7,8} )
+inherit autotools multilib-minimal python-single-r1
+
+DESCRIPTION="Advanced Linux Sound Architecture Library"
+HOMEPAGE="https://alsa-project.org/";
+SRC_URI="https://www.alsa-project.org/files/pub/lib/${P}.tar.bz2";
+
+LICENSE="LGPL-2.1"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~sparc ~x86 
~amd64-linux ~x86-linux"
+IUSE="alisp debug doc elibc_uclibc python +thread-safety"
+
+REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )"
+
+BDEPEND="doc? ( >=app-doc/doxygen-1.2.6 )"
+RDEPEND="python? ( ${PYTHON_DEPS} )"
+DEPEND="${RDEPEND}"
+
+PATCHES=(
+       "${FILESDIR}/${PN}-1.1.6-missing_files.patch" #652422
+       "${FILESDIR}/${P}-change-order-of-pcm-devices.patch" #718106
+       "${FILESDIR}/${P}-namehint-add-omit_noargs.patch" #718106
+)
+
+pkg_setup() {
+       use python && python-single-r1_pkg_setup
+}
+
+src_prepare() {
+       find . -name Makefile.am -exec sed -i -e '/CFLAGS/s:-g -O2::' {} + || 
die
+       # https://bugs.gentoo.org/509886
+       if use elibc_uclibc ; then
+               sed -i -e 's:oldapi queue_timer:queue_timer:' test/Makefile.am 
|| die
+       fi
+       # https://bugs.gentoo.org/545950
+       sed -i -e '5s:^$:\nAM_CPPFLAGS = -I$(top_srcdir)/include:' 
test/lsb/Makefile.am || die
+       default
+       eautoreconf
+}
+
+multilib_src_configure() {
+       local myeconfargs=(
+               --disable-maintainer-mode
+               --disable-resmgr
+               --enable-aload
+               --enable-rawmidi
+               --enable-seq
+               --enable-shared
+               # enable Python only on final ABI
+               $(multilib_native_use_enable python)
+               $(use_enable alisp)
+               $(use_enable thread-safety)
+               $(use_with debug)
+               $(usex elibc_uclibc --without-versioned '')
+       )
+
+       ECONF_SOURCE="${S}" econf "${myeconfargs[@]}"
+}
+
+multilib_src_compile() {
+       emake
+
+       if multilib_is_native_abi && use doc; then
+               emake doc
+               grep -FZrl "${S}" doc/doxygen/html | \
+                       xargs -0 sed -i -e "s:${S}::" || die
+       fi
+}
+
+multilib_src_install() {
+       multilib_is_native_abi && use doc && local HTML_DOCS=( 
doc/doxygen/html/. )
+       default
+}
+
+multilib_src_install_all() {
+       find "${ED}" -type f \( -name '*.a' -o -name '*.la' \) -delete || die
+       dodoc ChangeLog doc/asoundrc.txt NOTES TODO
+}

diff --git 
a/media-libs/alsa-lib/files/alsa-lib-1.2.2-change-order-of-pcm-devices.patch 
b/media-libs/alsa-lib/files/alsa-lib-1.2.2-change-order-of-pcm-devices.patch
new file mode 100644
index 00000000000..b21e184f877
--- /dev/null
+++ b/media-libs/alsa-lib/files/alsa-lib-1.2.2-change-order-of-pcm-devices.patch
@@ -0,0 +1,80 @@
+From 27c7927842a691ef13724cd16fb26264680c6aa2 Mon Sep 17 00:00:00 2001
+From: Jaroslav Kysela <pe...@perex.cz>
+Date: Sat, 29 Feb 2020 10:30:37 +0100
+Subject: [PATCH] conf: change the order of PCM devices in alsa.conf
+
+Appearently, some applications use the first device for probe or so.
+
+Fixes: https://github.com/alsa-project/alsa-lib/issues/27
+
+Signed-off-by: Jaroslav Kysela <pe...@perex.cz>
+---
+ src/conf/alsa.conf | 46 +++++++++++++++++++++++-----------------------
+ 1 file changed, 23 insertions(+), 23 deletions(-)
+
+diff --git a/src/conf/alsa.conf b/src/conf/alsa.conf
+index 0998058..a091b81 100644
+--- a/src/conf/alsa.conf
++++ b/src/conf/alsa.conf
+@@ -119,29 +119,6 @@ defaults.timer.subdevice 0
+ #  PCM interface
+ #
+ 
+-# redirect to load-on-demand extended pcm definitions
+-pcm.cards cards.pcm
+-
+-pcm.default cards.pcm.default
+-pcm.sysdefault cards.pcm.default
+-pcm.front cards.pcm.front
+-pcm.rear cards.pcm.rear
+-pcm.center_lfe cards.pcm.center_lfe
+-pcm.side cards.pcm.side
+-pcm.surround21 cards.pcm.surround21
+-pcm.surround40 cards.pcm.surround40
+-pcm.surround41 cards.pcm.surround41
+-pcm.surround50 cards.pcm.surround50
+-pcm.surround51 cards.pcm.surround51
+-pcm.surround71 cards.pcm.surround71
+-pcm.iec958 cards.pcm.iec958
+-pcm.spdif iec958
+-pcm.hdmi cards.pcm.hdmi
+-pcm.dmix cards.pcm.dmix
+-pcm.dsnoop cards.pcm.dsnoop
+-pcm.modem cards.pcm.modem
+-pcm.phoneline cards.pcm.phoneline
+-
+ pcm.hw {
+       @args [ CARD DEV SUBDEV ]
+       @args.CARD {
+@@ -323,6 +300,29 @@ pcm.null {
+       }
+ }
+ 
++# redirect to load-on-demand extended pcm definitions
++pcm.cards cards.pcm
++
++pcm.default cards.pcm.default
++pcm.sysdefault cards.pcm.default
++pcm.front cards.pcm.front
++pcm.rear cards.pcm.rear
++pcm.center_lfe cards.pcm.center_lfe
++pcm.side cards.pcm.side
++pcm.surround21 cards.pcm.surround21
++pcm.surround40 cards.pcm.surround40
++pcm.surround41 cards.pcm.surround41
++pcm.surround50 cards.pcm.surround50
++pcm.surround51 cards.pcm.surround51
++pcm.surround71 cards.pcm.surround71
++pcm.iec958 cards.pcm.iec958
++pcm.spdif iec958
++pcm.hdmi cards.pcm.hdmi
++pcm.dmix cards.pcm.dmix
++pcm.dsnoop cards.pcm.dsnoop
++pcm.modem cards.pcm.modem
++pcm.phoneline cards.pcm.phoneline
++
+ #
+ #  Control interface
+ #
+-- 
+1.8.3.1

diff --git 
a/media-libs/alsa-lib/files/alsa-lib-1.2.2-namehint-add-omit_noargs.patch 
b/media-libs/alsa-lib/files/alsa-lib-1.2.2-namehint-add-omit_noargs.patch
new file mode 100644
index 00000000000..34ffa01f105
--- /dev/null
+++ b/media-libs/alsa-lib/files/alsa-lib-1.2.2-namehint-add-omit_noargs.patch
@@ -0,0 +1,108 @@
+From 09e78da4cade7b8fecb8f36717b85c456f2e5487 Mon Sep 17 00:00:00 2001
+From: Jaroslav Kysela <pe...@perex.cz>
+Date: Sun, 1 Mar 2020 19:57:06 +0100
+Subject: [PATCH] conf: namehint - add omit_noargs to the hint section
+
+Do not list simple surround devices in the namehint function by default.
+
+Fixes: https://github.com/alsa-project/alsa-lib/issues/27
+
+Signed-off-by: Jaroslav Kysela <pe...@perex.cz>
+---
+ src/conf/pcm/surround21.conf | 1 +
+ src/conf/pcm/surround40.conf | 1 +
+ src/conf/pcm/surround41.conf | 1 +
+ src/conf/pcm/surround50.conf | 1 +
+ src/conf/pcm/surround51.conf | 1 +
+ src/conf/pcm/surround71.conf | 1 +
+ src/control/namehint.c       | 6 +++++-
+ 7 files changed, 11 insertions(+), 1 deletion(-)
+
+diff --git a/src/conf/pcm/surround21.conf b/src/conf/pcm/surround21.conf
+index 1cf1b7a..ad19507 100644
+--- a/src/conf/pcm/surround21.conf
++++ b/src/conf/pcm/surround21.conf
+@@ -57,5 +57,6 @@ pcm.!surround21 {
+       hint {
+               description "2.1 Surround output to Front and Subwoofer 
speakers"
+               device_output $DEV
++              omit_noargs true
+       }
+ }
+diff --git a/src/conf/pcm/surround40.conf b/src/conf/pcm/surround40.conf
+index 9788ad4..7c61502 100644
+--- a/src/conf/pcm/surround40.conf
++++ b/src/conf/pcm/surround40.conf
+@@ -55,5 +55,6 @@ pcm.!surround40 {
+       hint {
+               description "4.0 Surround output to Front and Rear speakers"
+               device_output $DEV
++              omit_noargs true
+       }
+ }
+diff --git a/src/conf/pcm/surround41.conf b/src/conf/pcm/surround41.conf
+index 7b4ef3b..cb6c044 100644
+--- a/src/conf/pcm/surround41.conf
++++ b/src/conf/pcm/surround41.conf
+@@ -61,5 +61,6 @@ pcm.!surround41 {
+       hint {
+               description "4.1 Surround output to Front, Rear and Subwoofer 
speakers"
+               device_output $DEV
++              omit_noargs true
+       }
+ }
+diff --git a/src/conf/pcm/surround50.conf b/src/conf/pcm/surround50.conf
+index 7d9a9e7..70d5406 100644
+--- a/src/conf/pcm/surround50.conf
++++ b/src/conf/pcm/surround50.conf
+@@ -61,5 +61,6 @@ pcm.!surround50 {
+       hint {
+               description "5.0 Surround output to Front, Center and Rear 
speakers"
+               device_output $DEV
++              omit_noargs true
+       }
+ }
+diff --git a/src/conf/pcm/surround51.conf b/src/conf/pcm/surround51.conf
+index e67f007..d0236e4 100644
+--- a/src/conf/pcm/surround51.conf
++++ b/src/conf/pcm/surround51.conf
+@@ -57,5 +57,6 @@ pcm.!surround51 {
+       hint {
+               description "5.1 Surround output to Front, Center, Rear and 
Subwoofer speakers"
+               device_output $DEV
++              omit_noargs true
+       }
+ }
+diff --git a/src/conf/pcm/surround71.conf b/src/conf/pcm/surround71.conf
+index a26c3f3..66792dd 100644
+--- a/src/conf/pcm/surround71.conf
++++ b/src/conf/pcm/surround71.conf
+@@ -59,5 +59,6 @@ pcm.!surround71 {
+       hint {
+               description "7.1 Surround output to Front, Center, Side, Rear 
and Woofer speakers"
+               device_output $DEV
++              omit_noargs true
+       }
+ }
+diff --git a/src/control/namehint.c b/src/control/namehint.c
+index 60c48ae..169bd42 100644
+--- a/src/control/namehint.c
++++ b/src/control/namehint.c
+@@ -287,10 +287,14 @@ static int try_config(snd_config_t *config,
+                       err = -EINVAL;
+                       goto __cleanup;
+               }
++              if (list->card < 0 &&
++                  snd_config_search(cfg, "omit_noargs", &n) >= 0 &&
++                  snd_config_get_bool(n) > 0)
++                      goto __skip_add;
+               if (level == 1 &&
+                   snd_config_search(cfg, "show", &n) >= 0 &&
+                   snd_config_get_bool(n) <= 0)
+-                      goto __skip_add;
++                      goto __skip_add;
+               if (buf1 == NULL &&
+                   snd_config_search(cfg, "description", &n) >= 0 &&
+                   snd_config_get_string(n, &str) >= 0) {
+-- 
+1.8.3.1

Reply via email to