Add Arch Linux packaging, cross-compilation support, and binary generation

- Introduce Arch Linux package build process, supporting both x86_64 and aarch64 architectures.
- Add Arch-specific configuration files for service, sysusers, and tmpfiles to facilitate system integration.
- Update packaging script to dynamically handle Arch-specific builds and configure PKGBUILD fields.
- Add cross-compilation support, enabling building for ARM (aarch64) on x86_64 systems.
- Implement binary generation for both architectures, allowing separate or unified binary outputs.
- Include npm scripts to automate Arch build and cross-compilation processes.
- Simplify deployment and integration for Arch-based systems.
This commit is contained in:
Binyamin Blatt 2025-08-19 14:45:39 +03:00
parent a89a24e48e
commit 9ef873fab6
No known key found for this signature in database
GPG key ID: 3DE4B144943A5CDA
8 changed files with 257 additions and 20 deletions

30
build/arch/PKGBUILD Normal file
View file

@ -0,0 +1,30 @@
# Maintainer: advplyr
# Based on PKGBUILD From the aur
pkgname=audiobookshelf-bin
pkgver=2.28.0
pkgrel=1
epoch=1
pkgdesc="Self-hosted audiobook server for managing and playing audiobooks"
arch=()
url="https://github.com/advplyr/${pkgname}"
license=('GPL-3.0-only')
depends=("ffmpeg" "libnusqlite3")
backup=("etc/conf.d/${pkgname}")
options=("!debug")
# The generator script will update the source and sha256sums dynamically.
# So we'll leave them empty for now and rely on the generator.
source=()
sha256sums=()
package() {
install -Dm644 "${pkgname}.conf" "${pkgdir}/etc/conf.d/${pkgname}"
install -Dm644 "${pkgname}.hook" "${pkgdir}/etc/pacman.d/hooks/${pkgname}.hook"
install -Dm644 "${pkgname}.service" "${pkgdir}/usr/lib/systemd/system/${pkgname}.service"
install -Dm644 "${pkgname}.sysusers" "${pkgdir}/usr/lib/sysusers.d/${pkgname}.conf"
install -Dm644 "${pkgname}.tmpfiles" "${pkgdir}/usr/lib/tmpfiles.d/${pkgname}.conf"
install -Dm755 "audiobookshelf_${pkgver}" "${pkgdir}/usr/bin/audiobookshelf"
}

View file

@ -0,0 +1,12 @@
NODE_ENV=production
METADATA_PATH=/var/lib/audiobookshelf/metadata
CONFIG_PATH=/var/lib/audiobookshelf/config
SOURCE=archlinux
FFMPEG_PATH=/usr/bin/ffmpeg
FFPROBE_PATH=/usr/bin/ffprobe
NUSQLITE3_PATH=/usr/lib/libnusqlite3.so
SKIP_BINARIES_CHECK=1
PORT=13378
HOST=0.0.0.0
# ROUTER_BASE_PATH="/audiobookshelf"
# ALLOW_IFRAME=1

View file

@ -0,0 +1,9 @@
[Trigger]
Operation = Upgrade
Type = Package
Target = audiobookshelf
[Action]
Description = Restarting audiobookshelf...
When = PostTransaction
Exec = /usr/bin/systemctl try-restart audiobookshelf.service

View file

@ -0,0 +1,16 @@
[Unit]
Description=Self-hosted audiobook server for managing and playing audiobooks
Requires=network.target
[Service]
Type=simple
EnvironmentFile=/etc/conf.d/audiobookshelf
WorkingDirectory=/var/lib/audiobookshelf
ExecStart=/usr/bin/audiobookshelf
ExecReload=/bin/kill -HUP $MAINPID
Restart=always
User=audiobookshelf
Group=audiobookshelf
[Install]
WantedBy=multi-user.target

View file

@ -0,0 +1,2 @@
u audiobookshelf - - /var/lib/audiobookshelf
g audiobookshelf -

View file

@ -0,0 +1,2 @@
d /var/lib/audiobookshelf 0755 audiobookshelf audiobookshelf
Z /var/lib/audiobookshelf - audiobookshelf audiobookshelf