commit:     4be18842595f90be71425c4fb302ba118056f4f9
Author:     Pacho Ramos <pacho <AT> gentoo <DOT> org>
AuthorDate: Sun Jun 16 07:47:43 2024 +0000
Commit:     Pacho Ramos <pacho <AT> gentoo <DOT> org>
CommitDate: Sun Jun 16 07:53:08 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=4be18842

media-sound/bluez-alsa: add 4.2.0

It also moves to use media-libs/libfreeaptx

Closes: https://bugs.gentoo.org/933612
Closes: https://bugs.gentoo.org/933613
Bug: https://bugs.gentoo.org/791259
Signed-off-by: Pacho Ramos <pacho <AT> gentoo.org>

 media-sound/bluez-alsa/Manifest                    |   1 +
 media-sound/bluez-alsa/bluez-alsa-4.2.0.ebuild     | 120 +++++++++++++++
 .../bluez-alsa-4.2.0-fix-include-freeaptx.patch    |  31 ++++
 .../files/bluez-alsa-4.2.0-ldpreload.patch         | 164 +++++++++++++++++++++
 .../bluez-alsa-4.2.0-test-alsa-midi-checkdev.patch |  23 +++
 media-sound/bluez-alsa/metadata.xml                |   1 +
 6 files changed, 340 insertions(+)

diff --git a/media-sound/bluez-alsa/Manifest b/media-sound/bluez-alsa/Manifest
index 8cace7d0f186..f27a0cbd623a 100644
--- a/media-sound/bluez-alsa/Manifest
+++ b/media-sound/bluez-alsa/Manifest
@@ -1,3 +1,4 @@
 DIST bluez-alsa-3.1.0.tar.gz 179984 BLAKE2B 
b0bd5008d1bcc972577d8626970834934cc9424b4dff5c9ede1b1bfb0ac6c62c50dd8a7b94bdaa8884354379fb4fe06d758f620b2f42207d85f68da5064b3499
 SHA512 
8b2644cb2114569cc896869f22352386a9362eeacae823423a63d9b21198f561d4af796700fcd3267556bb69ff2575569474a1da8e3a645b5a2e779882c27cbf
 DIST bluez-alsa-4.0.0.tar.gz 230879 BLAKE2B 
998127cb4e03afc019679b80fc1ac7d56351aeb8274efe76a74d6c5600c4b8527d5463e864cc8f68c1fa82c1729ef38d8168e90e7092dfe5eaf5a7cf25ba4bfa
 SHA512 
8a79e5a1189db2d39b2d772cb8f8cd51ebb96b9bd91489556195e83dfd16f40a581dce68c5ad9e886b66cec8a03ae7f959e8288bb4c5c87ea5a2bbd6aee9c5f0
 DIST bluez-alsa-4.1.1.tar.gz 284244 BLAKE2B 
a46d22cd86e6b7483f95e0f60c9f23421d2c48e0c4741e3107da3800180b16a47dcf897bfa579796cfb84ecc16812f545844dbb77c768f094c5cfd46e1101835
 SHA512 
5e43846af5c7c30a3d81a704514076a73b1d8994db5ee8925a59b1b328f684c15188d45caf9358f59e57a0c200d644dc673bd1c44f7d48a51452776e01f022f8
+DIST bluez-alsa-4.2.0.tar.gz 326233 BLAKE2B 
7bea22d45e9897dd8dc62ee31bba381fb2e2dc616673d711ffb2144f9d03ff8312342f175256946cac828cc1ad04fc263ea11e0c0685e3e28e72c80357914f33
 SHA512 
1c8816d0baf031c5823fb49fac1409f4034f2f5cc8506ba1f377260cfc6437baa3f6ff1611eac72751f9d56c08f525dc43db05d30820baf394c75f3537d65162

diff --git a/media-sound/bluez-alsa/bluez-alsa-4.2.0.ebuild 
b/media-sound/bluez-alsa/bluez-alsa-4.2.0.ebuild
new file mode 100644
index 000000000000..03b8563b31e2
--- /dev/null
+++ b/media-sound/bluez-alsa/bluez-alsa-4.2.0.ebuild
@@ -0,0 +1,120 @@
+# Copyright 1999-2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+inherit autotools bash-completion-r1 multilib-minimal readme.gentoo-r1 systemd
+
+DESCRIPTION="Bluetooth Audio ALSA Backend"
+HOMEPAGE="https://github.com/Arkq/bluez-alsa";
+
+if [[ ${PV} == "9999" ]] ; then
+       inherit git-r3
+       EGIT_REPO_URI="https://github.com/Arkq/${PN}";
+else
+       SRC_URI="https://github.com/Arkq/${PN}/archive/v${PV}.tar.gz -> 
${P}.tar.gz"
+       KEYWORDS="~amd64 ~arm64 ~x86"
+fi
+
+LICENSE="MIT"
+SLOT="0"
+IUSE="aac aptx debug hcitop lame ldac liblc3 man mpg123 ofono static-libs 
systemd test unwind upower"
+
+RESTRICT="!test? ( test )"
+
+# bluez-alsa does not directly link to upower but
+# is using the upower interface via dbus calls.
+RDEPEND="
+       >=dev-libs/glib-2.58.2[${MULTILIB_USEDEP}]
+       >=media-libs/alsa-lib-1.1.2[${MULTILIB_USEDEP}]
+       >=media-libs/sbc-1.5[${MULTILIB_USEDEP}]
+       >=net-wireless/bluez-5.51[${MULTILIB_USEDEP}]
+       sys-apps/dbus[${MULTILIB_USEDEP}]
+       sys-libs/readline:0=
+       aac? ( >=media-libs/fdk-aac-0.1.1:=[${MULTILIB_USEDEP}] )
+       aptx? ( >=media-libs/libfreeaptx-0.1.1 )
+       hcitop? (
+               dev-libs/libbsd
+               sys-libs/ncurses:0=
+       )
+       lame? ( media-sound/lame[${MULTILIB_USEDEP}] )
+       ldac? ( >=media-libs/libldac-2.0.0 )
+       liblc3? ( >=media-sound/liblc3-1.0.0 )
+       mpg123? ( media-sound/mpg123[${MULTILIB_USEDEP}] )
+       ofono? ( net-misc/ofono )
+       systemd? ( sys-apps/systemd )
+       unwind? ( sys-libs/libunwind[${MULTILIB_USEDEP}] )
+       upower? ( sys-power/upower )
+"
+DEPEND="${RDEPEND}
+       test? (
+               >=dev-libs/check-0.11.0
+               media-libs/libsndfile
+       )
+"
+BDEPEND="
+       dev-util/gdbus-codegen
+       virtual/pkgconfig
+       man? ( virtual/pandoc )
+"
+
+PATCHES=(
+       "${FILESDIR}/${P}-fix-include-freeaptx.patch"
+       # https://github.com/arkq/bluez-alsa/issues/718
+       "${FILESDIR}/${P}-test-alsa-midi-checkdev.patch"
+       # https://github.com/arkq/bluez-alsa/issues/717
+       "${FILESDIR}/${P}-ldpreload.patch"
+)
+
+DOC_CONTENTS="Users can use this service when they are members of the 
\"audio\" group."
+
+src_prepare() {
+       default
+       eautoreconf
+}
+
+multilib_src_configure() {
+       local myeconfargs=(
+               --enable-cli
+               --enable-faststream
+               --enable-midi
+               --enable-rfcomm
+               --with-bash-completion="$(get_bashcompdir)"
+               $(use_enable aac)
+               $(use_enable debug)
+               $(use_enable lame mp3lame)
+               $(use_enable man manpages)
+               $(use_enable mpg123)
+               $(use_enable static-libs static)
+               $(use_enable systemd)
+               $(use_enable test)
+               $(use_with systemd systemdsystemunitdir 
$(systemd_get_systemunitdir))
+               $(multilib_native_use_enable aptx)
+               $(multilib_native_use_enable aptx aptx-hd)
+               $(multilib_native_use_with aptx libfreeaptx)
+               $(multilib_native_use_enable hcitop)
+               $(multilib_native_use_enable ldac)
+               $(multilib_native_use_enable liblc3 lc3-swb)
+               $(multilib_native_use_enable ofono)
+               $(multilib_native_use_enable upower)
+               $(use_with unwind libunwind)
+       )
+       ECONF_SOURCE="${S}" econf "${myeconfargs[@]}"
+}
+
+multilib_src_install_all() {
+       default
+       find "${ED}" -type f -name "*.la" -delete || die
+
+       newinitd "${FILESDIR}"/bluealsa-init.d bluealsa
+       newconfd "${FILESDIR}"/bluealsa-conf.d-2-r1 bluealsa
+
+       # Add config file to alsa datadir as well to preserve changes in /etc
+       insinto "/usr/share/alsa/alsa.conf.d/"
+       doins "src/asound/20-bluealsa.conf.in"
+
+       readme.gentoo_create_doc
+}
+
+pkg_postinst() {
+       readme.gentoo_print_elog
+}

diff --git 
a/media-sound/bluez-alsa/files/bluez-alsa-4.2.0-fix-include-freeaptx.patch 
b/media-sound/bluez-alsa/files/bluez-alsa-4.2.0-fix-include-freeaptx.patch
new file mode 100644
index 000000000000..5930b2b838ab
--- /dev/null
+++ b/media-sound/bluez-alsa/files/bluez-alsa-4.2.0-fix-include-freeaptx.patch
@@ -0,0 +1,31 @@
+https://github.com/arkq/bluez-alsa/commit/14a02d1b06d0ba34c5b61516d7a3c1d6fc467567
+
+From 14a02d1b06d0ba34c5b61516d7a3c1d6fc467567 Mon Sep 17 00:00:00 2001
+From: Jochen Sprickerhof <[email protected]>
+Date: Wed, 15 May 2024 08:37:53 +0200
+Subject: [PATCH] Fix include for freeaptx library
+
+---
+ src/codec-aptx.c | 6 +++++-
+ 1 file changed, 5 insertions(+), 1 deletion(-)
+
+diff --git a/src/codec-aptx.c b/src/codec-aptx.c
+index a3f056f..e69858d 100644
+--- a/src/codec-aptx.c
++++ b/src/codec-aptx.c
+@@ -21,7 +21,11 @@
+ # include <stdlib.h>
+ #endif
+ 
+-#include <openaptx.h>
++#if WITH_LIBFREEAPTX
++# include <freeaptx.h>
++#else
++# include <openaptx.h>
++#endif
+ 
+ #include "shared/log.h"
+ 
+-- 
+2.42.2
+

diff --git a/media-sound/bluez-alsa/files/bluez-alsa-4.2.0-ldpreload.patch 
b/media-sound/bluez-alsa/files/bluez-alsa-4.2.0-ldpreload.patch
new file mode 100644
index 000000000000..addb8cf614b3
--- /dev/null
+++ b/media-sound/bluez-alsa/files/bluez-alsa-4.2.0-ldpreload.patch
@@ -0,0 +1,164 @@
+From a51e0603c3c9657dbddc6f2d5e92b51209ed2d13 Mon Sep 17 00:00:00 2001
+From: Arkadiusz Bokowy <[email protected]>
+Date: Mon, 10 Jun 2024 17:36:32 +0200
+Subject: [PATCH] Fix LD_PRELOAD environment variable overwrite
+
+Fixes #717
+---
+ test/Makefile.am                 |  8 ++++----
+ test/inc/preload.inc             | 17 ++++-------------
+ test/inc/spawn.inc               |  3 +--
+ test/{aloader.c => libaloader.c} |  0
+ test/test-alsa-ctl.c             |  4 ++--
+ test/test-alsa-pcm.c             |  4 ++--
+ test/test-utils-aplay.c          |  4 ++--
+ test/test-utils-cli.c            |  4 ++--
+ 8 files changed, 17 insertions(+), 27 deletions(-)
+ rename test/{aloader.c => libaloader.c} (100%)
+
+diff --git a/test/Makefile.am b/test/Makefile.am
+index c120c29a6..cf844472c 100644
+--- a/test/Makefile.am
++++ b/test/Makefile.am
+@@ -57,12 +57,12 @@ check_PROGRAMS += test-msbc
+ endif
+ 
+ check_LTLIBRARIES = \
+-      aloader.la
+-aloader_la_LDFLAGS = \
++      libaloader.la
++libaloader_la_LDFLAGS = \
+       -rpath /nowhere \
+       -avoid-version \
+-      -shared -module
+-aloader_la_LIBADD = \
++      -shared
++libaloader_la_LIBADD = \
+       @ALSA_LIBS@
+ 
+ test_a2dp_SOURCES = \
+diff --git a/test/inc/preload.inc b/test/inc/preload.inc
+index 3dbb1522d..a6d0b9f09 100644
+--- a/test/inc/preload.inc
++++ b/test/inc/preload.inc
+@@ -2,7 +2,7 @@
+  * preload.inc
+  * vim: ft=c
+  *
+- * Copyright (c) 2016-2022 Arkadiusz Bokowy
++ * Copyright (c) 2016-2024 Arkadiusz Bokowy
+  *
+  * This file is a part of bluez-alsa.
+  *
+@@ -16,12 +16,10 @@
+ #include <string.h>
+ #include <unistd.h>
+ 
+-#include "shared/defs.h"
+-
+ #define LD_PRELOAD           "LD_PRELOAD"
+ #define LD_PRELOAD_SANITIZER "LD_PRELOAD_SANITIZER"
+ 
+-int preload(int argc, char * const argv[], char * const envp[], const char 
*filename) {
++int preload(int argc, char * const argv[], const char *filename) {
+       (void)argc;
+ 
+       const char *env_preload;
+@@ -40,17 +38,10 @@ int preload(int argc, char * const argv[], char * const 
envp[], const char *file
+ 
+       char app[1024];
+       char preload[1024];
+-      char *envp2[256] = { preload, NULL };
+-
+       char *dir = dirname(strncpy(app, argv[0], sizeof(app) - 1));
+       snprintf(preload, sizeof(preload), "%s=%s:%s/%s:%s",
+                       LD_PRELOAD, env_preload_sanitizer, dir, filename, 
env_preload);
+ 
+-      size_t i = 1, j = 0;
+-      while (i < ARRAYSIZE(envp2) - 1 && envp[j] != NULL)
+-              envp2[i++] = envp[j++];
+-      if (i == ARRAYSIZE(envp2) - 1 && envp[j] != NULL)
+-              fprintf(stderr, "WARNING: Couldn't forward ENV variables\n");
+-
+-      return execve(argv[0], argv, envp2);
++      putenv(preload);
++      return execv(argv[0], argv);
+ }
+diff --git a/test/inc/spawn.inc b/test/inc/spawn.inc
+index 4ac1b531d..14eac6a19 100644
+--- a/test/inc/spawn.inc
++++ b/test/inc/spawn.inc
+@@ -97,8 +97,7 @@ int spawn(struct spawn_process *sp, char *argv[], FILE 
*f_stdin, int flags) {
+                       close(pipe_stderr[1]);
+               }
+ 
+-              execv(argv[0], argv);
+-              return -1;
++              return execv(argv[0], argv);
+       }
+ 
+       close(pipe_stdout[1]);
+diff --git a/test/aloader.c b/test/libaloader.c
+similarity index 100%
+rename from test/aloader.c
+rename to test/libaloader.c
+diff --git a/test/test-alsa-ctl.c b/test/test-alsa-ctl.c
+index 2d3d03453..b0c0f3350 100644
+--- a/test/test-alsa-ctl.c
++++ b/test/test-alsa-ctl.c
+@@ -576,8 +576,8 @@ CK_START_TEST(test_alsa_high_level_control_interface) {
+ 
+ } CK_END_TEST
+ 
+-int main(int argc, char *argv[], char *envp[]) {
+-      preload(argc, argv, envp, ".libs/aloader.so");
++int main(int argc, char *argv[]) {
++      preload(argc, argv, ".libs/libaloader.so");
+ 
+       char *argv_0 = strdup(argv[0]);
+       snprintf(bluealsa_mock_path, sizeof(bluealsa_mock_path),
+diff --git a/test/test-alsa-pcm.c b/test/test-alsa-pcm.c
+index aaff9d1bf..724316869 100644
+--- a/test/test-alsa-pcm.c
++++ b/test/test-alsa-pcm.c
+@@ -1100,8 +1100,8 @@ CK_START_TEST(ba_test_playback_device_unplug) {
+ 
+ } CK_END_TEST
+ 
+-int main(int argc, char *argv[], char *envp[]) {
+-      preload(argc, argv, envp, ".libs/aloader.so");
++int main(int argc, char *argv[]) {
++      preload(argc, argv, ".libs/libaloader.so");
+ 
+       int opt;
+       const char *opts = "hD:c:f:r:";
+diff --git a/test/test-utils-aplay.c b/test/test-utils-aplay.c
+index e3a492851..7925a2710 100644
+--- a/test/test-utils-aplay.c
++++ b/test/test-utils-aplay.c
+@@ -307,8 +307,8 @@ CK_START_TEST(test_play_dbus_signals) {
+ 
+ } CK_END_TEST
+ 
+-int main(int argc, char *argv[], char *envp[]) {
+-      preload(argc, argv, envp, ".libs/aloader.so");
++int main(int argc, char *argv[]) {
++      preload(argc, argv, ".libs/libaloader.so");
+ 
+       char *argv_0 = strdup(argv[0]);
+       char *argv_0_dir = dirname(argv_0);
+diff --git a/test/test-utils-cli.c b/test/test-utils-cli.c
+index 53510e02e..378c6f2f3 100644
+--- a/test/test-utils-cli.c
++++ b/test/test-utils-cli.c
+@@ -461,8 +461,8 @@ CK_START_TEST(test_open) {
+ 
+ } CK_END_TEST
+ 
+-int main(int argc, char *argv[], char *envp[]) {
+-      preload(argc, argv, envp, ".libs/aloader.so");
++int main(int argc, char *argv[]) {
++      preload(argc, argv, ".libs/libaloader.so");
+ 
+       char *argv_0 = strdup(argv[0]);
+       char *argv_0_dir = dirname(argv_0);

diff --git 
a/media-sound/bluez-alsa/files/bluez-alsa-4.2.0-test-alsa-midi-checkdev.patch 
b/media-sound/bluez-alsa/files/bluez-alsa-4.2.0-test-alsa-midi-checkdev.patch
new file mode 100644
index 000000000000..ffb3dc6d09d8
--- /dev/null
+++ 
b/media-sound/bluez-alsa/files/bluez-alsa-4.2.0-test-alsa-midi-checkdev.patch
@@ -0,0 +1,23 @@
+From 4b0ec2e0e36b839161a4ef15da1c2a39ee325af4 Mon Sep 17 00:00:00 2001
+From: Arkadiusz Bokowy <[email protected]>
+Date: Wed, 5 Jun 2024 22:30:17 +0200
+Subject: [PATCH] Check for sequencer read/write access before test
+
+Fixes #718
+---
+ test/test-alsa-midi.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/test/test-alsa-midi.c b/test/test-alsa-midi.c
+index 45e09d73..7ee80f96 100644
+--- a/test/test-alsa-midi.c
++++ b/test/test-alsa-midi.c
+@@ -161,7 +161,7 @@ int main(int argc, char *argv[]) {
+ 
+       /* Check whether current host supports ALSA sequencer. If not, then
+        * there is no point in running this test, because it will fail. */
+-      if (access("/dev/snd/seq", F_OK) != 0) {
++      if (access("/dev/snd/seq", F_OK | R_OK | W_OK) != 0) {
+               warn("ALSA sequencer not available, skipping test!");
+               return 77 /* magic number for skipping tests */;
+       }

diff --git a/media-sound/bluez-alsa/metadata.xml 
b/media-sound/bluez-alsa/metadata.xml
index 5533720929d0..9159f5db1c7a 100644
--- a/media-sound/bluez-alsa/metadata.xml
+++ b/media-sound/bluez-alsa/metadata.xml
@@ -9,6 +9,7 @@
     <flag name="aptx">aptX (HD) over Bluetooth (many Android compatible 
headphones)</flag>
     <flag name="hcitop">Enable top-like monitoring tool for HCI</flag>
     <flag name="ldac">Enable support for AOSP <pkg>media-libs/libldac</pkg> 
dispatcher</flag>
+    <flag name="liblc3">Enable LC3 support</flag>
     <flag name="mpg123">Enable support for MPEG audio playback via 
<pkg>media-sound/mpg123</pkg></flag>
     <flag name="ofono">Enable ofono elephony support</flag>
   </use>

Reply via email to