summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Rees <maxcrees@me.com>2018-09-26 23:10:11 -0400
committerMax Rees <maxcrees@me.com>2018-09-26 23:10:11 -0400
commit6b79af49429a36d1d16df87642c3f1ecad146a7b (patch)
tree88e90f7f2bc9b18d27f1d6a398a8b056ef75af4b
parent8050c93e6c88718013d703925d33737d196470a4 (diff)
downloadpackages-6b79af49429a36d1d16df87642c3f1ecad146a7b.tar.gz
packages-6b79af49429a36d1d16df87642c3f1ecad146a7b.tar.bz2
packages-6b79af49429a36d1d16df87642c3f1ecad146a7b.tar.xz
packages-6b79af49429a36d1d16df87642c3f1ecad146a7b.zip
user/alsa-utils: new package
-rw-r--r--user/alsa-utils/APKBUILD49
-rw-r--r--user/alsa-utils/alsa.confd15
-rw-r--r--user/alsa-utils/alsa.initd88
-rw-r--r--user/alsa-utils/alsaconf.patch12
4 files changed, 164 insertions, 0 deletions
diff --git a/user/alsa-utils/APKBUILD b/user/alsa-utils/APKBUILD
new file mode 100644
index 000000000..7ecea8193
--- /dev/null
+++ b/user/alsa-utils/APKBUILD
@@ -0,0 +1,49 @@
+# Contributor: Leonardo Arena <rnalrd@alpinelinux.org>
+# Maintainer: Max Rees <maxcrees@me.com>
+pkgname=alsa-utils
+pkgver=1.1.6
+pkgrel=0
+pkgdesc="Advanced Linux Sound Architecture (ALSA) utilities"
+url="https://www.alsa-project.org/main/index.php/Main_Page"
+arch="all"
+options="!check" # No test suite.
+license="GPL-2.0+ AND LGPL-2.0+ AND ISC AND GPL-2.0-only"
+makedepends="alsa-lib-dev fftw-dev ncurses-dev pciutils-dev"
+depends="bash dialog"
+subpackages="$pkgname-doc $pkgname-dbg $pkgname-lang $pkgname-openrc"
+replaces="alsaconf"
+source="ftp://ftp.alsa-project.org/pub/utils/$pkgname-$pkgver.tar.bz2
+ alsaconf.patch
+ alsa.initd
+ alsa.confd
+"
+
+prepare() {
+ default_prepare
+ update_config_sub
+}
+
+build() {
+ cd "$builddir"
+ ./configure \
+ --build=$CBUILD \
+ --host=$CHOST \
+ --prefix=/usr \
+ --sysconfdir=/etc \
+ --mandir=/usr/share/man \
+ --localstatedir=/var \
+ --disable-xmlto
+ make
+}
+
+package() {
+ cd "$builddir"
+ make DESTDIR="$pkgdir" install
+ install -Dm755 ../alsa.initd "$pkgdir"/etc/init.d/alsa
+ install -Dm644 ../alsa.confd "$pkgdir"/etc/conf.d/alsa
+}
+
+sha512sums="24d0ffaeeccecb3276d7d35ef51e6de6026a63fa5a1a1e4605b024f54d8097717e97ec9d33cfe50830ad17e4a89268ca24b065039b0df7f9fbe02b570617aa58 alsa-utils-1.1.6.tar.bz2
+817215be6e9f103a8a187df5b1142c4d2e952f547a64579a9b8cfa58bd762d6a55bde75c0f66f018c0597744d07ccdb08216f7b368db464e36667cecedcc00f3 alsaconf.patch
+8a52e6363d5dcfb16e1e607e1af3e46a2148989689e5ab04caf05f84dc68b34cc003b1cf0945ce2c3670cc7f3ef0e40824f689f1efa2d09177c82b13571a7168 alsa.initd
+6e716e6230fd3d2c33e3cb2dbf572d632c9ac6452c1768388bea7d3ca22f7c72cf6bcd702580f45cb9089983582011c8b04cbdb4420d14fb988167b1391ea547 alsa.confd"
diff --git a/user/alsa-utils/alsa.confd b/user/alsa-utils/alsa.confd
new file mode 100644
index 000000000..d47edb124
--- /dev/null
+++ b/user/alsa-utils/alsa.confd
@@ -0,0 +1,15 @@
+# RESTORE_ON_START:
+# Do you want to restore your mixer settings? If not, your cards will be
+# muted.
+# no - Do not restore state
+# yes - Restore state
+
+RESTORE_ON_START="yes"
+
+# SAVE_ON_STOP:
+# Do you want to save changes made to your mixer volumes when alsasound
+# stops?
+# no - Do not save state
+# yes - Save state
+
+SAVE_ON_STOP="yes"
diff --git a/user/alsa-utils/alsa.initd b/user/alsa-utils/alsa.initd
new file mode 100644
index 000000000..e0a1215cf
--- /dev/null
+++ b/user/alsa-utils/alsa.initd
@@ -0,0 +1,88 @@
+#!/sbin/openrc-run
+# $Header: /var/cvsroot/gentoo-x86/media-sound/alsa-utils/files/alsasound.initd-r6,v 1.1 2014/06/23 21:34:42 ssuominen Exp $
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+alsastatedir=/var/lib/alsa
+alsascrdir=/etc/alsa.d
+alsahomedir=/var/run/alsasound
+
+extra_commands="save restore"
+
+depend() {
+ need localmount
+ after bootmisc modules isapnp coldplug hotplug
+}
+
+restore() {
+ ebegin "Restoring Mixer Levels"
+
+ checkpath -q -d -m 0700 -o root:root ${alsahomedir} || return 1
+
+ if [ ! -r "${alsastatedir}/asound.state" ] ; then
+ ewarn "No mixer config in ${alsastatedir}/asound.state, you have to unmute your card!"
+ eend 0
+ return 0
+ fi
+
+ local cards="$(sed -n -e 's/ *\([[:digit:]]*\) .*/\1/p' /proc/asound/cards)"
+ local CARDNUM
+ for cardnum in ${cards}; do
+ [ -e /dev/snd/controlC${cardnum} ] || sleep 2
+ [ -e /dev/snd/controlC${cardnum} ] || sleep 2
+ [ -e /dev/snd/controlC${cardnum} ] || sleep 2
+ [ -e /dev/snd/controlC${cardnum} ] || sleep 2
+ alsactl -E HOME="${alsahomedir}" -I -f "${alsastatedir}/asound.state" restore ${cardnum} \
+ || ewarn "Errors while restoring defaults, ignoring"
+ done
+
+ for ossfile in "${alsastatedir}"/oss/card*_pcm* ; do
+ [ -e "${ossfile}" ] || continue
+ # We use cat because I'm not sure if cp works properly on /proc
+ local procfile=${ossfile##${alsastatedir}/oss}
+ procfile="$(echo "${procfile}" | sed -e 's,_,/,g')"
+ if [ -e /proc/asound/"${procfile}"/oss ] ; then
+ cat "${ossfile}" > /proc/asound/"${procfile}"/oss
+ fi
+ done
+
+ eend 0
+}
+
+save() {
+ ebegin "Storing ALSA Mixer Levels"
+
+ checkpath -q -d -m 0700 -o root:root ${alsahomedir} || return 1
+
+ mkdir -p "${alsastatedir}"
+ if ! alsactl -E HOME="${alsahomedir}" -f "${alsastatedir}/asound.state" store; then
+ eerror "Error saving levels."
+ eend 1
+ return 1
+ fi
+
+ for ossfile in /proc/asound/card*/pcm*/oss; do
+ [ -e "${ossfile}" ] || continue
+ local device=${ossfile##/proc/asound/} ; device=${device%%/oss}
+ device="$(echo "${device}" | sed -e 's,/,_,g')"
+ mkdir -p "${alsastatedir}/oss/"
+ cp "${ossfile}" "${alsastatedir}/oss/${device}"
+ done
+
+ eend 0
+}
+
+start() {
+ if [ "${RESTORE_ON_START}" = "yes" ]; then
+ restore
+ fi
+
+ return 0
+}
+
+stop() {
+ if [ "${SAVE_ON_STOP}" = "yes" ]; then
+ save
+ fi
+ return 0
+}
diff --git a/user/alsa-utils/alsaconf.patch b/user/alsa-utils/alsaconf.patch
new file mode 100644
index 000000000..a7dec1c9a
--- /dev/null
+++ b/user/alsa-utils/alsaconf.patch
@@ -0,0 +1,12 @@
+diff -Naur alsa-utils-1.0.9a-orig/alsaconf/alsaconf.in alsa-utils-1.0.9a/alsaconf/alsaconf.in
+--- alsa-utils-1.0.9a-orig/alsaconf/alsaconf.in 2005-03-24 00:24:52.000000000 -0800
++++ alsa-utils-1.0.9a/alsaconf/alsaconf.in 2005-07-18 09:25:02.000000000 -0700
+@@ -65,6 +58,8 @@
+ distribution="redhat"
+ elif test -f /etc/fedora-release && grep -q "Fedora" /etc/fedora-release; then
+ distribution="fedora"
++elif test -f /etc/adelie-release; then
++ distribution="adelie"
+ elif [ -f /etc/slackware-version -o -f /etc/slamd64-version ]; then
+ distribution="slackware"
+ else