# Maintainer: Filipe Laíns (FFY00) <lains@archlinux.org>
# Maintainer: Daniel Bermond <dbermond@archlinux.org>
# Included in Slint by Didier Spaier didieratslintdotfr
pkgname=codec2
pkgver=1.0.5
pkgrel=1slint
epoch=1
slackdesc=(\
"$pkgname (Open source speech codec)"
"Designed for communications quality speech between 450 and 3200 bit/s"
)
license=('LGPL2.1')
url='https://github.com/drowe67/codec2'
makedepends=('cmake')
provides=('freedv')
conflicts=('freedv')
source=("https://github.com/drowe67/codec2/archive/refs/tags/v1.0.5.tar.gz")
sha512sums=('1b59a0520d55b0f92b72a51dde0f58a0cd845056195734d23bf59bf44e7b5c7431bdc3cebe7c60aef7dadf3ec02f9edd62f041b4b283c05a4b50a0380f3ed67c')
docs=(COPYING README*)
build() {
  cmake -B build -S $pkgname-$pkgver \
  	-DCMAKE_BUILD_TYPE=Release \
  	-DCMAKE_INSTALL_PREFIX=/usr \
  	-DCMAKE_SKIP_RPATH=YES \
  	-Wno-dev

  make -C build
  make -C build DESTDIR="$PKG" install
  
  local _bin
  while read -r -d '' _bin
  do
      install -D -m755 "$_bin" -t "$PKG/usr/bin"
  done < <(find build -type f -regextype posix-extended \
           -regex '.*/(c2(demo|dec|enc|sim)|freedv_(t|r)x|(cohpsk|fdmdv|fsk|ldpc|ofdm)_.*)' \
           -executable -print0)
}
