summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: a7ce45137a01df9cb4a45609906aec92be3a2dfa (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
# Maintainer: dreieck
# Contributor: Thiago Perrotta

_pkgname=arandr-indicator
pkgname="${_pkgname}-git"
epoch=2
pkgver=2.0.0+12.r27.20230916.74fdcfb
pkgrel=5
pkgdesc="Quick and simple tray icon menu for changing the monitor layout."
arch=('any')
url="https://github.com/denilsonsa/arandr-indicator" # Original project.
license=('BSD-2-Clause')
depends=(
  'libappindicator-gtk3'
  'libayatana-appindicator'
  'glib2'
  'gtk3'
  'python>=3'
  'python-gobject' # This one seems to contain libappindicator python module, which is required.
)
makedepends=('git')
optdepends=(
  'arandr: To configure monitor layouts.'
  'python-xdg: For Freedesktop.org directory specifications.' # python-pyxdg
)
provides=("${_pkgname}=${pkgver}")
replaces=()
conflicts=("${_pkgname}")
source=(
  "${_pkgname}::git+${url}.git"
  'license-info.txt'
)
sha256sums=(
  'SKIP'
  'e4f6da5d674b36b60640901d1a01a5deec77fd41ef31f713b1fc533c25d14f6d'
)

prepare() {
  cd "${srcdir}/${_pkgname}"
  msg2 "Extract copyright information, building license.txt ..."
  cat arandr-indicator.py | tr -d '\a' | tr '\n' '\a' | sed 's|^.*\(# BSD-2-Clause.*$\)|\1|g' | sed 's|\a[^#][^\a]*.*$|\a|g' | tr '\a' '\n' > "${srcdir}/license.txt"

  git log > git.log
}

pkgver () {
  cd "${srcdir}/${_pkgname}"
  _ver="$(git describe --tags | sed -E -e 's|^[vV]||' -e 's|\-g[0-9a-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
}

package() {
  cd "${srcdir}/${_pkgname}"
  install -Dvm755 "${_pkgname}.py" "${pkgdir}/usr/bin/${_pkgname}"
  install -Dvm644 git.log "${pkgdir}/usr/share/doc/${_pkgname}/git.log"
  install -Dvm644 README.md "${pkgdir}/usr/share/doc/${_pkgname}/README.md"
  install -Dvm644 TODO.md "${pkgdir}/usr/share/doc/${_pkgname}/TODO.md"
  install -Dvm644 "${srcdir}/license.txt" "${pkgdir}/usr/share/licenses/${pkgname}/license.txt"
  install -Dvm644 "${srcdir}/license-info.txt" "${pkgdir}/usr/share/licenses/${pkgname}/license-info.txt"
}