summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: bdfe96ecb34f5124215a06dcce8e8da3adb2fb9a (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: Davide Gerhard <rainbow@irh.it>

pkgname=freedv-gui
pkgver=2.4.0
pkgrel=1
pkgdesc="Digital Voice for Radio Amateurs"
arch=('x86_64' 'aarch64')
license=('LGPL-2.1-or-later')
url="https://freedv.org/"
depends=('libpulse' 'hamlib' 'wxwidgets-gtk3' 'speex' 'libao' 'libsamplerate' 'gsm' 'libsndfile' 'libebur128')
makedepends=('cmake' 'patchelf' 'wget')
source=(
  "${pkgname}-${pkgver}.tar.gz::https://github.com/drowe67/$pkgname/archive/refs/tags/v$pkgver.tar.gz"
)
sha512sums=('9de8c8f373d66492079e346ccad28b512df1311fe031f002815fd73532f4591fb84e0cde6e2894c3d3a386480cca26acb23015ede8347b2c3ea04e5b40f7b201')

## trying to use local library
# Codec2:  fatal error: codec2_alloc.h: No such file or directory
# Opus: in Radae, cmake patch dnn/nnet.h < ${CMAKE_SOURCE_DIR}/src/opus-nnet.h.diff
#   then download https://github.com/xiph/opus/blob/f383ea8212f7f78d8c143b37a465897db72c3e26/dnn/download_model.sh
#   cmake patch for opus but then they use a shell script to download opus_data
# radae: who know?!
# mimalloc: requires cmake patch
# ebur128: from system
# rnnoise

radae_bins=(
  "radae_rx"
  "radae_tx"
  "lpcnet_demo"
)
radae_libs=(
  "librade.so.0.1"
)

build() {
  cmake -B build -S "$pkgname-$pkgver" \
    -Wno-dev \
    -DCMAKE_BUILD_TYPE=Release \
    -DCMAKE_INSTALL_PREFIX=/usr \
    -DUSE_STATIC_DEPS=FALSE \
    -DUSE_NATIVE_AUDIO=TRUE \
    -DUSE_STATIC_EBUR128=FALSE

  make -C build
}

package() {
  make -C build DESTDIR="$pkgdir" install

  # remove local RPATH and copy the file in pkgdir
  for file in "${radae_bins[@]}"; do
    patchelf --remove-rpath "build/_deps/freedv_backend-build/rade_build/src/$file"
    # can't pass -Wl,--strip-debug via CMAKE_C_FLAGS
    #strip --remove-section=.debug_info "build/rade_build/src/$file"
    install -m0755 -D "build/_deps/freedv_backend-build/rade_build/src/${file}" "$pkgdir/usr/bin/${file}"
  done
  for file in "${radae_libs[@]}"; do
    patchelf --remove-rpath "build/_deps/freedv_backend-build/rade_build/src/$file"
    #strip --remove-section=.debug_info "build/rade_build/src/$file"
    install -m0755 -D "build/_deps/freedv_backend-build/rade_build/src/${file}" "$pkgdir/usr/lib/${file}"
  done
  ln -s "/usr/lib/${radae_libs[0]}" "$pkgdir/usr/lib/librade.so"

  install -m0644 -D "$pkgname-$pkgver/COPYING" "$pkgdir/usr/share/licenses/${pkgname}/COPYING"
}