diff options
author | Ivan Kovmir <i@kovmir.eu> | 2023-06-01 21:25:42 +0100 |
---|---|---|
committer | Willy Sudiarto Raharjo <willysr@slackbuilds.org> | 2023-06-03 10:38:18 +0700 |
commit | fa525c42e553c0c2ed550bf51cfc920e2c050652 (patch) | |
tree | 3e3be044823bc0c757580ba960810816ef550182 /audio | |
parent | 4f4933e98d9f9870dc0aaee67a26e70023591909 (diff) |
audio/sndio: Added (small audio and MIDI framework)
Signed-off-by: bedlam <dave@slackbuilds.org>
Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
Diffstat (limited to 'audio')
-rw-r--r-- | audio/sndio/README | 8 | ||||
-rw-r--r-- | audio/sndio/README.SBo | 45 | ||||
-rw-r--r-- | audio/sndio/rc.sndiod | 57 | ||||
-rw-r--r-- | audio/sndio/slack-desc | 19 | ||||
-rw-r--r-- | audio/sndio/sndio.SlackBuild | 131 | ||||
-rw-r--r-- | audio/sndio/sndio.info | 10 |
6 files changed, 270 insertions, 0 deletions
diff --git a/audio/sndio/README b/audio/sndio/README new file mode 100644 index 0000000000000..31ad90d588a61 --- /dev/null +++ b/audio/sndio/README @@ -0,0 +1,8 @@ +Sndio is a small audio and MIDI framework part of the OpenBSD project +and ported to FreeBSD, Linux and NetBSD. It provides a lightweight audio +& MIDI server and a fully documented user-space API to access either the +server or the hardware directly in a uniform way. Sndio is designed to +work for desktop applications, but pays special attention to +synchronization mechanisms and reliability required by music +applications. Reliability through simplicity are part of the project +goals. diff --git a/audio/sndio/README.SBo b/audio/sndio/README.SBo new file mode 100644 index 0000000000000..5d52e64d383ac --- /dev/null +++ b/audio/sndio/README.SBo @@ -0,0 +1,45 @@ +sndio on Linux works on top of ALSA (or OSS, if THAT is what you have). + +Before you start using sndio, make sure to disable all other sound servers, +these include PulseAudio, PipeWire, Jack. + +Default slackware installation ships with PulseAudio over ALSA, so you have to +disable PulseAudio. To disable PulseAudio, run the following lines as root: + +``` +# Disable pulseaudio.desktop: +if ! grep -q "^Hidden=true$" /etc/xdg/autostart/pulseaudio.desktop ; then + echo "Hidden=true" >> /etc/xdg/autostart/pulseaudio.desktop +fi + +# Edit /etc/pulse/client.conf to disable autospawn: +sed -i "s/autospawn = yes/autospawn = no/g" /etc/pulse/client.conf +sed -i "s/allow-autospawn-for-root = yes/allow-autospawn-for-root = no/g" /etc/pulse/client.conf +``` + +Save the following as '~/.asoundrc': + +``` +# See https://www.alsa-project.org/wiki/Asoundrc for more details. +# Set default sound card to use. +pcm.!default { + type hw + card 0 +} + +# Set default sound cards to control via alsamixer. +ctl.!default { + type hw + card 0 +} +``` + +To start sndiod at boot, append the following snippet to '/etc/rc.d/rc.local': + +``` +if [ -x /etc/rc.d/rc.libvirt ]; then + /etc/rc.d/rc.libvirt start +fi +``` + +And make sure that file is executable. diff --git a/audio/sndio/rc.sndiod b/audio/sndio/rc.sndiod new file mode 100644 index 0000000000000..25cd33b30c94a --- /dev/null +++ b/audio/sndio/rc.sndiod @@ -0,0 +1,57 @@ +#!/bin/sh +# Start/stop/restart sndiod(8). + +_prefix='/usr' +_sndiod="$_prefix/bin/sndiod" +_pkill="$_prefix/bin/pkill" +_ps="$_prefix/bin/ps" +_grep="/bin/grep" + +# Start sndiod: +sndiod_start() { + if $_ps aux | $_grep -v grep | $_grep $_sndiod > /dev/null + then + echo 'sndiod is already running.' + else + $_sndiod + fi +} + +# Stop sndiod: +sndiod_stop() { + $_pkill -f $_sndiod +} + +# Restart sndiod: +sndiod_restart() { + sndiod_stop + sleep 1 + sndiod_start +} + +# Check if sndiod is running +sndiod_status() { + if $_ps aux | $_grep -v grep | $_grep $_sndiod > /dev/null + then + echo 'sndiod is running.' + else + echo 'sndiod is not running.' + fi +} + +case "$1" in +'start') + sndiod_start + ;; +'stop') + sndiod_stop + ;; +'restart') + sndiod_restart + ;; +'status') + sndiod_status + ;; +*) + echo "usage $0 start|stop|restart|status" +esac diff --git a/audio/sndio/slack-desc b/audio/sndio/slack-desc new file mode 100644 index 0000000000000..87cacbd87d712 --- /dev/null +++ b/audio/sndio/slack-desc @@ -0,0 +1,19 @@ +# HOW TO EDIT THIS FILE: +# The "handy ruler" below makes it easier to edit a package description. Line +# up the first '|' above the ':' following the base package name, and the '|' on +# the right side marks the last column you can put a character in. You must make +# exactly 11 lines for the formatting to be correct. It's also customary to +# leave one space after the ':'. + + |-----handy-ruler------------------------------------------------------| +sndio: sndio (small audio and MIDI framework) +sndio: +sndio: Sndio is a small audio and MIDI framework part of the OpenBSD project +sndio: and ported to FreeBSD, Linux and NetBSD. It provides a lightweight +sndio: audio & MIDI server and a fully documented user-space API to access +sndio: either the server or the hardware directly in a uniform way. +sndio: +sndio: +sndio: +sndio: +sndio: https://sndio.org/ diff --git a/audio/sndio/sndio.SlackBuild b/audio/sndio/sndio.SlackBuild new file mode 100644 index 0000000000000..b134b9ebc7f02 --- /dev/null +++ b/audio/sndio/sndio.SlackBuild @@ -0,0 +1,131 @@ +#!/bin/bash + +# Slackware build script for sndio + +# Copyright 2023 Ivan Kovmir <i@kovmir.eu> +# All rights reserved. +# +# Redistribution and use of this script, with or without modification, is +# permitted provided that the following conditions are met: +# +# 1. Redistributions of this script must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED +# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO +# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +cd "$(dirname "$0")" ; CWD=$(pwd) + +PRGNAM=sndio +VERSION=${VERSION:-1.9.0} +BUILD=${BUILD:-1} +TAG=${TAG:-_SBo} +PKGTYPE=${PKGTYPE:-tgz} +NAMVER=$PRGNAM-$VERSION +SNDIO_GID='17' # Slackware's 'audio' group. +SNDIO_UID='377' # A chosen ID for sndiod user. + +if [ -z "$ARCH" ]; then + case "$(uname -m)" in + i?86) ARCH=i586 ;; + arm*) ARCH=arm ;; + *) ARCH=$(uname -m) ;; + esac +fi + +if [ -n "${PRINT_PACKAGE_NAME}" ]; then + echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE" + exit 0 +fi + +TMP="${TMP:-/tmp/SBo}" +SRC="$TMP/$NAMVER" +PKG="$TMP/package-$PRGNAM" +OUTPUT="${OUTPUT:-/tmp}" + +# Bail out if user or group isn't valid on your system +# For slackbuilds.org, assigned postgres uid/gid are 377/377 +# See http://slackbuilds.org/uid_gid.txt +if ! grep ^sndiod: /etc/passwd 2>&1 > /dev/null; then + echo " You must have 'sndiod' user to run this script." + echo " # mkdir /var/run/sndiod" + echo " # useradd -u $SNDIO_UID -g $SNDIO_GID -d /var/run/sndiod sndiod" + exit 1 +fi + +if [ "$ARCH" = "i586" ]; then + SLKCFLAGS="-O2 -march=i586 -mtune=i686" +elif [ "$ARCH" = "i686" ]; then + SLKCFLAGS="-O2 -march=i686 -mtune=i686" +elif [ "$ARCH" = "x86_64" ]; then + SLKCFLAGS="-O2 -fPIC" +else + SLKCFLAGS="-O2" +fi + +set -e + +rm -rf "$PKG" +mkdir -p "$TMP" "$PKG" "$OUTPUT" +cd "$TMP" +rm -rf "$PRGNAM-$VERSION" +tar xvf "$CWD/$PRGNAM-$VERSION.tar.gz" +cd "$PRGNAM-$VERSION" +chown -R root:root . +chmod -R u+w,go+r-w,a-s . + +INSTPREFIX='/usr' +BINDIR="$INSTPREFIX/bin" # Binaries +LIBDIR="$INSTPREFIX/lib64" # Libraries +PKGCONFDIR="$LIBDIR/pkgconfig" # pkg-config(1) files +INCLUDEDIR="$INSTPREFIX/include" # Headers +MANDIR="$INSTPREFIX/man" # Man pages + +./configure \ + --bindir="$BINDIR" \ + --libdir="$LIBDIR" \ + --pkgconfdir="$PKGCONFDIR" \ + --includedir="$INCLUDEDIR" \ + --mandir="$MANDIR" +make +make DESTDIR="$PKG" PREFIX="$INSTPREFIX" install + +# Strip symbols. +find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \ + | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true + +# Compress man pages. +find "$PKG$INSTPREFIX/man" -type f -exec gzip {} +; + +# Some of the sndio's man pages are symlinks to other pages. Copressing man +# pages gives them '.gz' extension, thus, breaking symlinks. The following loop +# creates additional symlinks that redirect the exising links to compressed man +# pages. +linked_mans=('mio_open.3 sio_open.3 sioctl_open.3') +for man in $linked_mans +do + ln -s "$man.gz" "$PKG/usr/man/man3/$man" +done + +mkdir -p "$PKG/install" +mkdir -p "$PKG/usr/doc/$NAMVER" +mkdir -p "$PKG/etc/rc.d" +cat "$CWD/$PRGNAM.SlackBuild" > "$PKG/usr/doc/$NAMVER/$PRGNAM.SlackBuild" +cat "$CWD/README" > "$PKG/usr/doc/$NAMVER/README" +cat "$CWD/README.SBo" > "$PKG/usr/doc/$NAMVER/README.SBo" +cat "$CWD/slack-desc" > "$PKG/install/slack-desc" + +# rc script. +cat "$CWD/rc.sndiod" > "$PKG/etc/rc.d/rc.sndiod" +chmod 0755 "$PKG/etc/rc.d/rc.sndiod" + +cd "$PKG" +/sbin/makepkg -l y -c n "$OUTPUT/$NAMVER-$ARCH-$BUILD$TAG.$PKGTYPE" diff --git a/audio/sndio/sndio.info b/audio/sndio/sndio.info new file mode 100644 index 0000000000000..9deb6a2ef752d --- /dev/null +++ b/audio/sndio/sndio.info @@ -0,0 +1,10 @@ +PRGNAM="sndio" +VERSION="1.9.0" +HOMEPAGE="https://sndio.org/" +DOWNLOAD="https://sndio.org/sndio-1.9.0.tar.gz" +MD5SUM="13b4aa3fdb171c25f7a31241885b65e1" +DOWNLOAD_x86_64="" +MD5SUM_x86_64="" +REQUIRES="" +MAINTAINER="Ivan Kovmir" +EMAIL="i@kovmir.eu" |