diff --git a/Makefile-tweaks.patch b/Makefile-tweaks.patch new file mode 100644 index 0000000..ff573b8 --- /dev/null +++ b/Makefile-tweaks.patch @@ -0,0 +1,91 @@ +Description: Makefile tweaks for hardening build options + This patch changes the Makefile to add options to CFLAGS and LDFLAGS instead of + overriding the values from the environment, and ensures that CPPFLAGS is also + used when building C source. +Author: Chris Boot +Forwarded: not-needed +Last-Update: 2018-04-23 + +--- 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 -fPIC -O2 $(OPTS) +-LDFLAGS ?= -lasound -lpthread -lm -lrt ++CFLAGS ?= -Wall -fPIC -O2 ++LDADD ?= -lasound -lpthread -lm -lrt + EXECUTABLE ?= squeezelite + + # passing one or more of these in $(OPTS) enables optional feature inclusion +@@ -34,41 +34,41 @@ + UNAME = $(shell uname -s) + + # add optional sources +-ifneq (,$(findstring $(OPT_DSD), $(CFLAGS))) ++ifneq (,$(findstring $(OPT_DSD), $(OPTS))) + SOURCES += $(SOURCES_DSD) + endif +-ifneq (,$(findstring $(OPT_FF), $(CFLAGS))) ++ifneq (,$(findstring $(OPT_FF), $(OPTS))) + SOURCES += $(SOURCES_FF) + endif +-ifneq (,$(findstring $(OPT_RESAMPLE), $(CFLAGS))) ++ifneq (,$(findstring $(OPT_RESAMPLE), $(OPTS))) + SOURCES += $(SOURCES_RESAMPLE) + endif +-ifneq (,$(findstring $(OPT_VIS), $(CFLAGS))) ++ifneq (,$(findstring $(OPT_VIS), $(OPTS))) + SOURCES += $(SOURCES_VIS) + endif +-ifneq (,$(findstring $(OPT_IR), $(CFLAGS))) ++ifneq (,$(findstring $(OPT_IR), $(OPTS))) + SOURCES += $(SOURCES_IR) + endif +-ifneq (,$(findstring $(OPT_GPIO), $(CFLAGS))) ++ifneq (,$(findstring $(OPT_GPIO), $(OPTS))) + SOURCES += $(SOURCES_GPIO) + endif + + # add optional link options +-ifneq (,$(findstring $(OPT_LINKALL), $(CFLAGS))) +- LDFLAGS += $(LINKALL) +-ifneq (,$(findstring $(OPT_FF), $(CFLAGS))) +- LDFLAGS += $(LINKALL_FF) ++ifneq (,$(findstring $(OPT_LINKALL), $(OPTS))) ++ LDADD += $(LINKALL) ++ifneq (,$(findstring $(OPT_FF), $(OPTS))) ++ LDADD += $(LINKALL_FF) + endif +-ifneq (,$(findstring $(OPT_RESAMPLE), $(CFLAGS))) +- LDFLAGS += $(LINKALL_RESAMPLE) ++ifneq (,$(findstring $(OPT_RESAMPLE), $(OPTS))) ++ LDADD += $(LINKALL_RESAMPLE) + endif +-ifneq (,$(findstring $(OPT_IR), $(CFLAGS))) +- LDFLAGS += $(LINKALL_IR) ++ifneq (,$(findstring $(OPT_IR), $(OPTS))) ++ LDADD += $(LINKALL_IR) + endif + else + # if not LINKALL and linux add LINK_LINUX + ifeq ($(UNAME), Linux) +- LDFLAGS += $(LINK_LINUX) ++ LDADD += $(LINK_LINUX) + endif + endif + +@@ -74,12 +74,12 @@ + all: $(EXECUTABLE) + + $(EXECUTABLE): $(OBJECTS) +- $(CC) $(OBJECTS) $(LDFLAGS) -o $@ ++ $(CC) $(OBJECTS) $(LDFLAGS) $(LDADD) -o $@ + + $(OBJECTS): $(DEPS) + + .c.o: +- $(CC) $(CFLAGS) $(CPPFLAGS) $< -c -o $@ ++ $(CC) $(CFLAGS) $(CPPFLAGS) $(OPTS) $< -c -o $@ + + clean: + rm -f $(OBJECTS) $(EXECUTABLE) diff --git a/ffmpeg-4.0.patch b/ffmpeg-4.0.patch new file mode 100644 index 0000000..e4a0fa8 --- /dev/null +++ b/ffmpeg-4.0.patch @@ -0,0 +1,16 @@ +Description: Fix FTBFS with FFmpeg 4.0 +Author: James Cowgill +Bug-Debian: https://bugs.debian.org/888335 +--- +This patch header follows DEP-3: http://dep.debian.net/deps/dep3/ +--- a/ffmpeg.c ++++ b/ffmpeg.c +@@ -264,7 +264,7 @@ static decode_state ff_decode(void) { + ff->mmsh_bytes_left = ff->mmsh_bytes_pad = ff->mmsh_packet_len = 0; + + if (!ff->readbuf) { +- ff->readbuf = AV(ff, malloc, READ_SIZE + FF_INPUT_BUFFER_PADDING_SIZE); ++ ff->readbuf = AV(ff, malloc, READ_SIZE + AV_INPUT_BUFFER_PADDING_SIZE); + } + + avio = AVIO(ff, alloc_context, ff->readbuf, READ_SIZE, 0, NULL, _read_data, NULL, NULL); diff --git a/squeezelite.service.7.md b/squeezelite.service.7.md new file mode 100644 index 0000000..38bd820 --- /dev/null +++ b/squeezelite.service.7.md @@ -0,0 +1,43 @@ +# NAME + +squeezelite.service - Systemd units for Squeezelite + +# DESCRIPTION + +Automatically start the Squeezelite music streaming client each time a user logs in, or each time a system boots. + +# EXAMPLES + +To run `squeezelite` as part of your user desktop session: + + systemctl --user enable squeezelite + systemctl --user start squeezelite + +To run `squeezelite` at system boot: + + systemctl enable squeezelite + systemctl start squeezelite + +To configure `squeezelite`, edit the command line options passed to it: + + systemctl --user edit --full squeezelite + +or: + + systemctl edit --full squeezelite + +If running outside of a user session, you will probably need to specify the ALSA output device using `squeezelite`’s `-o` option. Get a list of available devices with: + + squeezelite -l + + +# SEE ALSO + +squeezelite(1), systemctl(1) + +--- +title: squeezelite.service +section: 7 +date: April 2018 +author: Peter Oliver +... diff --git a/squeezelite.spec b/squeezelite.spec new file mode 100644 index 0000000..17825e9 --- /dev/null +++ b/squeezelite.spec @@ -0,0 +1,94 @@ +%global forgeurl https://github.com/ralph-irving/squeezelite/ +%global commit d589bebd04f2bfebcc6ae4772ba82fa0b9320f96 +%forgemeta + + +Name: squeezelite +Version: 1.8.7.1078 +Release: 1%{?dist} +Summary: Headless music player for streaming from Logitech Media Server + +License: GPL3 +URL: %{forgeurl} +Source0: %{forgesource} +Source1: %{name}.system.service +Source2: %{name}.user.service +Source3: %{name}.service.7.md + +# Suggested upstream. https://github.com/ralph-irving/squeezelite/issues/43 +Source4: https://anonscm.debian.org/git/collab-maint/squeezelite.git/plain/debian/man/squeezelite.1?h=debian/1.8-4#/%{name}.1 +Patch0: Makefile-tweaks.patch +Patch1: ffmpeg-4.0.patch + +BuildRequires: alsa-lib-devel +BuildRequires: faad2-devel +BuildRequires: ffmpeg-devel +BuildRequires: flac-devel +BuildRequires: libmad-devel +BuildRequires: libvorbis-devel +BuildRequires: lirc-devel +BuildRequires: mpg123-devel +BuildRequires: pandoc +BuildRequires: soxr-devel +BuildRequires: systemd + +Requires(pre): shadow-utils + + +%description +Squeezelite is a headless client for Logitech Media Server, and can be +used in place of dedicated Squeezebox network music playing hardware. + + +%prep +%forgesetup +%patch0 -p1 +%patch1 -p1 + + +%build +%set_build_flags + +## GPIO support depends on WiringPi, which is not currently in Fedora. +# %ifarch aarch64 armhfp +# %global squeezelite_opts OPTS="-DDSD -DFFMPEG -DLINKALL -DRESAMPLE -DVISEXPORT -DIR -DGPIO" +# %else +%global squeezelite_opts OPTS="-DDSD -DFFMPEG -DLINKALL -DRESAMPLE -DVISEXPORT -DIR" +# %endif + +%make_build CPPFLAGS+="-I/usr/include/ffmpeg" %{squeezelite_opts} + +pandoc --to=man --standalone --output=%{name}.service.7 %{SOURCE3} + + +%install +install -p -D -t %{buildroot}/%{_bindir} %{name} +install -p -D -m 0644 %{SOURCE1} %{buildroot}/%{_unitdir}/%{name}.service +install -p -D -m 0644 %{SOURCE2} %{buildroot}/%{_userunitdir}/%{name}.service +install -p -D -t %{buildroot}/%{_mandir}/man1 -m 0644 %{SOURCE4} +install -p -D -t %{buildroot}/%{_mandir}/man7 -m 0644 %{name}.service.7 +mkdir -p %{buildroot}/%{_sharedstatedir}/%{name} + + +%files +%dir %attr(-,%{name},%{name}) %{_sharedstatedir}/%{name} +%doc %{_mandir}/*/* +%doc README.md +%license LICENSE.txt +%{_bindir}/%{name} +%{_unitdir}/%{name}.service +%{_userunitdir}/%{name}.service + + +%pre +getent group %{name} >/dev/null || groupadd -r %{name} +getent passwd %{name} >/dev/null || \ + useradd -r -g %{name} -G audio -d %{_sharedstatedir}/%{name} \ + -s /sbin/nologin -c "Squeezelite headless streaming music client" \ + %{name} +exit 0 + + +%changelog +* Sun Apr 22 2018 Peter Oliver +- Initial package. diff --git a/squeezelite.system.service b/squeezelite.system.service new file mode 100644 index 0000000..88b5d01 --- /dev/null +++ b/squeezelite.system.service @@ -0,0 +1,13 @@ +[Unit] +Description=Squeezelite headless streaming music client +Documentation=man:squeezelite.service(7) +Wants=sound.target +After=sound.target + +[Service] +User=squeezelite +Group=squeezelite +ExecStart=/usr/bin/squeezelite -N /var/lib/squeezelite/player-name + +[Install] +WantedBy=multi-user.target diff --git a/squeezelite.user.service b/squeezelite.user.service new file mode 100644 index 0000000..31f0969 --- /dev/null +++ b/squeezelite.user.service @@ -0,0 +1,9 @@ +[Unit] +Description=Squeezelite headless streaming music client +Documentation=man:squeezelite.service(7) + +[Service] +ExecStart=/usr/bin/squeezelite -N ~/.local/share/squeezelite/player-name + +[Install] +WantedBy=default.target