summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: bdbccce2ceead23f7d6eec6c62afcc3cf3b84f3a (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
# Maintainer: Stefan Biereigel <stefan@biereigel.de>

pkgname=libbladerf-git
pkgver=2018.12.rc3.r3.g3bb8ad61
pkgrel=1
pkgdesc="Driver and userspace for the bladeRF SDR."
url="https://github.com/Nuand/bladeRF"
arch=('i686' 'x86_64')
license=('GPL2')
depends=('libusb')
provides=('bladerf')
conflicts=('bladerf')
makedepends=('cmake' 'help2man' 'doxygen')

source=("git+https://github.com/Nuand/bladeRF"
		"https://www.nuand.com/fpga/hostedxA4-latest.rbf"
		"https://www.nuand.com/fpga/hostedxA9-latest.rbf"
		"https://www.nuand.com/fpga/hostedx40-latest.rbf"
		"https://www.nuand.com/fpga/hostedx115-latest.rbf"
		"https://www.nuand.com/fx3/bladeRF_fw_latest.img")
md5sums=('SKIP'
         'SKIP'
         'SKIP'
         'SKIP'
         'SKIP'
         'SKIP')

prepare() {
  cd "$srcdir/bladeRF"
  sed -i 's|MODE.*$|TAG+="uaccess"|' host/misc/udev/88-nuand-bladerf1.rules.in
  sed -i 's|MODE.*$|TAG+="uaccess"|' host/misc/udev/88-nuand-bladerf2.rules.in
  sed -i 's|MODE.*$|TAG+="uaccess"|' host/misc/udev/88-nuand-bootloader.rules.in
}

pkgver() {
  cd "$srcdir/bladeRF"
  git describe --long --tags | sed -E 's/([^-]*-g)/r\1/;s/-/./g'
}

build() {
  cd "$srcdir/bladeRF"
  mkdir -p build
  cd build
  cmake \
    -DCMAKE_BUILD_TYPE=Release \
    -DINSTALL_UDEV_RULES=ON \
    -DBUILD_DOCUMENTATION=ON \
    -DCMAKE_INSTALL_LIBDIR:PATH=lib \
    -Dusb_LIBRARY:FILEPATH=/usr/lib/libusb-1.0.so \
    -DCMAKE_INSTALL_PREFIX=/usr ../
  make
  # ENABLE_FX3_BUILD needs cypress toolchain
  # really really wants to put files in /usr/lib64
}

package() {
  cd "$srcdir/bladeRF/build"
  make DESTDIR="${pkgdir}" install

  cd "$srcdir"
  install -Dm644 bladeRF_fw_latest.img "$pkgdir/usr/share/Nuand/bladeRF/firmware/bladeRF_fw_latest.img"
  install -Dm644 hostedxA4-latest.rbf  "$pkgdir/usr/share/Nuand/bladeRF/hostedxA4.rbf"
  install -Dm644 hostedxA9-latest.rbf  "$pkgdir/usr/share/Nuand/bladeRF/hostedxA9.rbf"
  install -Dm644 hostedx40-latest.rbf  "$pkgdir/usr/share/Nuand/bladeRF/hostedx40.rbf"
  install -Dm644 hostedx115-latest.rbf "$pkgdir/usr/share/Nuand/bladeRF/hostedx115.rbf"
}