diff --git a/alsa-lib/alsa-lib.SlackBuild b/alsa-lib/alsa-lib.SlackBuild new file mode 100755 index 0000000..28f5342 --- /dev/null +++ b/alsa-lib/alsa-lib.SlackBuild @@ -0,0 +1,159 @@ +#!/bin/bash + +# Copyright 2008, 2009, 2010, 2011, 2012, 2013, 2015, 2016, 2018, 2019, 2020, 2021 Patrick J. Volkerding, Sebeka, MN, USA +# 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) + +PKGNAM=alsa-lib +VERSION=${VERSION:-$(echo alsa-lib-*.tar.?z | rev | cut -f 3- -d . | cut -f 1 -d - | rev)} +BUILD=${BUILD:-1} + +NUMJOBS=${NUMJOBS:-" -j$(expr $(nproc) + 1) "} + +# Automatically determine the architecture we're building on: +if [ -z "$ARCH" ]; then + case "$( uname -m )" in + i?86) export ARCH=i586 ;; + arm*) export ARCH=arm ;; + # Unless $ARCH is already set, use uname -m for all other archs: + *) export ARCH=$( uname -m ) ;; + esac +fi + +TMP=${TMP:-/tmp} +PKG=$TMP/package-alsa-lib + +if [ "$ARCH" = "i586" ]; then + SLKCFLAGS="-O2 -march=i586 -mtune=i686" + LIBDIRSUFFIX="" +elif [ "$ARCH" = "s390" ]; then + SLKCFLAGS="-O2" + LIBDIRSUFFIX="" +elif [ "$ARCH" = "x86_64" ]; then + SLKCFLAGS="-O2 -fPIC" + LIBDIRSUFFIX="64" +else + SLKCFLAGS="-O2" + LIBDIRSUFFIX="" +fi + +# If this package is being built for ALSA (no PulseAudio), use the _alsa $TAG: +if [ ! -r /usr/lib${LIBDIRSUFFIX}/pkgconfig/libpulse.pc ]; then + TAG="_alsa" +fi + +# If the variable PRINT_PACKAGE_NAME is set, then this script will report what +# the name of the created package would be, and then exit. This information +# could be useful to other scripts. +if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then + echo "$PKGNAM-$VERSION-$ARCH-$BUILD$TAG.txz" + exit 0 +fi + +rm -rf $PKG +mkdir -p $TMP $PKG + +cd $TMP +rm -rf alsa-lib-$VERSION +tar xvf $CWD/alsa-lib-$VERSION.tar.?z || exit 1 +cd alsa-lib-$VERSION || exit 1 + +# Fix file missing in 1.1.6: +if [ ! -r src/conf/smixer.conf ]; then + cp -a $CWD/smixer.conf src/conf +fi + +# Untar the configuration files. We'll install them later. +( mkdir ucm-and-topology-configs + cd ucm-and-topology-configs + for file in $CWD/alsa-*conf*tar.lz ; do + tar xvf $file + mv $(basename $file | cut -f 1-3 -d -)-*/* . + rmdir $(basename $file | cut -f 1-3 -d -)-* + mv README.md README-$(echo $(basename $file) | cut -f 1-3 -d -) + done +) + +chown -R root:root . +find . \ + \( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 \) \ + -exec chmod 755 {} \+ -o \ + \( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \ + -exec chmod 644 {} \+ + +CFLAGS="$SLKCFLAGS" \ + ./configure \ + --libdir=/usr/lib${LIBDIRSUFFIX} \ + --enable-mixer-modules \ + --enable-topology \ + --enable-ucm \ + --build=$ARCH-slackware-linux || exit 1 + +make $NUMJOBS || exit 1 +make install DESTDIR=$PKG || exit 1 + +# Don't ship .la files: +rm -f $PKG/{,usr/}lib${LIBDIRSUFFIX}/*.la + +find $PKG | xargs file | grep -e "executable" -e "shared object" \ + | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null + +mkdir $PKG/etc +if [ "$TAG" = "_alsa" ]; then + # Ship an empty asound.conf for ALSA-only system: + cp -a $CWD/asound.conf.alsa $PKG/etc/asound.conf.new +else + # Redirect to PulseAudio: + cp -a $CWD/asound.conf.pulse $PKG/etc/asound.conf.new +fi +chmod 644 $PKG/etc/asound.conf.new +chown root:root $PKG/etc/asound.conf.new + +# Install ucm and topology configs: +( cd ucm-and-topology-configs ; tar cf - . ) | ( cd $PKG/usr/share/alsa ; tar xf -) + +# TODO? +# ( cd src/pcm/ext +# make jack +# make jack-install ) + +mkdir -p $PKG/usr/doc/alsa-lib-$VERSION +cp -a \ + INSTALL MEMORY-LEAK NOTES TODO \ + $PKG/usr/doc/alsa-lib-$VERSION +cp -a COPYING $PKG/usr/doc/alsa-lib-$VERSION/COPYING.lib +cp -a aserver/COPYING $PKG/usr/doc/alsa-lib-$VERSION/COPYING.aserver + +# If there's a ChangeLog, installing at least part of the recent history +# is useful, but don't let it get totally out of control: +if [ -r ChangeLog ]; then + DOCSDIR=$(echo $PKG/usr/doc/*-$VERSION) + cat ChangeLog | head -n 1000 > $DOCSDIR/ChangeLog + touch -r ChangeLog $DOCSDIR/ChangeLog +fi + +mkdir -p $PKG/install +cat $CWD/slack-desc > $PKG/install/slack-desc +cat $CWD/doinst.sh > $PKG/install/doinst.sh + +cd $PKG +/sbin/makepkg -l y -c n $TMP/alsa-lib-$VERSION-$ARCH-$BUILD$TAG.txz + diff --git a/alsa-lib/alsa-lib.url b/alsa-lib/alsa-lib.url new file mode 100644 index 0000000..1d4f43a --- /dev/null +++ b/alsa-lib/alsa-lib.url @@ -0,0 +1 @@ +ftp://ftp.alsa-project.org/pub diff --git a/alsa-lib/asound.conf.alsa b/alsa-lib/asound.conf.alsa new file mode 100644 index 0000000..4d81f43 --- /dev/null +++ b/alsa-lib/asound.conf.alsa @@ -0,0 +1 @@ +# ALSA system-wide config file diff --git a/alsa-lib/asound.conf.pulse b/alsa-lib/asound.conf.pulse new file mode 100644 index 0000000..d8c8c31 --- /dev/null +++ b/alsa-lib/asound.conf.pulse @@ -0,0 +1,4 @@ +# ALSA system-wide config file +# By default, redirect to PulseAudio: +pcm.default pulse +ctl.default pulse diff --git a/alsa-lib/doinst.sh b/alsa-lib/doinst.sh new file mode 100644 index 0000000..35c6f59 --- /dev/null +++ b/alsa-lib/doinst.sh @@ -0,0 +1,14 @@ +config() { + NEW="$1" + OLD="$(dirname $NEW)/$(basename $NEW .new)" + # If there's no config file by that name, mv it over: + if [ ! -r $OLD ]; then + mv $NEW $OLD + elif [ "$(cat $OLD | md5sum)" = "$(cat $NEW | md5sum)" ]; then + # toss the redundant copy + rm $NEW + fi + # Otherwise, we leave the .new copy for the admin to consider... +} + +config etc/asound.conf.new diff --git a/alsa-lib/slack-desc b/alsa-lib/slack-desc new file mode 100644 index 0000000..07ec7cf --- /dev/null +++ b/alsa-lib/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------------------------------------------------------| +alsa-lib: alsa-lib (Advanced Linux Sound Architecture library) +alsa-lib: +alsa-lib: The Advanced Linux Sound Architecture (ALSA) provides audio and MIDI +alsa-lib: functionality to the Linux operating system. This is the ALSA library +alsa-lib: (libasound) which is used by audio applications. +alsa-lib: +alsa-lib: For more information, see http://alsa-project.org +alsa-lib: +alsa-lib: +alsa-lib: +alsa-lib: diff --git a/alsa-lib/smixer.conf b/alsa-lib/smixer.conf new file mode 100644 index 0000000..f215661 --- /dev/null +++ b/alsa-lib/smixer.conf @@ -0,0 +1,13 @@ +_full smixer-python.so +usb { + searchl "USB" + lib smixer-usb.so +} +ac97 { + searchl "AC97a:" + lib smixer-ac97.so +} +hda { + searchl "HDA:" + lib smixer-hda.so +}