# Packager = Tuxcore <dev@tuxcore.org> 
pkgname=libopenmpt
pkgver=0.7.11
pkgrel=1
pkgdesc="A library to render tracker music to a PCM audio stream"
arch=(x86_64)
url="https://lib.openmpt.org/libopenmpt/"
license=(BSD-3-Clause)
depends=(
  flac
  gcc-libs
  glibc
  libogg  # required by pkgconf
  libpulse
  libsndfile
  libvorbis
  mpg123
  portaudio
  zlib
)
makedepends=(
  autoconf-archive
  doxygen
  help2man
)
provides=(libopenmpt.so)
source=($pkgname-$pkgver.tar.gz::https://lib.openmpt.org/files/libopenmpt/src/$pkgname-$pkgver+release.autotools.tar.gz)
sha512sums=('f155f2c6f1d6a449ae0153976cd549b29ce1808f2655f6c9798f9fb0b7ad682ce8aa2fd54098817113519ec28ffeb3b531cca0901e5a897e45da14e639d5fe72')
b2sums=('c2c38c11637558f474aeeb482705e826310cae52b486e271dfe98a324387e20c0bb5c178bdb981f927bcc6c3f3d0e1d79bb5597dc8af1bf9ec20d73ffae6ef84')

prepare() {
  cd $pkgname-$pkgver+release.autotools
  autoreconf -fiv
}

build() {
  cd $pkgname-$pkgver+release.autotools
  ./configure --prefix=/usr
  # prevent excessive overlinking due to libtool
  sed -i -e 's/ -shared / -Wl,-O1,--as-needed\0/g' libtool
  make
}

check() {
  make -k check -C $pkgname-$pkgver+release.autotools
}

package() {
  cd $pkgname-$pkgver+release.autotools
  make DESTDIR="$pkgdir" install
  install -vDm 644 LICENSE -t "$pkgdir/usr/share/licenses/$pkgname/"
}
