summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 4e88d141560185d249220d95db258ccba0b88dbd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
# Maintainer: Bart De Vries <bart at mogwai dot be>

pkgname=snapcast
pkgver=0.35.0
pkgrel=1
_pkgname_snapweb=snapweb
_snapweb_version=0.9.3
pkgdesc="Synchronous multi-room audio player"
arch=('x86_64' 'armv7h' 'aarch64')
url="https://github.com/badaix/snapcast"
license=('GPL-1.0-or-later')
depends=(alsa-lib avahi libvorbis flac opus expat libsoxr libpulse libpipewire openssl)
optdepends=("python-websocket-client: stream plugin script"
  "python-mpd2: stream plugin script"
  "python-musicbrainzngs: stream plugin script"
  "python-requests: general plugin support"
  "python-gobject: mpris and mpd plugin support"
  "libnotify: mpris plugin support"
  "python-dbus: mpris plugin support")
makedepends=(cmake alsa-utils boost)
install="snapcast.install"
backup=('etc/default/snapserver' 'etc/default/snapclient' 'etc/snapserver.conf')
source=("${pkgname}-${pkgver}.tar.gz::https://github.com/badaix/snapcast/archive/v${pkgver}.tar.gz"
  "${_pkgname_snapweb}-${_snapweb_version}.zip::https://github.com/badaix/snapweb/releases/download/v${_snapweb_version}/snapweb.zip"
  "snapcast.sysusers"
  "snapcast.tmpfiles"
  "snapcast.install")
noextract=("${_pkgname_snapweb}-${_snapweb_version}.zip")
sha256sums=('cb75a71479bf52910bf5f47ae8120ec41c89459b0d77d7cd560e674e437ef050'
  'cc258df98b8c474ea19048bc84c0c2e2c5fbc3b0856aef03a838f3a4489fa4c7'
  '9fe6e9e07adb77f555a617b772e6d01e098e1dfaad1e8075e03a7d7ba76141de'
  'e8c3441c4ca646a9b66d61355e90862fd3481562ae3b4e0a4bc1c978464ae2c7'
  '23a0390774279f8c5d02d3307cfb67f2e9360f42704bb4f13d8c43e091fe997f')

prepare() {
  mkdir -p ${_pkgname_snapweb}-${_snapweb_version}
  bsdtar -xf ${_pkgname_snapweb}-${_snapweb_version}.zip -C ${_pkgname_snapweb}-${_snapweb_version}
}

build() {
  cd "${pkgname}-${pkgver}"
  cmake -B build -S . \
    -DCMAKE_BUILD_TYPE=None \
    -DBUILD_WITH_PULSE=ON \
    -DBUILD_WITH_PIPEWIRE=ON \
    -DCMAKE_INSTALL_PREFIX=/usr \
    -Wno-dev
  cmake --build build
}

package() {
  cd "${pkgname}-${pkgver}"

  install -Dm755 bin/snapserver "${pkgdir}/usr/bin/snapserver"
  install -Dm644 server/snapserver.1 "${pkgdir}/usr/share/man/man1/snapserver.1"
  install -Dm644 server/etc/snapserver.conf "${pkgdir}/etc/snapserver.conf"
  # install snapweb
  for file in ${srcdir}/${_pkgname_snapweb}-${_snapweb_version}/*\.*; do
    install -Dm 644 ${file} -t "${pkgdir}/usr/share/snapserver/snapweb/"
  done
  for file in ${srcdir}/${_pkgname_snapweb}-${_snapweb_version}/assets/*\.*; do
    install -Dm 644 ${file} -t "${pkgdir}/usr/share/snapserver/snapweb/assets/"
  done
  for file in server/etc/plug-ins/*\.*; do
    install -Dm 755 ${file} -t "${pkgdir}/usr/share/snapserver/plug-ins/"
  done

  install -Dm755 bin/snapclient "${pkgdir}/usr/bin/snapclient"
  install -Dm644 client/snapclient.1 "${pkgdir}/usr/share/man/man1/snapclient.1"

  install -Dm644 extras/package/debian/snapserver.service "${pkgdir}/usr/lib/systemd/system/snapserver.service"
  install -Dm644 extras/package/debian/snapserver.default "${pkgdir}/etc/default/snapserver"
  install -Dm644 extras/package/debian/snapclient.service "${pkgdir}/usr/lib/systemd/system/snapclient.service"
  install -Dm644 extras/package/debian/snapclient.default "${pkgdir}/etc/default/snapclient"

  install -Dm644 "${srcdir}/snapcast.sysusers" "${pkgdir}/usr/lib/sysusers.d/snapclient.conf"
  install -Dm644 "${srcdir}/snapcast.tmpfiles" "${pkgdir}/usr/lib/tmpfiles.d/snapclient.conf"

  # install documentation
  install -d "${pkgdir}/usr/share/doc/${pkgname}/control"
  cp -R doc/* "${pkgdir}/usr/share/doc/${pkgname}/"
  install -Dm644 "changelog.md" "${pkgdir}/usr/share/doc/${pkgname}"

  find "${pkgdir}"/usr/share/doc/${pkgname} -type f -exec chmod 0644 {} \;
  find "${pkgdir}"/usr/share/doc/${pkgname} -type d -exec chmod 0755 {} \;

  # example control scripts
  cp -R control/* "${pkgdir}/usr/share/doc/${pkgname}/control/"
}