summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: ab861c9babef391bf387bef70e957c2c4d1b095f (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
# Contributor: dreieck (https://aur.archlinux.org/account/dreieck/)
# Contributor: Lone_Wolf <lone_wolf@klaas-de-kat.nl>
# Contributor: Jan de Groot <jgc@archlinux.org>

_pkgname='xf86-input-joystick'
pkgname="${_pkgname}-git"
pkgver=1.6.4+2.r300.20240220.a5f72be
pkgrel=2
pkgdesc="X.Org input driver that translates joystick input to mouse and keyboard events. (Do not use for games with native joystick support or XI2 applications. See manpage.) Latest git checkout."
arch=(
  'i686'
  'x86_64'
)
url="https://gitlab.freedesktop.org/xorg/driver/xf86-input-joystick"
license=(
  'LicenseRef-custom'
)
depends=(
  'glibc'
)
makedepends=(
  'xorg-server-devel'
  'xorgproto'
  'X-ABI-XINPUT_VERSION>=24.2'
  'X-ABI-XINPUT_VERSION<25'
)
provides=(
  "${_pkgname}=${pkgver}"
)
conflicts=(
  "${_pkgname}"
  'X-ABI-XINPUT_VERSION<24.2'
  'X-ABI-XINPUT_VERSION>=25'
)
source=(
  "${_pkgname}::git+https://gitlab.freedesktop.org/xorg/driver/xf86-input-joystick.git"
  '50-joystick-example.conf'
)
sha256sums=(
  'SKIP'
  'b516eb15d4d37149a4710cf70f1a9c9ca6b5d03ea4b68f43f923571384adf09c'
)

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

  NOCONFIGURE=1 ./autogen.sh

  git log > git.log
}

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

  _ver="$(git describe  --tags | sed 's|^xf86-input-joystick-||' | 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}"

  ./configure \
    --prefix=/usr

  make
}

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

  make DESTDIR="${pkgdir}" install

  install -Dvm644 "${srcdir}/50-joystick-example.conf" "${pkgdir}/usr/share/doc/${_pkgname}/example/xorg.conf.d/50-joystick-example.conf"
  install -Dvm644 -t "${pkgdir}/usr/share/doc/${_pkgname}" git.log README.md

  install -Dvm644 COPYING "${pkgdir}/usr/share/licenses/${pkgname}/COPYING"
  ln -svr "${pkgdir}/usr/share/licenses/${pkgname}/COPYING" "${pkgdir}/usr/share/doc/${_pkgname}/COPYING"
}