summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 998e73c7ccb5eee254748273b3ad7694b217b68e (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
# Maintainer: getzze <getzze at gmail dot com>

pkgname=gnome-shell-extension-tophat
_pkgbase=tophat
pkgver=14
pkgrel=1
pkgdesc="View CPU, memory, disk, and network activity in the GNOME top bar (v45 fork)."
arch=(any)
url="https://github.com/fflewddur/tophat"
license=(GPL3)
depends=('dconf' 'gnome-shell>=45' 'libgtop')
makedepends=('git' 'unzip' 'gettext')
provides=(gnome-shell-extension-tophat)
conflicts=(gnome-shell-extension-tophat)
source=($_pkgbase::git+https://github.com/enecciari/tophat.git#branch=45)
sha256sums=('SKIP')

#pkgver() {
  #cd "$_pkgbase"
  #git describe --long --tags | sed 's/^v//;s/\([^-]*-g\)/r\1/;s/-/./g'
#}

build() {
  cd "$srcdir/$_pkgbase"
  local _uuid="tophat@fflewddur.github.io"

  ./translate.sh
  mkdir -p ./${_uuid}/locale
  for potfile in po/*.po; do
    locale=$(basename "$potfile" .po)
    _path="./${_uuid}/locale/${locale}/LC_MESSAGES"
    mkdir -p "$_path"
    msgmerge -U "${potfile}" po/$_pkgbase.pot
    msgfmt -o "$_path/${_uuid}.mo" "${potfile}"
  done

  #./package.sh
  #unzip ./tophat@fflewddur.github.io.shell-extension.zip
}

package() {
  cd "$srcdir/$_pkgbase"

  # Locate the extension.
  cd "$(dirname $(find -name 'metadata.json' -print -quit))"
  _uuid=$(grep -Po '(?<="uuid": ")[^"]*' metadata.json) 
  _destdir="${pkgdir}/usr/share/gnome-shell/extensions/${_uuid}"

  # Copy extension files into place.
  find -maxdepth 1 \( -iname '*.js*' -or -iname '*.css' -or -iname '*.ui' -or -iname '*.json' \) -exec install -Dm644 -t "${_destdir}" '{}' +
  find -maxdepth 2 \( -iname '*.svg*' \) -exec install -Dm644 -t "${_destdir}/icons" '{}' +
  find -name '*.xml' -exec install -Dm644 -t "${pkgdir}/usr/share/glib-2.0/schemas/" '{}' +
  cp -r --no-preserve=ownership,mode lib "${_destdir}/lib"

  cd locale
  for locale in */; do
    install -Dm644 -t "${pkgdir}/usr/share/locale/${locale}/LC_MESSAGES" "${locale}/LC_MESSAGES"/*.mo
  done
}