summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 9b41361103a0da21df94e628689487fd701316ab (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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
# Maintainer:  dreieck
# Contributor: Torge Matthies
# Contributor: Filipe LaĆ­ns (FFY00)

_pkgname='libratbag'
_pkgvariantsuffix='-nosystemd'
_vcssuffix='-git'
pkgname="${_pkgname}${_pkgvariantsuffix}${_vcssuffix}"
pkgver=0.17+314.r2493.20231218.8d7ca98c
pkgrel=1
pkgdesc='A DBus daemon to configure gaming mice. Compiled without systemd dependencies. Latest git version.'
arch=(
  'i686'
  'x86_64'
)
url='https://github.com/libratbag/libratbag'
license=('MIT')
depends=(
  'glib2'
  'libelogind'
  'libevdev'
  'libudev.so'
  'libunistring'
  'json-glib'
  'python'
  'python-evdev'
  'python-gobject'
)
optdepends=(
  'linux>=5.2: Linux>=5.2 is required for Logitech wireless devices.'
)
makedepends=(
  'meson'
  'swig'
  'git'
  'python-sphinx'
  'python-sphinx_rtd_theme'
)
checkdepends=(
  'check'
  'valgrind'
  'python-gobject'
  'python-lxml'
)
source=(
  "${_pkgname}::git+${url}.git"
)
sha256sums=(
  'SKIP'
)
provides=(
  "${_pkgname}=${pkgver}"
  "${_pkgname}${_vcssuffix}=${pkgver}"
  "${_pkgname}${_pkgvariantsuffix}=${pkgver}"
  "ratbagd=${pkgver}"
  "ratbagd${_vcssuffix}=${pkgver}"
  "ratbagd${_pkgvariantsuffix}=${pkgver}"
  "liblur=${pkgver}"
  "liblur${_vcssuffix}=${pkgver}"
)
conflicts=(
  "${_pkgname}"
  "ratbagd"
  "liblur"
)

prepare() {
  cd "${srcdir}/${_pkgname}"

  git log > git.log

  sed -i 's|sphinx-build3|sphinx-build|' doc/meson.build
}



pkgver() {
  cd "${srcdir}/${_pkgname}"

  _ver="$(git describe  --tags | sed 's|^[vV]||' | sed 's|-g[0-9a-fA-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
}

build() {
  cd "${srcdir}/${_pkgname}"

  mkdir -p build
  cd build

  local check
  if (( CHECKFUNC )); then
    check=true
  else
    check=false
  fi

  arch-meson .. \
    -Dsystemd=false \
    -Dlogind-provider=elogind \
    -Ddbus-group=input \
    -Ddocumentation=true \
    -Dtests="$check"

  ninja
}

check() {
  cd "${srcdir}/${_pkgname}"

  cd build

  meson test --no-rebuild
}

package() {
  cd "${srcdir}/${_pkgname}"

  cd build

  DESTDIR="${pkgdir}" ninja install

  # Install documentation
  install -dvm755 "$pkgdir"/usr/share/doc/$pkgname
  cp -r -a --no-preserve=ownership doc/html "$pkgdir"/usr/share/doc/$pkgname

  cd "${srcdir}/${_pkgname}"

  for _docfile in git.log README.md TODO; do
    install -Dvm644 "${_docfile}" "${pkgdir}/usr/share/doc/${pkgname%-git}/${_docfile}"
  done
  for _licensfile in COPYING; do
    install -Dvm644 "${_licensfile}" "${pkgdir}/usr/share/licenses/${pkgname}/${_licensfile}"
    ln -svr "${pkgdir}/usr/share/licenses/${pkgname}/${_licensfile}" "${pkgdir}/usr/share/doc/${pkgname%-git}/${_licensfile}"
  done
}