summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 4c154a25e7b6179672d17afccdc0bab9179d92d7 (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
# Maintainer: Jat <chat@jat.email>

_pkgname="pulseaudio-module-xrdp"
pkgname="$_pkgname"
pkgver=0.7
pkgrel=2
pkgdesc="xrdp pulseaudio module"
url="https://github.com/neutrinolabs/pulseaudio-module-xrdp"
license=('LGPL-2.1-only')
arch=('i686' 'x86_64' 'armv6h' 'armv7l' 'aarch64')

makedepends=(
  'check'
  'git'
  'libpulse'
  'meson'
  'tdb'
)

provides=("$_pkgname")
conflicts=("$_pkgname")

install="$_pkgname.install"

_pkgsrc="$_pkgname-$pkgver"
_pkgsrc_pulse="pulseaudio"
_pkgext="tar.gz"
source=(
  "$_pkgsrc.$_pkgext"::"$url/archive/refs/tags/v${pkgver}.$_pkgext"
  "$_pkgsrc_pulse"::"git+https://anongit.freedesktop.org/git/pulseaudio/pulseaudio.git"
)
sha256sums=(
  'be101538ebe891bd4ae9d533559b99cf07abf0bbce399f50f2d248f35c160a9d'
  'SKIP'
)

_build_pulse() (
  echo "Building pulseaudio..."

  local _pulseaudio_ver _ref
  _pulseaudio_ver=$(LANG=C LC_ALL=C pacman -Si pulseaudio | grep -Pom1 '^Version\s+:\s+\K(\S+)-[0-9\.]+')
  if grep -qm1 '+' <<< "$_pulseaudio_ver"; then
    _ref=$(sed -E 's&^\S+[+]g([a-f0-9]+)-\S+$&\1&' <<< ${_pulseaudio_ver})
  else
    _ref=v$(sed -E 's&^([0-9]+\.[0-9]+).*$&\1&' <<< ${_pulseaudio_ver})
  fi

  cd "$_pkgsrc_pulse"
  git -c advice.detachedHead=false checkout -f "${_ref:?}"

  local _meson_options=(
    -Ddoxygen=false
    -Dtests=false
  )

  meson build "${_meson_options[@]}"
)

_build_plugin() (
  echo "Building pulseaudio-module-xrdp..."

  cd "$_pkgsrc"
  sed -i '\#-I $(PULSE_DIR)/src#a -I $(PULSE_DIR)/build \\' src/Makefile.am

  autoreconf -ivf
  ./configure "PULSE_DIR=$srcdir/$_pkgsrc_pulse" --prefix='/usr' --libexecdir='/usr/lib'
  make
)

build() {
  _build_pulse
  _build_plugin
}

package() {
  depends=(
    'pulseaudio'
    'xrdp'
  )

  cd "$_pkgsrc"
  make DESTDIR="$pkgdir" install
}