diff options
author | B. Watson <urchlay@slackware.uk> | 2025-02-15 08:53:21 +0700 |
---|---|---|
committer | Willy Sudiarto Raharjo <willysr@slackbuilds.org> | 2025-02-15 16:48:24 +0700 |
commit | fde4bcb762743e26ab1682ff2b43c04bb825f54e (patch) | |
tree | f7c0f2100c0e51b8968a265a94a4ec771cff5240 /audio | |
parent | 88f19078d9285d9886199d5fd2e9c90b996d14d4 (diff) |
audio/flac-opt: Added (Audio Codec).
Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
Diffstat (limited to 'audio')
-rw-r--r-- | audio/flac-opt/README | 39 | ||||
-rw-r--r-- | audio/flac-opt/flac-opt-dev.sh | 15 | ||||
-rw-r--r-- | audio/flac-opt/flac-opt.SlackBuild | 142 | ||||
-rw-r--r-- | audio/flac-opt/flac-opt.info | 10 | ||||
-rw-r--r-- | audio/flac-opt/flac-opt.sh | 20 | ||||
-rw-r--r-- | audio/flac-opt/slack-desc | 19 |
6 files changed, 245 insertions, 0 deletions
diff --git a/audio/flac-opt/README b/audio/flac-opt/README new file mode 100644 index 0000000000..193e83f09e --- /dev/null +++ b/audio/flac-opt/README @@ -0,0 +1,39 @@ +flac-opt (free lossless audio codec) + +flac is open source software that can reduce the amount of storage +space needed to store digital audio signals without needing to remove +information in doing so. This version of flac is newer than the one +included in Slackware, and is installed in /opt/flac-opt so it won't +conflict with Slackware's flac package. + +The main reason for using this is that this newer version of flac +supports multithreaded encoding (via the -j option), which speeds up +the process dramatically. Even without using -j, encodes about 25% +faster than Slackware's flac. + +Decoding speed is the same (and can't use multiple threads), so +recompiling e.g. media player apps to use this version of flac doesn't +make sense. + +After the package is installed, either log out & back in, or run +"source /etc/profile.d/flac-opt.sh" to put the new flac and metaflac +commands in your PATH. flac-opt.sh is installed +x by default. + +SlackBuild developers: if you're writing a SlackBuild that needs the +flac libraries in this package, put this somewhere near the top of +your build script (after the "set -e"): + + source /etc/profile.d/flac-opt-dev.sh + +The -dev file is not installed executable, to avoid conflicting with +the standard flac libraries. It can also be sourced in an interactive +shell, if needed, but DO NOT "chmod +x" this file. + +By default, flac-opt is built with assembly language optimizations. If +you get "illegal instruction" errors at runtime, rebuild the package +with ASM=no in the environment. This should only happen on elderly +(first-generation) x86_64 hardware, such as the original Athlon64. + +By default, flac-opt is built with upstream's default C optimization, +which is -O3. There's no reason this should bother anyone... but if it +does, you can built with FORCE_O2=yes in the environment. diff --git a/audio/flac-opt/flac-opt-dev.sh b/audio/flac-opt/flac-opt-dev.sh new file mode 100644 index 0000000000..7aed33a78b --- /dev/null +++ b/audio/flac-opt/flac-opt-dev.sh @@ -0,0 +1,15 @@ +# profile.d script for SBo flac-opt build, WTFPL, B. Watson. + +# Note: DO NOT chmod +x this file. It exists to be sourced only when +# actually needed, and can cause problems when not needed. + +Ptmp=@LIBDIR@/pkgconfig + +if [ -z "$PKG_CONFIG_PATH" ]; then + PKG_CONFIG_PATH="$Ptmp" +else + PKG_CONFIG_PATH="$Ptmp:$PKG_CONFIG_PATH" +fi + +export PKG_CONFIG_PATH +unset Ptmp diff --git a/audio/flac-opt/flac-opt.SlackBuild b/audio/flac-opt/flac-opt.SlackBuild new file mode 100644 index 0000000000..94a3bd70a1 --- /dev/null +++ b/audio/flac-opt/flac-opt.SlackBuild @@ -0,0 +1,142 @@ +#!/bin/bash + +# Slackware build script for flac-opt + +# Written by B. Watson (urchlay@slackware.uk) + +# Licensed under the WTFPL. See http://www.wtfpl.net/txt/copying/ for details. + +# Notes: +# - Not based on PV's flac.SlackBuild. Started with SBo template. +# - Static libraries, not shared, because they live in a weird prefix. +# - It's possible to export PREFIX=/whatever, but not documented in README +# because I really don't expect anyone to do this. +# - I include the API docs and examples even though PV leaves them +# out of his flac package. +# - Encoding really is about 25% faster than Slackware's older flac, even if +# you don't use the new -j option to run in parallel. With -j8 on my 8-core +# workstation, it's 4-5x as fast as the old flac. +# - It's possible to build with either autoconf or cmake. I tried both, +# didn't see any difference. Went with autoconf because it's more +# familiar. May change in the future, if upstream drops autoconf. +# - I see no advantage to building with -O2 rather than upstream's +# default -O3, but I added an option to use -O2 if you're that +# fanatical about using default CFLAGS. + +cd $(dirname $0) ; CWD=$(pwd) + +PRGNAM=flac-opt +SRCNAM=flac +VERSION=${VERSION:-1.5.0} +BUILD=${BUILD:-1} +TAG=${TAG:-_SBo} +PKGTYPE=${PKGTYPE:-tgz} + +if [ -z "$ARCH" ]; then + case "$( uname -m )" in + i?86) ARCH=i586 ;; + arm*) ARCH=arm ;; + *) ARCH=$( uname -m ) ;; + esac +fi + +if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then + echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE" + exit 0 +fi + +TMP=${TMP:-/tmp/SBo} +PKG=$TMP/package-$PRGNAM +OUTPUT=${OUTPUT:-/tmp} + +if [ "$ARCH" = "i586" ]; then + SLKCFLAGS="-march=i586 -mtune=i686" + LIBDIRSUFFIX="" +elif [ "$ARCH" = "i686" ]; then + SLKCFLAGS="-march=i686 -mtune=i686" + LIBDIRSUFFIX="" +elif [ "$ARCH" = "x86_64" -o "$ARCH" = "aarch64" ]; then + SLKCFLAGS="-fPIC" + LIBDIRSUFFIX="64" +else + SLKCFLAGS="" + LIBDIRSUFFIX="" +fi + +# upstream uses -O3, we'll go with that unless the user insists. +COPT=-O3 +[ "${FORCE_O2:-no}" = "yes" ] && COPT=-O2 +SLKCFLAGS="$COPT $SLKCFLAGS" + +set -e + +rm -rf $PKG +mkdir -p $TMP $PKG $OUTPUT +cd $TMP +rm -rf $SRCNAM-$VERSION +tar xvf $CWD/$SRCNAM-$VERSION.tar.xz +cd $SRCNAM-$VERSION +chown -R root:root . +find -L . -perm /111 -a \! -perm 755 -a -exec chmod -h 755 {} + -o \ + \! -perm /111 -a \! -perm 644 -a -exec chmod -h 644 {} + + +if [ "${ASM:-yes}" = "no" ]; then + ASMOPT=disable + WITHASM="WITHOUT" +else + ASMOPT=enable + WITHASM="WITH" +fi + +PREFIX=${PREFIX:-/opt/$PRGNAM} +DOCDIR=/usr/doc/$PRGNAM-$VERSION +PKGDOC=$PKG/$DOCDIR +LIBDIR=$PREFIX/lib$LIBDIRSUFFIX + +CFLAGS="$SLKCFLAGS" \ +CXXFLAGS="$SLKCFLAGS" \ +./configure \ + --disable-examples \ + --disable-werror \ + --$ASMOPT-asm-optimizations \ + --prefix=$PREFIX \ + --libdir=$LIBDIR \ + --sysconfdir=/etc \ + --localstatedir=/var \ + --mandir=$PREFIX/man \ + --docdir=/usr/doc/$PRGNAM-$VERSION \ + --disable-shared \ + --enable-static \ + --build=$ARCH-slackware-linux + +make V=1 +make install-strip DESTDIR=$PKG +rm -f $PKG/$PREFIX/lib*/*.la +gzip -9 $PKG/$PREFIX/man/man*/* + +PROF=$PKG/etc/profile.d +mkdir -p $PROF +for i in flac-opt.sh flac-opt-dev.sh; do + sed -e "s,@PREFIX@,$PREFIX,g" -e "s,@LIBDIR@,$LIBDIR,g" $CWD/$i > $PROF/$i +done +chmod 755 $PROF/flac-opt.sh + +# pkgconfig needs a bit of help. we do this so callers don't have to +# specify --static as a pkg-config option. +sed -i -e '/^Libs\.private/d' \ + -e '/^Libs:/s,$, -logg -lm,' \ + $PKG/$LIBDIR/pkgconfig/flac.pc + +# we didn't build the examples, but include their source in the doc dir. +mkdir -p $PKGDOC +cp -a examples/ AUTHORS *.md COPYING* $PKGDOC +cat $CWD/$PRGNAM.SlackBuild > $PKGDOC/$PRGNAM.SlackBuild + +mkdir -p $PKG/install +sed -e "s,@WITHASM@,$WITHASM," \ + -e "s,@PREFIX@,$PREFIX," \ + -e "s,@SLKCFLAGS@,$SLKCFLAGS," \ + $CWD/slack-desc > $PKG/install/slack-desc + +cd $PKG +/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE diff --git a/audio/flac-opt/flac-opt.info b/audio/flac-opt/flac-opt.info new file mode 100644 index 0000000000..1042e4e18f --- /dev/null +++ b/audio/flac-opt/flac-opt.info @@ -0,0 +1,10 @@ +PRGNAM="flac-opt" +VERSION="1.5.0" +HOMEPAGE="https://github.com/xiph/flac/" +DOWNLOAD="https://github.com/xiph/flac/releases/download/1.5.0/flac-1.5.0.tar.xz" +MD5SUM="0bb45bcf74338b00efeec121fff27367" +DOWNLOAD_x86_64="" +MD5SUM_x86_64="" +REQUIRES="" +MAINTAINER="B. Watson" +EMAIL="urchlay@slackware.uk" diff --git a/audio/flac-opt/flac-opt.sh b/audio/flac-opt/flac-opt.sh new file mode 100644 index 0000000000..5ede5e21af --- /dev/null +++ b/audio/flac-opt/flac-opt.sh @@ -0,0 +1,20 @@ +# profile.d script for SBo flac-opt build, WTFPL, B. Watson. + +# don't know if MANPATH might be set already, so cover both cases. + +Mtmp=@PREFIX@/man + +if [ -z "$MANPATH" ]; then + MANPATH="$Mtmp" +else + MANPATH="$Mtmp:$MANPATH" +fi + +unset Mtmp + +# PATH will already be set (in /etc/profile) so don't worry about it. + +PATH=@PREFIX@/bin:$PATH + +export PATH +export MANPATH diff --git a/audio/flac-opt/slack-desc b/audio/flac-opt/slack-desc new file mode 100644 index 0000000000..b182464253 --- /dev/null +++ b/audio/flac-opt/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 ':' except on otherwise blank lines. + + |-----handy-ruler------------------------------------------------------| +flac-opt: flac-opt (free lossless audio codec) +flac-opt: +flac-opt: flac is open source software that can reduce the amount of storage +flac-opt: space needed to store digital audio signals without needing to remove +flac-opt: information in doing so. This version of flac is newer than the one +flac-opt: included in Slackware, and is installed in /opt so it won't conflict +flac-opt: with Slackware's flac package. +flac-opt: +flac-opt: This package built @WITHASM@ assembly optimizations. +flac-opt: C flags: @SLKCFLAGS@. Install prefix: @PREFIX@ +flac-opt: |