commit:     1b93e143543df348c34ad8c5e581823f3a5c53b4
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Thu Feb  6 22:00:05 2025 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Thu Feb  6 22:02:44 2025 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=1b93e143

media-sound/alsa-utils: install systemd units unconditionally, fix uninit var

Per the small file policy and for determinism.

Closes: https://bugs.gentoo.org/948469
Signed-off-by: Sam James <sam <AT> gentoo.org>

 media-sound/alsa-utils/alsa-utils-1.2.13-r2.ebuild | 102 +++++++++++++++++++++
 ....13-install-systemd-units-unconditionally.patch |  16 ++++
 .../files/alsa-utils-1.2.13-uninit-var.patch       |  29 ++++++
 3 files changed, 147 insertions(+)

diff --git a/media-sound/alsa-utils/alsa-utils-1.2.13-r2.ebuild 
b/media-sound/alsa-utils/alsa-utils-1.2.13-r2.ebuild
new file mode 100644
index 000000000000..9d9a0e66bd42
--- /dev/null
+++ b/media-sound/alsa-utils/alsa-utils-1.2.13-r2.ebuild
@@ -0,0 +1,102 @@
+# Copyright 1999-2025 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit autotools systemd udev
+
+DESCRIPTION="Advanced Linux Sound Architecture Utils (alsactl, alsamixer, 
etc.)"
+HOMEPAGE="https://alsa-project.org/wiki/Main_Page";
+SRC_URI="https://www.alsa-project.org/files/pub/utils/${P}.tar.bz2";
+
+LICENSE="GPL-2"
+SLOT="0.9"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~loong ~mips ~ppc ~ppc64 ~riscv 
~sparc ~x86"
+IUSE="bat doc +libsamplerate ieee1394 +ncurses nls selinux"
+
+DEPEND="
+       >=media-libs/alsa-lib-${PV}
+       libsamplerate? ( media-libs/libsamplerate )
+       ieee1394? ( media-libs/libffado )
+       ncurses? ( >=sys-libs/ncurses-5.7-r7:= )
+       bat? ( sci-libs/fftw:= )
+"
+RDEPEND="
+       ${DEPEND}
+       selinux? ( sec-policy/selinux-alsa )
+"
+BDEPEND="
+       virtual/pkgconfig
+       doc? ( app-text/xmlto )
+"
+
+PATCHES=(
+       "${FILESDIR}"/${PN}-1.1.8-missing_header.patch
+       "${FILESDIR}"/${P}-udev-restore.patch
+       "${FILESDIR}"/${P}-amdgpu-restore.patch
+       "${FILESDIR}"/${P}-uninit-var.patch
+       "${FILESDIR}"/${PN}-1.2.13-install-systemd-units-unconditionally.patch
+)
+
+src_prepare() {
+       default
+
+       # Needed for the systemd units patch
+       eautoreconf
+}
+
+src_configure() {
+       export ac_cv_lib_ffado_ffado_streaming_init=$(usex ieee1394)
+
+       local myeconfargs=(
+               # --disable-alsaconf because it doesn't work with 
sys-apps/kmod, bug #456214
+               --disable-alsaconf
+               --disable-maintainer-mode
+               --with-asound-state-dir="${EPREFIX}"/var/lib/alsa
+               --with-systemdsystemunitdir="$(systemd_get_systemunitdir)"
+               --with-udev-rules-dir="${EPREFIX}/$(get_udevdir)"/rules.d
+               $(use_enable bat)
+               $(use_enable libsamplerate alsaloop)
+               $(use_enable ncurses alsamixer)
+               $(use_enable nls)
+               $(usev !doc '--disable-xmlto')
+       )
+       econf "${myeconfargs[@]}"
+}
+
+src_install() {
+       default
+       dodoc seq/*/README.*
+
+       newinitd "${FILESDIR}"/alsasound.initd-r8 alsasound
+       newconfd "${FILESDIR}"/alsasound.confd-r4 alsasound
+
+       keepdir /var/lib/alsa
+
+       # ALSA lib parser.c:1266:(uc_mgr_scan_master_configs) error: could not
+       # scan directory /usr/share/alsa/ucm: No such file or directory
+       # alsaucm: unable to obtain card list: No such file or directory
+       keepdir /usr/share/alsa/ucm
+
+       find "${ED}" -type f -name '*.la' -delete || die
+}
+
+pkg_postinst() {
+       udev_reload
+
+       if [[ -z ${REPLACING_VERSIONS} ]] && ! systemd_is_booted ; then
+               elog
+               elog "To take advantage of the init script, and automate the 
process of"
+               elog "saving and restoring sound-card mixer levels you should"
+               elog "add alsasound to the boot runlevel. You can do this as"
+               elog "root like so:"
+               elog "# rc-update add alsasound boot"
+               ewarn
+               ewarn "The ALSA core should be built into the kernel or loaded 
through other"
+               ewarn "means. There is no longer any modular auto(un)loading in 
alsa-utils."
+       fi
+}
+
+pkg_postrm() {
+       udev_reload
+}

diff --git 
a/media-sound/alsa-utils/files/alsa-utils-1.2.13-install-systemd-units-unconditionally.patch
 
b/media-sound/alsa-utils/files/alsa-utils-1.2.13-install-systemd-units-unconditionally.patch
new file mode 100644
index 000000000000..8c26fa51819e
--- /dev/null
+++ 
b/media-sound/alsa-utils/files/alsa-utils-1.2.13-install-systemd-units-unconditionally.patch
@@ -0,0 +1,16 @@
+Install systemd unit files unconditionally rather than automagically
+based on whether systemd is installed at the time.
+
+Bug: https://bugs.gentoo.org/948469
+--- a/configure.ac
++++ b/configure.ac
+@@ -419,8 +419,7 @@ AC_ARG_WITH([systemdsystemunitdir],
+ if test "x$with_systemdsystemunitdir" != xno; then
+         AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir])
+ fi
+-AM_CONDITIONAL(HAVE_SYSTEMD, [test "$have_min_systemd" = "yes" \
+-        -a -n "$with_systemdsystemunitdir" -a "x$with_systemdsystemunitdir" 
!= xno ])
++AM_CONDITIONAL(HAVE_SYSTEMD, [test -n "$with_systemdsystemunitdir" -a 
"x$with_systemdsystemunitdir" != xno])
+ 
+ AC_ARG_WITH([asound-state-dir],
+         AS_HELP_STRING([--with-asound-state-dir=DIR], [Directory to place 
asound.state file in]),

diff --git a/media-sound/alsa-utils/files/alsa-utils-1.2.13-uninit-var.patch 
b/media-sound/alsa-utils/files/alsa-utils-1.2.13-uninit-var.patch
new file mode 100644
index 000000000000..d0b8fe1a46b6
--- /dev/null
+++ b/media-sound/alsa-utils/files/alsa-utils-1.2.13-uninit-var.patch
@@ -0,0 +1,29 @@
+https://github.com/alsa-project/alsa-utils/commit/242e00573ab0e8d40c95f9a8a19dc0085379d171
+
+From 242e00573ab0e8d40c95f9a8a19dc0085379d171 Mon Sep 17 00:00:00 2001
+From: Jaroslav Kysela <pe...@perex.cz>
+Date: Mon, 3 Feb 2025 20:28:58 +0100
+Subject: [PATCH] arecordmidi2: fix unitialization variable error in
+ read_ump_raw()
+
+Variable v should be initialized from the first word in the buffer.
+
+Signed-off-by: Jaroslav Kysela <pe...@perex.cz>
+---
+ seq/aplaymidi2/arecordmidi2.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/seq/aplaymidi2/arecordmidi2.c b/seq/aplaymidi2/arecordmidi2.c
+index 68a9d7d0a..467af6539 100644
+--- a/seq/aplaymidi2/arecordmidi2.c
++++ b/seq/aplaymidi2/arecordmidi2.c
+@@ -351,7 +351,7 @@ static int read_ump_raw(FILE *file, uint32_t *buf)
+ 
+       if (fread(buf, 4, 1, file) != 1)
+               return 0;
+-      v = be32toh(v);
++      v = be32toh(*buf);
+       num = snd_ump_packet_length(snd_ump_msg_hdr_type(v));
+       for (i = 1; i < num; i++) {
+               if (fread(buf + i, 4, 1, file) != 1)
+

Reply via email to