summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: f7b79bb9309b3c29bbff1ab887318d580e168511 (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
# Maintainer:  dreieck (https://aur.archlinux.org/account/dreieck)
# Contributor: Pieter Robyns (https://aur.archlinux.org/account/rpp0)
# Contributor: remspoor

# Upstream URL: https://github.com/rpp0/gr-lora
# Based on Yuval Adam <yuval at y3xz dot com>'s gr-gsm PKGBUILD

pkgname=gr-lora-git
_gitname=gr-lora
pkgver=0.6.2+60.r190.20211210.90343d4
pkgrel=2
pkgdesc="GNURadio blocks for receiving LoRa modulated radio messages using SDR"
arch=('any')
url="https://github.com/rpp0/gr-lora"
license=('GPL-3.0-or-later')
depends=(
  'gcc-libs'
  'glibc'
  'gnuradio'
  'gmp'
  'libosmocore'
  'libvolk'
  'boost-libs'
  'liquid-dsp'
)
makedepends=(
  'boost'
  'cmake'
  'doxygen'
  'git'
  'log4cpp'
  'pybind11'
  'python>=3'
  'python-pygccxml'
  'swig'
)
provides=("gr-lora=${pkgver}")
source=("${_gitname}::git+${url}.git")
sha256sums=('SKIP')

prepare() {
  mkdir -p build
  cd "$_gitname"

  git log > "${srcdir}/git.log"
}

pkgver() {
  cd "$_gitname"
  _ver="$(git describe --tags | sed -E -e 's|^[vV]||' -e 's|\-g[0-9a-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() {
  cmake -B build -S "${_gitname}" \
    -DCMAKE_INSTALL_PREFIX=/usr \
    -DCMAKE_BUILD_TYPE=Release \
    -DENABLE_DOXYGEN=ON \
    -DENABLE_GRC=ON \
    -DENABLE_PYTHON=ON \
    -DENABLE_TESTING=ON \
    -DGRLORA_DEBUG=ON \
    -DHAS_MONGODB=OFF \
    -DVOLK_FOUND=ON
  make -C build
}

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

  cd "${srcdir}/${_gitname}"
  install -Dvm644 -t "${pkgdir}/usr/share/doc/gr-lora" "AUTHORS" "MANIFEST.md" "README.md" "${srcdir}/git.log"
  install -Dvm644 -t "${pkgdir}/usr/share/licenses/${pkgname}" LICENSE
  ln -svr "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE" "${pkgdir}/usr/share/doc/gr-lora/LICENSE"
}