summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 79b85cb1f91ff16378c19d236ac5f890425ec301 (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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
# Maintainer:  dreieck (https://aur.archlinux.org/account/dreieck)
# Contributor: pika02 (https://aur.archlinux.org/account/pika02, <pikakolendo02 ät gmail döt com>)
# Contributor: Cygn
# Contributor: masmu

_pkgname=pa-dlna
pkgname="${_pkgname}-git"
pkgver=1.0+4.r442.20250520.64586dc
pkgrel=1
pkgdesc="Forwards audio streams to DLNA devices. For PulseAudio or PipeWira (via 'python-libpulse'). Latest git checkout."
arch=(
  'any'
)
url="https://gitlab.com/xdegaye/pa-dlna"
license=('MIT')
provides=(
  "pa-dlna=${pkgver}"
  "upnp-cmd=${pkgver}"
  "upnp-cmd-git=${pkgver}"
  "pa-dlna-doc=${pkgver}"
  "pa-dlna-doc-git=${pkgver}"
  "python-pa_dlna=${pkgver}"
  "python-pa_dlna-git=${pkgver}"
  "PULSEAUDIO-DLNA-SINK"
)
conflicts=(
  "pa-dlna"
  "upnp-cmd"
  "python-pa_dlna"
  "pa-dlna-doc"
)
depends=(
  'libpulse' # For `parec` executable
  'python>=3.8'
  'python-psutil'
  'python-libpulse'
)
makedepends=(
  'git'
  'python-build'
  'python-flit-core'
  'python-installer'
  # 'python-setuptools'
  'python-sphinx'
  'python-sphinx_rtd_theme'
  'python-wheel'
  'texinfo'
)
optdepends=(
  'ffmpeg: multiple formats support'
  'flac: flac transcoding support'
  'lame: mp3 transcoding support'
  'pipewire-pulse: To be used by a local pipewire implementation'
  'pulse-native-provider: To be used by a local pulseaudio implementation'
  'python-systemd: For systemd support.'
)
source=(
  "${_pkgname}::git+${url}.git"
  "pa-dlna-${pkgver}.pdf::https://pa-dlna.readthedocs.io/_/downloads/en/latest/pdf/"
  "systemd-add-startup-delay.patch"
)
sha256sums=(
  'SKIP'
  'SKIP'
  'bc5a81514fea014b6179e2819f6fe9caed3f3983d910e34675ed41ea9a52f268'
)

prepare() {
  cd "${srcdir}"

  if [ -e "pa-dlna.pdf" ]; then
    rm "pa-dlna.pdf"
  fi
  ln -s "pa-dlna-${pkgver}.pdf" "pa-dlna.pdf"

  cd "${srcdir}/${_pkgname}"

  for _patch in "${srcdir}"/systemd-add-startup-delay.patch; do
    plain "Applying patch '$(basename "${_patch}" ...)'"
    patch -Np1 --follow-symlinks -i "${_patch}"
  done

  git log > git.log
}

pkgver() {
  cd "${srcdir}/${_pkgname}"

  _ver="$(git describe  --tags | sed -E -e 's|^pa-dlna-||' -e 's|^[vV]||' | sed 's|-g[0-9a-fA-F]*$||' | tr '-' '+')"
  _rev="$(git rev-list --count HEAD)"
  _date="$(git log -1 --date=format:"%Y%m%d" --format="%ad")"
  _hash="$(git rev-parse --short HEAD)"

  if [ -z "${_ver}" ]; then
    error "Version could not be determined."
    return 1
  else
    printf '%s' "${_ver}.r${_rev}.${_date}.${_hash}"
  fi
}

build() {
  cd "${srcdir}/${_pkgname}"

  python -m build --wheel --no-isolation

  cd docs
  for _target in man info text html; do # qthelp # latexpdf (do not build here since it needs a lot of dependencies; we download prebuilt PDF from upstream instead.)
    make -j1 "${_target}"
  done
  gzip -9 build/man/*
  gzip -9 build/texinfo/*.info
}

package() {
  cd "${srcdir}/${_pkgname}"

  python -m installer --destdir="${pkgdir}" dist/*.whl

  install -Dvm644 -t "${pkgdir}/usr/lib/systemd/user/" systemd/pa-dlna.service

  _docfiles=(
    README.rst
    git.log
    "${srcdir}/pa-dlna.pdf"
    # docs/build/latex/pa-dlna.pdf
  )
  _docdirs=(
    docs/build/html
    # docs/build/qthelp
    docs/build/text
  )
  _manfiles=(
    docs/build/man/*.gz
  )
  _infofiles=(
    docs/build/texinfo/*.info.gz
  )
  _licensefiles=(
    LICENSE
  )
  install -dvm755 "${pkgdir}/usr/share/doc/${_pkgname}"
  for _docfile in "${_docfiles[@]}"; do
    install -Dvm644 -t "${pkgdir}/usr/share/doc/${_pkgname}" "${_docfile}"
  done
  for _docdir in "${_docdirs[@]}"; do
    cp -rv "${_docdir}" "${pkgdir}/usr/share/doc/${_pkgname}"/
  done
  for _manfile in "${_manfiles[@]}"; do
    _section="$(basename "${_manfile}" .gz | sed -E -e 's|^.*\.([^.]*)$|\1|')"
    install -Dvm644 -t "${pkgdir}/usr/share/man/man${_section}" "${_manfile}"
  done
  for _infofile in "${_infofiles[@]}"; do
    install -Dvm644 -t "${pkgdir}/usr/share/info" "${_infofile}"
  done
  for _licensefile in "${_licensefiles[@]}"; do
    install -Dvm644 -t "${pkgdir}/usr/share/licenses/${pkgname}" "${_licensefile}"
    ln -svr "${pkgdir}/usr/share/licenses/${pkgname}/$(basename "${_licensefile}")" "${pkgdir}/usr/share/doc/${_pkgname}"/
  done
}