diff --git a/debian/changelog b/debian/changelog index 619d63e..2eeed16 100644 --- a/debian/changelog +++ b/debian/changelog @@ -3,6 +3,12 @@ * Enable full hardening build flags: - Add DEB_BUILD_MAINT_OPTIONS := hardening=+all - Strip -fPIC from Makefile + * Add squeezelite-pa compiled with PortAudio instead of ALSA + - Add new squeezelite-pa binary package + - Add Build-Depends on portaudio19-dev + - Add Makefile-portaudio.patch + - Tweak the squeezelite man page to document changed options + - Minor shuffling around to accommodate the new package -- Chris Boot Sun, 08 Dec 2013 09:42:57 +0000 diff --git a/debian/control b/debian/control index 012b44a..15b22d2 100644 --- a/debian/control +++ b/debian/control @@ -3,7 +3,8 @@ Priority: extra Maintainer: Chris Boot Build-Depends: debhelper (>= 9~), libasound2-dev, libflac-dev, libmad0-dev, - libvorbis-dev, libfaad-dev, libmpg123-dev, libsoxr-dev, libavformat-dev + libvorbis-dev, libfaad-dev, libmpg123-dev, libsoxr-dev, libavformat-dev, + portaudio19-dev Standards-Version: 3.9.5 Homepage: https://code.google.com/p/squeezelite/ Vcs-Git: git://anonscm.debian.org/collab-maint/squeezelite.git @@ -12,7 +13,8 @@ Package: squeezelite Architecture: any Depends: ${shlibs:Depends}, ${misc:Depends} -Description: lightweight headless Squeezebox emulator +Conflicts: squeezelite-pa +Description: lightweight headless Squeezebox emulator - ALSA version Squeezelite is a small headless Squeezebox emulator. It is aimed at supporting high quality audio including USB DAC based output at multiple sample rates. @@ -24,3 +26,21 @@ . This package is built with the resampling, ffmpeg and visualisation export options. It uses ALSA for audio output. + +Package: squeezelite-pa +Architecture: any +Depends: ${shlibs:Depends}, ${misc:Depends} +Conflicts: squeezelite +Provides: squeezelite +Description: lightweight headless Squeezebox emulator - PortAudio version + Squeezelite is a small headless Squeezebox emulator. It is aimed at + supporting high quality audio including USB DAC based output at multiple + sample rates. + . + It supports decoding PCM (WAV/AIFF), FLAC, MP3, Ogg, AAC, WMA and ALAC + audio formats. It can also resample audio, which allows squeezelite to + upsample the output to the highest sample rate supported by the output + device. + . + This package is built with the resampling, ffmpeg and visualisation export + options. It uses PortAudio for audio output. diff --git a/debian/man/squeezelite-pa.1 b/debian/man/squeezelite-pa.1 new file mode 100644 index 0000000..a85dd55 --- /dev/null +++ b/debian/man/squeezelite-pa.1 @@ -0,0 +1 @@ +.so man1/squeezelite.1 diff --git a/debian/man/squeezelite.1 b/debian/man/squeezelite.1 index e1d64f0..7c9f6a9 100644 --- a/debian/man/squeezelite.1 +++ b/debian/man/squeezelite.1 @@ -55,8 +55,11 @@ option in order to select a particular device or configuration to use for audio playback. .TP -.B \-a :

:: -Specify ALSA parameters used when opening an audio output device. +.B \-a +Specify ALSA or PortAudio parameters used when opening an audio output device. +For ALSA, the format +.B :

:: +is used where .B is the buffer time in milliseconds (values less than 500) or size in bytes (default .IR 40 ms); @@ -69,6 +72,7 @@ .B is whether to use mmap (possible values: .IR 0 " or " 1 ). +For PortAudio, the value is simply the target latency in milliseconds. .TP .B \-b : Specify internal stream and output buffer sizes in kilobytes. @@ -103,6 +107,7 @@ .B \-p Set real time priority of output thread (1-99; default .IR 45 ). +Not applicable when using PortAudio. .TP .B \-r Maximum sample rate for the output device; this is required if the ALSA output diff --git a/debian/patches/Makefile-portaudio.patch b/debian/patches/Makefile-portaudio.patch new file mode 100644 index 0000000..10b1c01 --- /dev/null +++ b/debian/patches/Makefile-portaudio.patch @@ -0,0 +1,32 @@ +Description: Simplify building of PortAudio based binary + +This Makefile patch conditionally adds libasound or libportaudio to the build +flags depending on whether -DPORTAUDIO is included in CFLAGS. + +Author: Chris Boot +Forwarded: no +Last-Update: 2013-12-08 + +--- a/Makefile ++++ b/Makefile +@@ -1,6 +1,6 @@ + # Cross compile support - create a Makefile which defines these three variables and then includes this Makefile... + CFLAGS += -Wall $(OPTS) +-LDFLAGS += -lasound -lpthread -lm -lrt ++LDFLAGS += -lpthread -lm -lrt + EXECUTABLE ?= squeezelite + + SOURCES = main.c slimproto.c utils.c output.c buffer.c stream.c decode.c process.c resample.c flac.c pcm.c mad.c vorbis.c faad.c mpg.c ffmpeg.c +@@ -23,6 +23,12 @@ + endif + endif + ++ifneq (,$(findstring -DPORTAUDIO, $(CFLAGS))) ++ LDFLAGS += -lportaudio ++else ++ LDFLAGS += -lasound ++endif ++ + OBJECTS = $(SOURCES:.c=.o) + + all: $(EXECUTABLE) diff --git a/debian/patches/series b/debian/patches/series index 4662bc6..fdf38dc 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -1 +1,2 @@ Makefile-tweaks.patch +Makefile-portaudio.patch diff --git a/debian/rules b/debian/rules index f1d1538..afc31ed 100755 --- a/debian/rules +++ b/debian/rules @@ -13,3 +13,23 @@ %: dh $@ + +override_dh_auto_clean: clean_squeezelite clean_squeezelite-pa +override_dh_auto_build: build_squeezelite build_squeezelite-pa + +override_dh_installinit: + dh_installinit --name=squeezelite + +clean_squeezelite: + dh_auto_clean -- EXECUTABLE=squeezelite + +build_squeezelite: clean_squeezelite + dh_auto_build -- EXECUTABLE=squeezelite + +clean_squeezelite-pa: + dh_auto_clean -- EXECUTABLE=squeezelite-pa + +build_squeezelite-pa: OPTS += -DPORTAUDIO +build_squeezelite-pa: LDFLAGS += -lportaudio +build_squeezelite-pa: clean_squeezelite-pa + dh_auto_build -- EXECUTABLE=squeezelite-pa diff --git a/debian/squeezelite-pa.install b/debian/squeezelite-pa.install new file mode 100644 index 0000000..46699df --- /dev/null +++ b/debian/squeezelite-pa.install @@ -0,0 +1 @@ +squeezelite-pa /usr/bin diff --git a/debian/squeezelite-pa.links b/debian/squeezelite-pa.links new file mode 100644 index 0000000..8f3f505 --- /dev/null +++ b/debian/squeezelite-pa.links @@ -0,0 +1 @@ +/usr/bin/squeezelite-pa /usr/bin/squeezelite diff --git a/debian/squeezelite-pa.lintian-overrides b/debian/squeezelite-pa.lintian-overrides new file mode 100644 index 0000000..9d3f14f --- /dev/null +++ b/debian/squeezelite-pa.lintian-overrides @@ -0,0 +1,4 @@ + +# There is no upstream changelog shipped with the package +squeezelite-pa binary: no-upstream-changelog + diff --git a/debian/squeezelite-pa.manpages b/debian/squeezelite-pa.manpages new file mode 100644 index 0000000..b794487 --- /dev/null +++ b/debian/squeezelite-pa.manpages @@ -0,0 +1,2 @@ +debian/man/squeezelite.1 +debian/man/squeezelite-pa.1 diff --git a/debian/squeezelite-pa.squeezelite.default b/debian/squeezelite-pa.squeezelite.default new file mode 120000 index 0000000..29cf801 --- /dev/null +++ b/debian/squeezelite-pa.squeezelite.default @@ -0,0 +1 @@ +squeezelite.squeezelite.default \ No newline at end of file diff --git a/debian/squeezelite-pa.squeezelite.init b/debian/squeezelite-pa.squeezelite.init new file mode 120000 index 0000000..5121855 --- /dev/null +++ b/debian/squeezelite-pa.squeezelite.init @@ -0,0 +1 @@ +squeezelite.squeezelite.init \ No newline at end of file diff --git a/debian/squeezelite.default b/debian/squeezelite.default deleted file mode 100644 index 79fc64d..0000000 --- a/debian/squeezelite.default +++ /dev/null @@ -1,19 +0,0 @@ -# Defaults for squeezelite initscript -# sourced by /etc/init.d/squeezelite -# installed at /etc/default/squeezelite by the maintainer scripts - -# The name for the squeezelite player: -SL_NAME="$(hostname -s)" - -# ALSA output device: -#SL_SOUNDCARD="default:CARD=Set" - -# Squeezebox server (Logitech Media Server): -# Uncomment the next line if you want to point squeezelite at the IP address of -# your squeezebox server. This is usually unnecessary as the server is -# automatically discovered. -#SB_SERVER_IP="192.168.x.y" - -# Additional options to pass to squeezelite: -# Please do not include -z to make squeezelite daemonise itself. -#SB_EXTRA_ARGS="" diff --git a/debian/squeezelite.init b/debian/squeezelite.init deleted file mode 100644 index 29a454c..0000000 --- a/debian/squeezelite.init +++ /dev/null @@ -1,128 +0,0 @@ -#!/bin/sh -### BEGIN INIT INFO -# Provides: squeezelite -# Required-Start: $network $remote_fs -# Required-Stop: $remote_fs -# Default-Start: 2 3 4 5 -# Default-Stop: 0 1 6 -# Short-Description: Lightweight headless Squeezebox emulator -# Description: Lightweight headless streaming audio player for Logitech's -# Squeezebox audio server -### END INIT INFO - -# Author: Chris Boot - -PATH=/sbin:/usr/sbin:/bin:/usr/bin -DESC="Squeezebox client" -NAME=squeezelite -DAEMON=/usr/bin/$NAME -PIDFILE=/run/$NAME.pid -SCRIPTNAME=/etc/init.d/$NAME - -# Exit if the package is not installed -[ -x "$DAEMON" ] || exit 0 - -# Read configuration variable file if it is present -[ -r /etc/default/$NAME ] && . /etc/default/$NAME - -# Load the VERBOSE setting and other rcS variables -. /lib/init/vars.sh - -# Define LSB log_* functions. -. /lib/lsb/init-functions - -# -# Function that starts the daemon/service -# -do_start() -{ - DAEMON_ARGS="" - - # add squeezelite name if set - if [ -n "$SL_NAME" ]; then - DAEMON_ARGS="${DAEMON_ARGS} -n ${SL_NAME}" - fi - - # add souncard setting if set - if [ -n "$SL_SOUNDCARD" ]; then - DAEMON_ARGS="${DAEMON_ARGS} -o ${SL_SOUNDCARD}" - fi - - # add squeezebox server ip address if set - if [ -n "$SB_SERVER_IP" ]; then - DAEMON_ARGS="${DAEMON_ARGS} -s ${SB_SERVER_IP}" - fi - - # add any other options given by the user - if [ -n "$SB_EXTRA_ARGS" ]; then - DAEMON_ARGS="${DAEMON_ARGS} ${SB_EXTRA_ARGS}" - fi - - # Return - # 0 if daemon has been started - # 1 if daemon was already running - # 2 if daemon could not be started - start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON \ - --test > /dev/null || return 1 - start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON \ - --background --make-pidfile -- $DAEMON_ARGS || return 2 -} - -# -# Function that stops the daemon/service -# -do_stop() -{ - # Return - # 0 if daemon has been stopped - # 1 if daemon was already stopped - # 2 if daemon could not be stopped - # other if a failure occurred - start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 \ - --pidfile $PIDFILE --name $NAME -} - -case "$1" in - start) - [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME" - do_start; RET=$? - case $RET in - 0|1) [ "$VERBOSE" != no ] && log_end_msg 0; exit 0 ;; - *) [ "$VERBOSE" != no ] && log_end_msg 1; exit 1 ;; - esac - ;; - stop) - [ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME" - do_stop; RET=$? - case $RET in - 0|1) [ "$VERBOSE" != no ] && log_end_msg 0; exit 0 ;; - *) [ "$VERBOSE" != no ] && log_end_msg 1; exit 1 ;; - esac - ;; - status) - status_of_proc "$DAEMON" "$NAME" - ;; - restart|force-reload) - log_daemon_msg "Restarting $DESC" "$NAME" - do_stop; RET=$? - case $RET in - 0|1) - do_start; RET=$? - case $RET in - 0) log_end_msg 0; exit 0 ;; - 1) log_end_msg 1; exit 1 ;; # Old process is still running - *) log_end_msg 1; exit 1 ;; # Failed to start - esac - ;; - *) - # Failed to stop - log_end_msg 1; exit 1 - ;; - esac - ;; - *) - echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}" >&2 - exit 3 - ;; -esac - diff --git a/debian/squeezelite.squeezelite.default b/debian/squeezelite.squeezelite.default new file mode 100644 index 0000000..79fc64d --- /dev/null +++ b/debian/squeezelite.squeezelite.default @@ -0,0 +1,19 @@ +# Defaults for squeezelite initscript +# sourced by /etc/init.d/squeezelite +# installed at /etc/default/squeezelite by the maintainer scripts + +# The name for the squeezelite player: +SL_NAME="$(hostname -s)" + +# ALSA output device: +#SL_SOUNDCARD="default:CARD=Set" + +# Squeezebox server (Logitech Media Server): +# Uncomment the next line if you want to point squeezelite at the IP address of +# your squeezebox server. This is usually unnecessary as the server is +# automatically discovered. +#SB_SERVER_IP="192.168.x.y" + +# Additional options to pass to squeezelite: +# Please do not include -z to make squeezelite daemonise itself. +#SB_EXTRA_ARGS="" diff --git a/debian/squeezelite.squeezelite.init b/debian/squeezelite.squeezelite.init new file mode 100644 index 0000000..448bbd5 --- /dev/null +++ b/debian/squeezelite.squeezelite.init @@ -0,0 +1,128 @@ +#!/bin/sh +### BEGIN INIT INFO +# Provides: squeezelite +# Required-Start: $network $remote_fs +# Required-Stop: $remote_fs +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: Lightweight headless Squeezebox emulator +# Description: Lightweight headless streaming audio player for Logitech's +# Squeezebox audio server +### END INIT INFO + +# Author: Chris Boot + +PATH=/sbin:/usr/sbin:/bin:/usr/bin +DESC="Squeezebox client" +NAME=squeezelite +DAEMON=/usr/bin/$NAME +PIDFILE=/run/$NAME.pid +SCRIPTNAME=/etc/init.d/$NAME + +# Exit if the package is not installed +[ -x "$DAEMON" ] || exit 0 + +# Read configuration variable file if it is present +[ -r /etc/default/$NAME ] && . /etc/default/$NAME + +# Load the VERBOSE setting and other rcS variables +. /lib/init/vars.sh + +# Define LSB log_* functions. +. /lib/lsb/init-functions + +# +# Function that starts the daemon/service +# +do_start() +{ + DAEMON_ARGS="" + + # add squeezelite name if set + if [ -n "$SL_NAME" ]; then + DAEMON_ARGS="${DAEMON_ARGS} -n ${SL_NAME}" + fi + + # add souncard setting if set + if [ -n "$SL_SOUNDCARD" ]; then + DAEMON_ARGS="${DAEMON_ARGS} -o ${SL_SOUNDCARD}" + fi + + # add squeezebox server ip address if set + if [ -n "$SB_SERVER_IP" ]; then + DAEMON_ARGS="${DAEMON_ARGS} -s ${SB_SERVER_IP}" + fi + + # add any other options given by the user + if [ -n "$SB_EXTRA_ARGS" ]; then + DAEMON_ARGS="${DAEMON_ARGS} ${SB_EXTRA_ARGS}" + fi + + # Return + # 0 if daemon has been started + # 1 if daemon was already running + # 2 if daemon could not be started + start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON \ + --test > /dev/null || return 1 + start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON \ + --background --make-pidfile -- $DAEMON_ARGS || return 2 +} + +# +# Function that stops the daemon/service +# +do_stop() +{ + # Return + # 0 if daemon has been stopped + # 1 if daemon was already stopped + # 2 if daemon could not be stopped + # other if a failure occurred + start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 \ + --pidfile $PIDFILE --daemon $DAEMON +} + +case "$1" in + start) + [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME" + do_start; RET=$? + case $RET in + 0|1) [ "$VERBOSE" != no ] && log_end_msg 0; exit 0 ;; + *) [ "$VERBOSE" != no ] && log_end_msg 1; exit 1 ;; + esac + ;; + stop) + [ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME" + do_stop; RET=$? + case $RET in + 0|1) [ "$VERBOSE" != no ] && log_end_msg 0; exit 0 ;; + *) [ "$VERBOSE" != no ] && log_end_msg 1; exit 1 ;; + esac + ;; + status) + status_of_proc "$DAEMON" "$NAME" + ;; + restart|force-reload) + log_daemon_msg "Restarting $DESC" "$NAME" + do_stop; RET=$? + case $RET in + 0|1) + do_start; RET=$? + case $RET in + 0) log_end_msg 0; exit 0 ;; + 1) log_end_msg 1; exit 1 ;; # Old process is still running + *) log_end_msg 1; exit 1 ;; # Failed to start + esac + ;; + *) + # Failed to stop + log_end_msg 1; exit 1 + ;; + esac + ;; + *) + echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}" >&2 + exit 3 + ;; +esac +