summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 390ed3b6e8ee93918d50d50dc23191b92ca37373 (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
# Maintainer: XZS <d dot f dot fischer at web dot de>
# Contributor: Mantas Mikul─Śnas <grawity at gmail dot com>
# Contributor: Morris Jobke <hey at morrisjobke dot de>
# Contributor: alucryd <alucryd at gmail dot com>
# This PKGBUILD is maintained on GitHub <https://github.com/dffischer/gnome-shell-extensions>.
# You may find it convenient to file issues and pull requests there.

pkgname=gnome-shell-extension-mediaplayer-git
pkgver=4.0
pkgrel=1
pkgdesc='A mediaplayer indicator for the Gnome Shell'
arch=('any')
url='https://github.com/JasonLG1979/gnome-shell-extensions-mediaplayer'
license=('GPL2')
makedepends=('meson' 'intltool')
optdepends=('mpdris2: MPD support')
install=gschemas.install

makedepends+=('git')
source+=("${_gitname:=${pkgname%-git}}::${_giturl:-git+$url}")
for integ in $(get_integlist)
do
  typeset -n array="${integ}sums"
  array+=('SKIP')
done
provides+=("$_gitname=$pkgver")
conflicts+=("$_gitname")
pkgver() {
  cd ${_gitname:-$pkgname}
  git describe --long --tags 2>/dev/null | sed 's/[^[:digit:]]*\(.\+\)-\([[:digit:]]\+\)-g\([[:xdigit:]]\{7\}\)/\1.r\2.g\3/;t;q1'
  [ ${PIPESTATUS[0]} -ne 0 ] && \
printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
}

prepare() {
  cd "$_gitname"
  git tag -d 3,4
  sed -i "
    /^if/s/not//
    /DATA_DIR =/s/$/[1:]/
    /^EXTENSION_DIR =/s/path\\.join(/&DEST_DIR,/
  " meson_post_install.py
}

build() {
  cd "$_gitname"
  rm -rf builddir
  meson builddir --prefix='/usr'
}

package() {
  for function in $(declare -F | grep -Po 'package_[[:digit:]]+[[:alpha:]_]*$')
  do
    $function
  done
}

package_01_ninja_install() {
  cd "$_gitname"
  DESTDIR="$pkgdir" ninja -C builddir install
}

depends[125]=gnome-shell

package_20_version() {
  local compatibles=($(\
    find -path ./pkg -type d -prune -o \
    -name metadata.json -exec cat '{}' \; | \
    tr -d '\n' | grep -Po '(?<="shell-version": \[)[^\[\]]*(?=\])' | \
    tr '\n," ' '\n' | sed 's/3\.//g;/^$/d' | sort -n -t. -k 1,1))
  depends+=("gnome-shell>=3.${compatibles[0]}")
  local max="${compatibles[-1]}"
  if [ "$max" != $(
    gnome-shell --version | grep -Po '(?<=GNOME Shell 3\.)[[:digit:]]+'
  ) ]; then
    depends+=("gnome-shell<3.$((${max%%.*} + 1))")
  fi
  unset depends[125]
}