Build squeezelite on the device on a 64-bit or trixie userland

The shipped squeezelite is a 32-bit ARM binary linked against libFLAC.so.12 (bookworm
on armhf). Elsewhere the role now builds upstream squeezelite at a pinned commit with
the same options as the old ARM build, installing the -dev packages instead of
soname-specific runtime libraries. `ansible_architecture` is the kernel's, so the
choice reads the userland's architecture from dpkg; override with
`pi_squeezelite_custom_build_from_source: true|false`.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-02 23:14:18 +02:00
parent f6a169afaa
commit a6d4180b2b
4 changed files with 100 additions and 7 deletions

View File

@@ -3,15 +3,23 @@
ansible.builtin.apt:
name: squeezelite
state: absent
- name: Get the userland architecture
# `ansible_architecture` is the *kernel's*: a Pi on a 64-bit kernel with an armhf
# userland says aarch64. What decides whether a 32-bit binary runs is dpkg's.
ansible.builtin.command: dpkg --print-architecture
register: pi_squeezelite_custom_dpkg_arch
changed_when: false
check_mode: false # read-only
- name: Decide between the prebuilt binary and a build on the device
ansible.builtin.set_fact:
pi_squeezelite_custom_build: >-
{{ (pi_squeezelite_custom_build_from_source | string | lower == 'true')
or (pi_squeezelite_custom_build_from_source | string | lower == 'auto'
and (pi_squeezelite_custom_dpkg_arch.stdout | trim != 'armhf'
or ansible_facts.distribution_major_version | int >= 13)) }}
- name: Install dependencies
ansible.builtin.apt:
name:
- libmad0
- libmpg123-0
- libflac12
- libvorbisfile3
- libfaad2
# for building libssl-dev, libasound2-dev, libflac-dev, libvorbis-dev, libsoxr-dev, libfaad-dev, libmad0-dev, libmpg123-dev
name: "{{ pi_squeezelite_custom_build_packages if pi_squeezelite_custom_build else pi_squeezelite_custom_runtime_packages }}"
state: present
cache_valid_time: 7200
- name: Remove old config file if present
@@ -24,6 +32,10 @@
dest: /opt/squeezelite
mode: "700"
notify: Restart squeezelite
when: not pi_squeezelite_custom_build
- name: Build squeezelite from source (needed on a 64-bit userland, see README)
ansible.builtin.include_tasks: build.yml
when: pi_squeezelite_custom_build
- name: Install systemd service file
ansible.builtin.template:
src: squeezelite.service