summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 34290c35bfd2aa3b61b6d820a931760f24f60d14 (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
# Maintainer:  <none>
# Contributor: dreieck
# Contributor: Richard Steinmetz <steinmetz.richard@googlemail.com>

_gitname="hidapi"
_pkgname="hidapi"
pkgname="${_pkgname}-git"
pkgver=0.14.0+40.r665.20241003.750bf20
pkgrel=1
epoch=1
pkgdesc='Simple library for communicating with USB and Bluetooth HID devices. Latest git checkout.'
arch=(
  "x86_64"
  "i686"
  "aarch64"
  "armv6h"
  "armv7h"
)
url='https://github.com/libusb/hidapi'
license=(
  'GPL-3.0-or-later'
  'BSD-3-Clause'
  'LicenseRef-HIDAPI'
)
depends=()
makedepends=(
  'autoconf' # for 'autoreconf'
  'automake'
  'bash'
  'git'
  'make'
  #'systemd'
  #'systemd-libs'
  'libusb'
  'libtool' # for 'libtoolize'
  'libudev.so'
)
optdepends=(
  "${_pkgname}-testgui: For a GUI programme using this library"
  'libusb: for the libusb backend -- hidapi-libusb.so'
  'libudev.so: for the hidraw backend -- hidapi-hidraw.so'
)
provides=(
  "${_pkgname}=${pkgver}"
)
conflicts=(
  "${_pkgname}"
)
source=(
  "${_gitname}::git+${url}.git"
)
sha256sums=(
  'SKIP'
)

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

  git log > git.log
}

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

  _ver_versionfile="$(< 'VERSION')"
  _ver_gittags="$(git describe --tags | sed -E -e 's|^hidapi-||' -e 's|^[vV]||' -e 's|\-g[0-9a-f]*$||' | tr '-' '+')"
  _ver="${_ver_gittags}"
  _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}/${_gitname}"

  ./bootstrap
  ./configure \
    --prefix=/usr \
    --enable-shared \
    --disable-static \
    --disable-testgui

  make
}

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

  make DESTDIR="$pkgdir/" install

  rm -fv "${pkgdir}/usr"/share/doc/"${_gitname}"/LICENSE*

  install -Dvm0644 -t "${pkgdir}/usr/share/doc/${_pkgname}" git.log AUTHORS.txt HACKING.txt README.md
  install -Dvm0644 -t "${pkgdir}/usr/share/licenses/${pkgname}" LICENSE.txt LICENSE-bsd.txt LICENSE-gpl3.txt LICENSE-orig.txt
}