summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: b20ae11dadd4e852ea570559cc19926339c7e57d (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
# Maintainer: benlypan <benlypan@gmail.com>
# Contributor: Niels Martignène <niels.martignene@gmail.com>

pkgname=mingw-w64-hidapi
pkgver=0.11.2
pkgrel=1
pkgdesc="Simple library for communicating with USB and Bluetooth HID devices (mingw-w64)"
arch=(any)
url="https://github.com/libusb/hidapi"
license=('GPL3' 'BSD' 'custom')
depends=('mingw-w64-crt')
makedepends=('mingw-w64-configure')
options=('!strip' '!buildflags' 'staticlibs')
source=(
  "https://github.com/libusb/hidapi/archive/hidapi-${pkgver}.tar.gz"
)
sha256sums=(
  'bc4ac0f32a6b21ef96258a7554c116152e2272dacdec1e4620fc44abeea50c27'
)

_architectures="i686-w64-mingw32 x86_64-w64-mingw32"

build() {
  cd "${srcdir}/hidapi-hidapi-${pkgver}"

  ./bootstrap
  for _arch in ${_architectures}; do
    mkdir -p build-${_arch} && pushd build-${_arch}
    ${_arch}-configure ..
    make
    popd
  done
}

package () {
  for _arch in ${_architectures}; do
    cd "${srcdir}/hidapi-hidapi-${pkgver}/build-${_arch}"
    make DESTDIR="${pkgdir}" install
    ${_arch}-strip --strip-unneeded "$pkgdir"/usr/${_arch}/bin/*.dll
    ${_arch}-strip -g "$pkgdir"/usr/${_arch}/lib/*.a
  done

  mkdir -p "${pkgdir}/usr/share/licenses/${pkgname}"
  cd "${srcdir}/hidapi-hidapi-${pkgver}"
  install -m644 LICENSE.txt LICENSE-bsd.txt LICENSE-orig.txt "${pkgdir}/usr/share/licenses/${pkgname}/"
}