Files
Martin Bauer a6d4180b2b 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>
2026-10-02 23:14:18 +02:00

60 lines
2.2 KiB
YAML

---
- name: Uninstall system package of squeezelite
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: "{{ 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
ansible.builtin.file:
path: /etc/default/squeezelite
state: absent
- name: Copy over custom compile version of squeezelite
ansible.builtin.copy:
src: squeezelite
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
dest: /lib/systemd/system/
mode: "0644"
notify: Restart squeezelite
- name: Enable squeezelite autostart
ansible.builtin.systemd:
name: squeezelite
state: started
enabled: "yes"
daemon_reload: "yes"
- name: Add to sysdweb
ansible.builtin.include_role:
name: pi_sysdweb
vars:
pi_sysdweb_name: squeezelite
# build with adapted Makefile.rpi:
# OPTS = -DRESAMPLE -DDSD -DUSE_SSL -DLINKALL -I./include -I./include/opus -I./include/alac -I/usr/local/include -s -mfpu=vfp
# -mfloat-abi=hard -march=armv6zk -mtune=arm1176jzf-s