summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: f2c9b4cffaac502cb39984a082ac7a131855bdbc (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
# Maintainer:
# Contributor: Mark Wagie <mark dot wagie at tutanota dot com>
# Contributor: Pagnite <tymoteuszdolega at gmail dot com>
# Contributor: Bjorn Neergaard (neersighted) <bjorn@neersighted.com>
# Contributor: Felix Yan <felixonmars@archlinux.org>
# Contributor: Deon Spengler <deon@spengler.co.za>

## useful links
# http://ddcutil.com/
# https://github.com/rockowitz/ddcutil

_pkgname="ddcutil"
pkgname="$_pkgname-git"
pkgver=2.1.4.r94.g1ce8d58
pkgrel=1
pkgdesc='Query and change Linux monitor settings using DDC/CI and USB.'
url='https://github.com/rockowitz/ddcutil'
license=('GPL-2.0-or-later')
arch=('x86_64')

depends=(
  'glib2'
  'i2c-tools'
  'jansson'
  'kmod'
  'libdrm'
  'libusb'
  'libxrandr'
)
makedepends=(
  'git'
  'systemd'
)

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

_pkgsrc="$_pkgname"
source=("$_pkgsrc"::"git+$url.git")
sha256sums=('SKIP')

pkgver() {
  cd "$_pkgsrc"

  (
    # switch default branch, in case cache is out of date
    local _branch=$(git branch -a | grep 'remotes/origin/[0-9]' | sort -rV | head -1 | sed 's&^.*remotes/origin/&&')
    git checkout -f "$_branch"
    git reset --hard HEAD
  ) > /dev/null

  git describe --long --tags --abbrev=7 --exclude='*[a-z][a-z]*' \
    | sed -E 's/^v//;s/([^-]*-g)/r\1/;s/-/./g'
}

prepare() {
  cd "$_pkgsrc"
  NOCONFIGURE=1 ./autogen.sh
}

build() {
  cd "$_pkgsrc"
  ./configure --prefix=/usr
  make
}

package() {
  cd "$_pkgsrc"
  make DESTDIR="$pkgdir" install
}