Gentoo Archives: gentoo-commits

From: Andrew Savchenko <bircoph@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: media-sound/apulse/, media-sound/apulse/files/
Date: Sun, 10 May 2020 22:28:22
Message-Id: 1589149682.e5cea54453c0241f41e2a001225c193f829d947d.bircoph@gentoo
1 commit: e5cea54453c0241f41e2a001225c193f829d947d
2 Author: Andrew Savchenko <bircoph <AT> gentoo <DOT> org>
3 AuthorDate: Sun May 10 22:26:03 2020 +0000
4 Commit: Andrew Savchenko <bircoph <AT> gentoo <DOT> org>
5 CommitDate: Sun May 10 22:28:02 2020 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e5cea544
7
8 media-sound/apulse: version bump
9
10 - Update to 0.1.13
11 - Bump to EAPI 7
12 - Migrate from cmake-utils to cmake eclass
13 - Use upstream full requests:
14 - Check key before removal from hash table
15 - Improve man page
16
17 Closes: https://bugs.gentoo.org/720340
18 Package-Manager: Portage-2.3.82, Repoman-2.3.20
19 Signed-off-by: Andrew Savchenko <bircoph <AT> gentoo.org>
20
21 media-sound/apulse/Manifest | 1 +
22 media-sound/apulse/apulse-0.1.13.ebuild | 64 ++++++++++++++++++++++
23 .../apulse/files/check-key-before-remove.patch | 54 ++++++++++++++++++
24 media-sound/apulse/files/man.patch | 30 ++++++++++
25 4 files changed, 149 insertions(+)
26
27 diff --git a/media-sound/apulse/Manifest b/media-sound/apulse/Manifest
28 index f5ce430e94d..82ac13350e9 100644
29 --- a/media-sound/apulse/Manifest
30 +++ b/media-sound/apulse/Manifest
31 @@ -1 +1,2 @@
32 DIST apulse-0.1.12.tar.gz 117220 BLAKE2B 04d88a298ff5e21e19fda1979ebbc96a6441f83212d6903a004a54ee360276985e66b637571a76e3fe6821d42762ac515b02a8a2cb0149a66f3150e34bd0d9b7 SHA512 9fe39ab93e90d7ec589c7632bf439bfc7fe8bbd0792ce1197ec8547fbe1901fec50facdf33c55cfbadbc1af4414fdf48f1f241406903a8f15f445b97dca7076a
33 +DIST apulse-0.1.13.tar.gz 117369 BLAKE2B 8cf527daf21420a72e46968a3b07ab61029f404a2b6574ac1f08dd40528f3e6e4baf7e38f5914b0c89252e16eec5e8f3722be51e5a61b6a71c683e994740b4bf SHA512 366385ae2304f7ff697ba70951d0753a5b1630310922e3763fd0813a73e0b4088b715135295aa2fa9111b8edcf91d82849dc31346b292b2e9db598bcdd47b007
34
35 diff --git a/media-sound/apulse/apulse-0.1.13.ebuild b/media-sound/apulse/apulse-0.1.13.ebuild
36 new file mode 100644
37 index 00000000000..6641e6bb6c8
38 --- /dev/null
39 +++ b/media-sound/apulse/apulse-0.1.13.ebuild
40 @@ -0,0 +1,64 @@
41 +# Copyright 1999-2020 Gentoo Authors
42 +# Distributed under the terms of the GNU General Public License v2
43 +
44 +EAPI=7
45 +
46 +CMAKE_ECLASS=cmake
47 +inherit multilib cmake-multilib
48 +
49 +DESCRIPTION="PulseAudio emulation for ALSA"
50 +HOMEPAGE="https://github.com/i-rinat/apulse"
51 +SRC_URI="https://github.com/i-rinat/${PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz"
52 +
53 +LICENSE="MIT LGPL-2.1"
54 +SLOT="0"
55 +KEYWORDS="~amd64 ~x86"
56 +
57 +IUSE="debug sdk test"
58 +RESTRICT="!test? ( test )"
59 +
60 +DEPEND="dev-libs/glib:2[${MULTILIB_USEDEP}]
61 + media-libs/alsa-lib[${MULTILIB_USEDEP}]
62 + sdk? ( !media-sound/pulseaudio ) "
63 +RDEPEND="${DEPEND}
64 + !!media-plugins/alsa-plugins[pulseaudio]"
65 +
66 +PATCHES=(
67 + "${FILESDIR}/sdk.patch"
68 + "${FILESDIR}/check-key-before-remove.patch"
69 + "${FILESDIR}/man.patch"
70 +)
71 +
72 +src_prepare() {
73 + cmake_src_prepare
74 +
75 + if ! use sdk; then
76 + # Ensure all relevant libdirs are added, to support all ABIs
77 + DIRS=
78 + _add_dir() { DIRS="${EPREFIX}/usr/$(get_libdir)/apulse${DIRS:+:${DIRS}}"; }
79 + multilib_foreach_abi _add_dir
80 + sed -e "s#@@DIRS@@#${DIRS}#g" "${FILESDIR}"/apulse > "${T}"/apulse || die
81 + fi
82 +}
83 +
84 +multilib_src_configure() {
85 + local mycmakeargs=(
86 + "-DINSTALL_SDK=$(usex sdk)"
87 + "-DLOG_TO_STDERR=$(usex debug)"
88 + "-DWITH_TRACE=$(usex debug)"
89 + )
90 + cmake_src_configure
91 +}
92 +
93 +multilib_src_test() {
94 + emake check
95 +}
96 +
97 +multilib_src_install_all() {
98 + if ! use sdk; then
99 + _install_wrapper() { newbin "${BUILD_DIR}/apulse" "${CHOST}-apulse"; }
100 + multilib_foreach_abi _install_wrapper
101 + dobin "${T}/apulse"
102 + fi
103 + einstalldocs
104 +}
105
106 diff --git a/media-sound/apulse/files/check-key-before-remove.patch b/media-sound/apulse/files/check-key-before-remove.patch
107 new file mode 100644
108 index 00000000000..28fe0fc0d16
109 --- /dev/null
110 +++ b/media-sound/apulse/files/check-key-before-remove.patch
111 @@ -0,0 +1,54 @@
112 +From bf146f0d711ce3e48cdc8ba772039d843d590b47 Mon Sep 17 00:00:00 2001
113 +From: "Miouyouyou (Myy)" <myy@××××××××××.fr>
114 +Date: Sun, 20 Oct 2019 05:09:29 +0200
115 +Subject: [PATCH] stream: Check the key before invoking g_hash_table_remove
116 +
117 +Turns out that I hit a bug where pa_stream_unref would
118 +call g_hash_table_remove with a NULL key.
119 +
120 +Thanks for the lightweight and smooth error handling from
121 +Glib, g_hash_table_remove generated an ABORT call, crashing
122 +some Unity3D games I was trying to start.
123 +Now, you also CANNOT call g_hash_table_lookup with a NULL
124 +key. That also generate a crash... Ugh...
125 +
126 +So, yeah, we first check that the key is not 0, then check
127 +if the key is actually inside the Hash table and THEN remove
128 +it.
129 +
130 +Note, here's my ~/.asoundrc, just in case :
131 +defaults.pcm.!card Audio
132 +defaults.ctl.!card Audio
133 +
134 +Audio being :
135 +card 3: Audio [DigiHug USB Audio], device 0: USB Audio [USB Audio]
136 + Subdevices: 0/1
137 + Subdevice #0: subdevice #0
138 +card 3: Audio [DigiHug USB Audio], device 1: USB Audio [USB Audio #1]
139 + Subdevices: 1/1
140 + Subdevice #0: subdevice #0
141 +
142 +I'm using a FiiO device for sound output.
143 +
144 +Signed-off-by: Miouyouyou (Myy) <myy@××××××××××.fr>
145 +---
146 + src/apulse-stream.c | 6 +++++-
147 + 1 file changed, 5 insertions(+), 1 deletion(-)
148 +
149 +diff --git a/src/apulse-stream.c b/src/apulse-stream.c
150 +index 84b18bb..1de4885 100644
151 +--- a/src/apulse-stream.c
152 ++++ b/src/apulse-stream.c
153 +@@ -1019,7 +1019,11 @@ pa_stream_unref(pa_stream *s)
154 +
155 + s->ref_cnt--;
156 + if (s->ref_cnt == 0) {
157 +- g_hash_table_remove(s->c->streams_ht, GINT_TO_POINTER(s->idx));
158 ++ GHashTable * __restrict const streams_ht =
159 ++ s->c->streams_ht;
160 ++ void const * key = GINT_TO_POINTER(s->idx);
161 ++ if (key && g_hash_table_lookup(streams_ht, key))
162 ++ g_hash_table_remove(streams_ht, key);
163 + ringbuffer_free(s->rb);
164 + free(s->peek_buffer);
165 + free(s->write_buffer);
166
167 diff --git a/media-sound/apulse/files/man.patch b/media-sound/apulse/files/man.patch
168 new file mode 100644
169 index 00000000000..a26e32d8b9c
170 --- /dev/null
171 +++ b/media-sound/apulse/files/man.patch
172 @@ -0,0 +1,30 @@
173 +From 2c2bf366599d957837acbdf54eb300526fc125a1 Mon Sep 17 00:00:00 2001
174 +From: =?UTF-8?q?=C3=89rico=20Rolim?= <erico.erc@×××××.com>
175 +Date: Tue, 5 May 2020 14:24:52 -0300
176 +Subject: [PATCH] Add ENVIRONMENT to man-page.
177 +
178 +---
179 + man/apulse.1 | 10 ++++++++++
180 + 1 file changed, 10 insertions(+)
181 +
182 +diff --git a/man/apulse.1 b/man/apulse.1
183 +index cd67cf3..df75c60 100644
184 +--- a/man/apulse.1
185 ++++ b/man/apulse.1
186 +@@ -36,6 +36,16 @@ compatibility layer between OSS programs and \fBALSA\fR, \fBapulse\fR was
187 + designed to be compatibility layer between PulseAudio applications and
188 + \fBALSA\fR.
189 +
190 ++.SH ENVIRONMENT
191 ++
192 ++The following environment variables can be used to configure the devices used
193 ++by \fBapulse\fR. Try \fIhw:0,0\fR, \fIplughw:0,0\fR and the like.
194 ++Refer to the ALSA user guide for a full list of device names.
195 ++
196 ++\fIAPULSE_CAPTURE_DEVICE\fR: Can be used to configure the capture device.
197 ++
198 ++\fIAPULSE_PLAYBACK_DEVICE\fR: Can be used to configure the playback device.
199 ++
200 + .SH RETURN VALUE
201 +
202 + \fBapulse\fR is a simple shell wrapper script that calls \fBexec\fR on the