# Packager = Tuxcore <dev@tuxcore.org> 
pkgname=libopenmpt
pkgver=0.7.8
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=('ebfb2b87df46d3567130d4e4f477dbc1baa5e9dc4ae8af8add619771f71b3686332da3c22f7947403aa7078f38fae00a50a0381ef895fb0e7610120b5330f0d2')
b2sums=('f765c2ce9d82adff6fa3a78c3b346cb71662460b8e4ab1f77547a87e3b034146ec0c9e0ad9c38e0edbf9c2abfa3b0ee9e412c094ec494875fe58f86bc7b36dda')

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/"
}
