# Maintainer: Jan Alexander Steffens (heftig) <heftig@archlinux.org>

pkgname=libopenaptx
pkgver=0.2.0
pkgrel=1
pkgdesc="Open Source aptX codec library"
url="https://github.com/pali/libopenaptx"
arch=(x86_64 riscv64)
license=(LGPL)
depends=(glibc)
makedepends=(git)
provides=(libopenaptx.so)
_commit=2459ed4686eaef0a19dfa3f330a960813c5f60de  # tags/0.2.0^0
source=("git+$url#commit=$_commit")
sha256sums=('SKIP')

# Do not upgrade to 0.2.1; hostile license change.
# See https://gitlab.freedesktop.org/pipewire/pipewire/-/commit/d08b6fac6bec0d334ee9fc785d551a67832f95fe
[[ $pkgver == 0.2.0 ]] || exit 1

pkgver() {
  cd $pkgname
  git describe --tags | sed 's/-/+/g'
}

prepare() {
  cd $pkgname
}

_make() {
  make CPPFLAGS="$CPPFLAGS" CFLAGS="$CFLAGS" LDFLAGS="$LDFLAGS" \
    PREFIX=/usr "$@"
}

build() {
  cd $pkgname
  _make
}

package() {
  cd $pkgname
  _make DESTDIR="$pkgdir" install
}
