summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 15965c10856a2257f2b7a1d799b20e25db4a70d7 (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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
# Maintainer:
# Contributor: katt <magunasu.b97@gmail.com>
# Contributor: FadeMind <fademind@gmail.com>
# Contributor: Andrea Scarpino <andrea@archlinux.org>

_pkgname="spectacle"
pkgname="$_pkgname-git"
pkgver=24.02.1.r23.gb4c8502
pkgrel=1
pkgdesc='KDE screenshot capture utility'
url='https://invent.kde.org/graphics/spectacle'
license=('GPL-2.0-or-later')
arch=('x86_64')

depends=(
  'kpipewire'
  'layer-shell-qt'
  'purpose'
  'qt6-multimedia'
  'xcb-util-cursor'
  'zxing-cpp'

  ## implicit
  #hicolor-icon-theme
  #kconfig
  #kconfigwidgets
  #kcoreaddons
  #kdbusaddons
  #kglobalaccel
  #kguiaddons
  #ki18n
  #kio
  #kirigami
  #kjobwidgets
  #knotifications
  #kservice
  #kwidgetsaddons
  #kwindowsystem
  #kxmlgui
  #libxcb
  #qt6-base
  #qt6-declarative
  #qt6-wayland
  #wayland
  #xcb-util
  #xcb-util-image
)
makedepends=(
  'extra-cmake-modules'
  'git'
  'kdoctools'
  'ninja'
  'plasma-wayland-protocols'
)

provides=("$_pkgname=${pkgver%%.r*}")
conflicts=("$_pkgname")

_pkgsrc="$_pkgname"
source=("git+https://invent.kde.org/graphics/spectacle.git")
sha256sums=('SKIP')

pkgver() {
  cd "$_pkgsrc"

  local _regex='^\s+<release version="([0-9]+\.[0-9]+(\.[0-9]+)?)".*>$'
  local _file='desktop/org.kde.spectacle.appdata.xml'

  local _line=$(grep -E "$_regex" "$_file" | head -1)
  local _line_num=$(grep -Ensm1 "$_regex" "$_file" | cut -d':' -f1)

  local _version=$(sed -E "s@$_regex@\1@" <<< "$_line")
  local _commit=$(git blame -L $_line_num,+1 -- "$_file" | awk '{print $1;}')
  local _revision=$(git rev-list --count --cherry-pick "$_commit"...HEAD)
  local _hash=$(git rev-parse --short=7 HEAD)

  printf '%s.r%s.g%s' "${_version:?}" "${_revision:?}" "${_hash:?}"
}

build() {
  local _cmake_options=(
    -B "build"
    -S "$_pkgsrc"
    -G Ninja
    -DCMAKE_BUILD_TYPE=None
    -DCMAKE_INSTALL_PREFIX=/usr
    -DBUILD_TESTING=OFF
    -Wno-dev
  )

  cmake "${_cmake_options[@]}"
  cmake --build "build"
}

package() {
  DESTDIR="$pkgdir" cmake --install "build"
}