1 |
commit: 72f37fd76e4295b8cddc76026a9017cee85d5deb |
2 |
Author: Igor V. Kovalenko <igor.v.kovalenko <AT> gmail <DOT> com> |
3 |
AuthorDate: Thu Nov 24 22:06:36 2022 +0000 |
4 |
Commit: Mart Raudsepp <leio <AT> gentoo <DOT> org> |
5 |
CommitDate: Tue Nov 29 07:09:17 2022 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=72f37fd7 |
7 |
|
8 |
media-libs/libpulse: Clean up memfd on exec |
9 |
|
10 |
Upstream commit e650c2b33e4fefc0589751b3958bd3b5d3b423ac |
11 |
|
12 |
Signed-off-by: Igor V. Kovalenko <igor.v.kovalenko <AT> gmail.com> |
13 |
Closes: https://github.com/gentoo/gentoo/pull/28421 |
14 |
Signed-off-by: Mart Raudsepp <leio <AT> gentoo.org> |
15 |
|
16 |
.../files/pulseaudio-16.1-memfd-cleanup.patch | 28 +++ |
17 |
media-libs/libpulse/libpulse-16.1-r2.ebuild | 208 +++++++++++++++++++++ |
18 |
2 files changed, 236 insertions(+) |
19 |
|
20 |
diff --git a/media-libs/libpulse/files/pulseaudio-16.1-memfd-cleanup.patch b/media-libs/libpulse/files/pulseaudio-16.1-memfd-cleanup.patch |
21 |
new file mode 100644 |
22 |
index 000000000000..b24ab8943899 |
23 |
--- /dev/null |
24 |
+++ b/media-libs/libpulse/files/pulseaudio-16.1-memfd-cleanup.patch |
25 |
@@ -0,0 +1,28 @@ |
26 |
+commit e650c2b33e4fefc0589751b3958bd3b5d3b423ac |
27 |
+Author: Alistair Leslie-Hughes <leslie_alistair@×××××××.com> |
28 |
+Date: Thu Nov 3 09:22:48 2022 +1100 |
29 |
+ |
30 |
+ Ensure fds are closed when exec functions are used. |
31 |
+ |
32 |
+ When usng shm_open, FD_CLOEXEC is set explicitly. |
33 |
+ |
34 |
+ However when using memfd_create, we must pass the MFD_CLOEXEC flag |
35 |
+ to ensure the same fcntl value (FD_CLOEXEC) is set. |
36 |
+ |
37 |
+ Fixes #1394 |
38 |
+ |
39 |
+ Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/751> |
40 |
+ |
41 |
+diff --git a/src/pulsecore/shm.c b/src/pulsecore/shm.c |
42 |
+index e464f6bce..ff54dcb59 100644 |
43 |
+--- a/src/pulsecore/shm.c |
44 |
++++ b/src/pulsecore/shm.c |
45 |
+@@ -164,7 +164,7 @@ static int sharedmem_create(pa_shm *m, pa_mem_type_t type, size_t size, mode_t m |
46 |
+ #endif |
47 |
+ #ifdef HAVE_MEMFD |
48 |
+ case PA_MEM_TYPE_SHARED_MEMFD: |
49 |
+- fd = memfd_create("pulseaudio", MFD_ALLOW_SEALING); |
50 |
++ fd = memfd_create("pulseaudio", MFD_ALLOW_SEALING|MFD_CLOEXEC); |
51 |
+ break; |
52 |
+ #endif |
53 |
+ default: |
54 |
|
55 |
diff --git a/media-libs/libpulse/libpulse-16.1-r2.ebuild b/media-libs/libpulse/libpulse-16.1-r2.ebuild |
56 |
new file mode 100644 |
57 |
index 000000000000..773e74668690 |
58 |
--- /dev/null |
59 |
+++ b/media-libs/libpulse/libpulse-16.1-r2.ebuild |
60 |
@@ -0,0 +1,208 @@ |
61 |
+# Copyright 1999-2022 Gentoo Authors |
62 |
+# Distributed under the terms of the GNU General Public License v2 |
63 |
+ |
64 |
+EAPI="7" |
65 |
+ |
66 |
+MY_PV="${PV/_pre*}" |
67 |
+MY_P="pulseaudio-${MY_PV}" |
68 |
+inherit bash-completion-r1 gnome2-utils meson-multilib optfeature systemd udev |
69 |
+ |
70 |
+DESCRIPTION="Libraries for PulseAudio clients" |
71 |
+HOMEPAGE="https://www.freedesktop.org/wiki/Software/PulseAudio/" |
72 |
+ |
73 |
+if [[ ${PV} = 9999 ]]; then |
74 |
+ inherit git-r3 |
75 |
+ EGIT_BRANCH="master" |
76 |
+ EGIT_REPO_URI="https://gitlab.freedesktop.org/pulseaudio/pulseaudio" |
77 |
+else |
78 |
+ SRC_URI="https://freedesktop.org/software/pulseaudio/releases/${MY_P}.tar.xz" |
79 |
+ KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~ppc ~ppc64 ~riscv ~sparc ~x86 ~amd64-linux ~x86-linux" |
80 |
+fi |
81 |
+ |
82 |
+S="${WORKDIR}/${MY_P}" |
83 |
+ |
84 |
+LICENSE="LGPL-2.1+" |
85 |
+ |
86 |
+SLOT="0" |
87 |
+IUSE="+asyncns dbus doc +glib gtk selinux systemd test valgrind X" |
88 |
+RESTRICT="!test? ( test )" |
89 |
+ |
90 |
+# NOTE: libpcre needed in some cases, bug #472228 |
91 |
+# TODO: libatomic_ops is only needed on some architectures and conditions, and then at runtime too |
92 |
+RDEPEND=" |
93 |
+ dev-libs/libatomic_ops |
94 |
+ >=media-libs/libsndfile-1.0.20[${MULTILIB_USEDEP}] |
95 |
+ virtual/libc |
96 |
+ asyncns? ( >=net-libs/libasyncns-0.1[${MULTILIB_USEDEP}] ) |
97 |
+ dbus? ( >=sys-apps/dbus-1.4.12[${MULTILIB_USEDEP}] ) |
98 |
+ elibc_mingw? ( dev-libs/libpcre:3 ) |
99 |
+ glib? ( >=dev-libs/glib-2.28.0:2[${MULTILIB_USEDEP}] ) |
100 |
+ gtk? ( x11-libs/gtk+:3 ) |
101 |
+ selinux? ( sec-policy/selinux-pulseaudio ) |
102 |
+ systemd? ( sys-apps/systemd:= ) |
103 |
+ valgrind? ( dev-util/valgrind ) |
104 |
+ X? ( |
105 |
+ x11-libs/libX11[${MULTILIB_USEDEP}] |
106 |
+ >=x11-libs/libxcb-1.6[${MULTILIB_USEDEP}] |
107 |
+ ) |
108 |
+ !<media-sound/pulseaudio-15.0-r100 |
109 |
+" |
110 |
+ |
111 |
+DEPEND="${RDEPEND} |
112 |
+ test? ( >=dev-libs/check-0.9.10 ) |
113 |
+ X? ( x11-base/xorg-proto ) |
114 |
+" |
115 |
+ |
116 |
+# pulseaudio ships a bundled xmltoman, which uses XML::Parser |
117 |
+BDEPEND=" |
118 |
+ dev-lang/perl |
119 |
+ dev-perl/XML-Parser |
120 |
+ sys-devel/gettext |
121 |
+ sys-devel/m4 |
122 |
+ virtual/libiconv |
123 |
+ virtual/libintl |
124 |
+ virtual/pkgconfig |
125 |
+ doc? ( app-doc/doxygen ) |
126 |
+" |
127 |
+PDEPEND=" |
128 |
+ || ( |
129 |
+ media-video/pipewire[sound-server(+)] |
130 |
+ media-sound/pulseaudio-daemon |
131 |
+ media-sound/pulseaudio[daemon(+)] |
132 |
+ ) |
133 |
+" |
134 |
+ |
135 |
+DOCS=( NEWS README ) |
136 |
+ |
137 |
+# patches merged upstream, to be removed with 16.2 or later bump |
138 |
+PATCHES=( |
139 |
+ "${FILESDIR}"/pulseaudio-16.1-memfd-cleanup.patch |
140 |
+) |
141 |
+ |
142 |
+src_prepare() { |
143 |
+ default |
144 |
+ |
145 |
+ # disable autospawn by client |
146 |
+ sed -i -e 's:; autospawn = yes:autospawn = no:g' src/pulse/client.conf.in || die |
147 |
+ |
148 |
+ gnome2_environment_reset |
149 |
+} |
150 |
+ |
151 |
+multilib_src_configure() { |
152 |
+ local emesonargs=( |
153 |
+ --localstatedir="${EPREFIX}"/var |
154 |
+ |
155 |
+ -Ddaemon=false |
156 |
+ -Dclient=true |
157 |
+ $(meson_native_use_bool doc doxygen) |
158 |
+ -Dgcov=false |
159 |
+ # tests involve random modules, so just do them for the native # TODO: tests should run always |
160 |
+ $(meson_native_use_bool test tests) |
161 |
+ -Ddatabase=simple # Not used for non-daemon, simple database avoids external dep checks |
162 |
+ -Dstream-restore-clear-old-devices=true |
163 |
+ -Drunning-from-build-tree=false |
164 |
+ |
165 |
+ # Paths |
166 |
+ -Dmodlibexecdir="${EPREFIX}/usr/$(get_libdir)/pulseaudio/modules" # Was $(get_libdir)/${P} |
167 |
+ -Dsystemduserunitdir=$(systemd_get_userunitdir) |
168 |
+ -Dudevrulesdir="${EPREFIX}$(get_udevdir)/rules.d" |
169 |
+ -Dbashcompletiondir="$(get_bashcompdir)" # Alternatively DEPEND on app-shells/bash-completion for pkg-config to provide the value |
170 |
+ |
171 |
+ # Optional features |
172 |
+ -Dalsa=disabled |
173 |
+ $(meson_feature asyncns) |
174 |
+ -Davahi=disabled |
175 |
+ -Dbluez5=disabled |
176 |
+ -Dbluez5-gstreamer=disabled |
177 |
+ -Dbluez5-native-headset=false |
178 |
+ -Dbluez5-ofono-headset=false |
179 |
+ $(meson_feature dbus) |
180 |
+ -Delogind=disabled |
181 |
+ -Dfftw=disabled |
182 |
+ $(meson_feature glib) # WARNING: toggling this likely changes ABI |
183 |
+ -Dgsettings=disabled |
184 |
+ -Dgstreamer=disabled |
185 |
+ $(meson_native_use_feature gtk) |
186 |
+ -Dhal-compat=false |
187 |
+ -Dipv6=true |
188 |
+ -Djack=disabled |
189 |
+ -Dlirc=disabled |
190 |
+ -Dopenssl=disabled |
191 |
+ -Dorc=disabled |
192 |
+ -Doss-output=disabled |
193 |
+ -Dsamplerate=disabled # Matches upstream |
194 |
+ -Dsoxr=disabled |
195 |
+ -Dspeex=disabled |
196 |
+ $(meson_native_use_feature systemd) |
197 |
+ -Dtcpwrap=disabled |
198 |
+ -Dudev=disabled |
199 |
+ $(meson_native_use_feature valgrind) |
200 |
+ $(meson_feature X x11) |
201 |
+ |
202 |
+ # Echo cancellation |
203 |
+ -Dadrian-aec=false |
204 |
+ -Dwebrtc-aec=disabled |
205 |
+ ) |
206 |
+ |
207 |
+ if multilib_is_native_abi; then |
208 |
+ # Make padsp work for non-native ABI, supposedly only possible with glibc; |
209 |
+ # this is used by /usr/bin/padsp that comes from native build, thus we need |
210 |
+ # this argument for native build |
211 |
+ if use elibc_glibc; then |
212 |
+ emesonargs+=( -Dpulsedsp-location="${EPREFIX}"'/usr/\\$$LIB/pulseaudio' ) |
213 |
+ fi |
214 |
+ else |
215 |
+ emesonargs+=( -Dman=false ) |
216 |
+ if ! use elibc_glibc; then |
217 |
+ # Non-glibc multilib is probably non-existent but just in case: |
218 |
+ ewarn "padsp wrapper for OSS emulation will only work with native ABI applications!" |
219 |
+ fi |
220 |
+ fi |
221 |
+ |
222 |
+ meson_src_configure |
223 |
+} |
224 |
+ |
225 |
+multilib_src_compile() { |
226 |
+ meson_src_compile |
227 |
+ |
228 |
+ if multilib_is_native_abi; then |
229 |
+ if use doc; then |
230 |
+ einfo "Generating documentation ..." |
231 |
+ meson_src_compile doxygen |
232 |
+ fi |
233 |
+ fi |
234 |
+} |
235 |
+ |
236 |
+multilib_src_install() { |
237 |
+ # The files referenced in the DOCS array do not exist in the multilib source directory, |
238 |
+ # therefore clear the variable when calling the function that will access it. |
239 |
+ DOCS= meson_src_install |
240 |
+ |
241 |
+ # Upstream installs 'pactl' if client is built, with all symlinks except for |
242 |
+ # 'pulseaudio', 'pacmd' and 'pasuspender' which are installed if server is built. |
243 |
+ # This trips QA warning, workaround: |
244 |
+ # - install missing aliases in media-libs/libpulse (client build) |
245 |
+ # - remove corresponding symlinks in media-sound/pulseaudio-daemonclient (server build) |
246 |
+ bashcomp_alias pactl pulseaudio |
247 |
+ bashcomp_alias pactl pacmd |
248 |
+ bashcomp_alias pactl pasuspender |
249 |
+ |
250 |
+ if multilib_is_native_abi; then |
251 |
+ if use doc; then |
252 |
+ einfo "Installing documentation ..." |
253 |
+ docinto html |
254 |
+ dodoc -r doxygen/html/. |
255 |
+ fi |
256 |
+ fi |
257 |
+} |
258 |
+ |
259 |
+multilib_src_install_all() { |
260 |
+ einstalldocs |
261 |
+ |
262 |
+ find "${ED}" \( -name '*.a' -o -name '*.la' \) -delete || die |
263 |
+} |
264 |
+ |
265 |
+pkg_postinst() { |
266 |
+ optfeature_header "PulseAudio can be enhanced by installing the following:" |
267 |
+ use dbus && optfeature "restricted realtime capabilities via D-Bus" sys-auth/rtkit |
268 |
+} |