# Packager = Tuxcore <dev@tuxcore.org> 
pkgname=opencore-amr
pkgver=0.1.6
pkgrel=1
pkgdesc="Open source implementation of the Adaptive Multi Rate (AMR) speech codec"
arch=(x86_64)
license=(Apache)
url="https://sourceforge.net/projects/opencore-amr/"
source=(https://downloads.sourceforge.net/sourceforge/$pkgname/$pkgname-$pkgver.tar.gz)
depends=(glibc)
provides=(libopencore-amrwb.so libopencore-amrnb.so)
sha512sums=('8955169954b09d2d5e2190888602c75771b72455290db131ab7f40b587df32ea6a60f205126b09193b90064d0fd82b7d678032e2b4c684189788e175b83d0aa7')
b2sums=('5f2f618b6d80d667fd99f1df8793cf0260d582e2fc8021f4af35d60b2b1db7be7c897d4b78589da5a442e684161cecef005ec4247cef7a9c3df797c68db97d52')

prepare() {
  cd $pkgname-$pkgver
  autoreconf -fiv
}

build() {
  cd $pkgname-$pkgver
  ./configure \
    --prefix=/usr \
    --disable-static \
    --enable-examples

  # prevent excessive overlinking due to libtool
  sed -i -e 's/ -shared / -Wl,-O1,--as-needed\0/g' libtool
  make
}

package() {
  make DESTDIR="$pkgdir" install -C $pkgname-$pkgver
  install -vDm 644 $pkgname-$pkgver/{ChangeLog,README} -t "$pkgdir/usr/share/doc/$pkgname/"
}

