summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: fca5c1513fcc157564b64c9b5cff5a4a52f7e862 (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
# Maintainer: Mark Wagie <mark dot wagie at proton dot me>
pkgname=normcap
_app_id="com.github.dynobo.$pkgname"
pkgver=0.6.0
pkgrel=3
pkgdesc="OCR powered screen-capture tool to capture information instead of images"
arch=('any')
url="https://dynobo.github.io/normcap"
license=('AGPL-3.0-or-later AND MIT')
depends=(
  'hicolor-icon-theme'
  'leptonica'
  'libnotify'
  'pyside6'
  'python-jeepney'
  'python-pytesseract'
  'python-zxing-cpp'
  'shiboken6'
)
makedepends=(
  'python-babel'
  'python-build'
  'python-hatchling'
  'python-installer'
  'python-toml'
  'python-wheel'
)
checkdepends=(
  'appstream'
  'desktop-file-utils'
)
optdepends=(
  'gnome-shell-extension-window-calls: Window positioning handler for GNOME'
  'wl-clipboard: clipboard access for Wayland'
  'xclip: clipboard access for Xorg'
  'xsel: alternative Xorg clipboard handler'
)
source=("$pkgname-$pkgver.tar.gz::https://github.com/dynobo/normcap/archive/refs/tags/v$pkgver.tar.gz")
sha256sums=('aae35b423c2cc586ffc01cc556b4e7965133cc24cea296677efdac3de134cd50')

prepare() {
  cd "$pkgname-$pkgver"

  # Dbus service path
  sed -i 's/app/usr/g' "bundle/flatpak/${_app_id}.service"
}

build() {
  cd "$pkgname-$pkgver"
  python -m build --wheel --no-isolation
}

check() {
  cd "$pkgname-$pkgver"
  appstreamcli validate --no-net "bundle/flatpak/${_app_id}.appdata.xml"
  desktop-file-validate "bundle/flatpak/${_app_id}.desktop"
}

package() {
  cd "$pkgname-$pkgver"
  python -m installer --destdir="$pkgdir" dist/*.whl

  for icon_size in 16 32 64 128 256 512; do
    install -Dm644 bundle/imgs/$pkgname-${icon_size}.png \
      "$pkgdir/usr/share/icons/hicolor/${icon_size}x${icon_size}/apps/$pkgname.png"
  done

  install -Dm644 "bundle/imgs/$pkgname.svg" -t \
    "$pkgdir/usr/share/icons/hicolor/scalable/apps/"
  install -Dm644 "bundle/flatpak/${_app_id}.appdata.xml" -t \
    "$pkgdir/usr/share/metainfo/"
  install -Dm644 "bundle/flatpak/${_app_id}.desktop" -t \
    "$pkgdir/usr/share/applications/"
  install -Dm644 "bundle/flatpak/${_app_id}.service" -t \
    "$pkgdir/usr/share/dbus-1/services/"

  install -Dm644 LICENSE -t "$pkgdir/usr/share/licenses/$pkgname/"
}