# Packager = Tuxcore <dev@tuxcore.org> 
pkgname=libmodplug
pkgver=0.8.9.0
pkgrel=5
pkgdesc="A MOD playing library"
arch=('x86_64')
url="http://modplug-xmms.sourceforge.net/"
license=('custom')
depends=('gcc-libs')
source=(https://downloads.sourceforge.net/modplug-xmms/${pkgname}-${pkgver}.tar.gz
        libmodplug-0.8.9.0-no-fast-math.patch)
sha256sums=('457ca5a6c179656d66c01505c0d95fafaead4329b9dbaa0f997d00a3508ad9de'
            '24b97252803b39546199715158ab1d61616755c6c9756f8b2b9b1948477ce4ed')

prepare() {
  cd ${pkgname}-${pkgver}
  # FS#76950 (Gentoo)
  patch -Np1 -i ../libmodplug-0.8.9.0-no-fast-math.patch
  autoreconf -vfi
}

build() {
  cd ${pkgname}-${pkgver}
  ./configure --prefix=/usr
  sed -i -e 's/ -shared / -Wl,-O1,--as-needed\0/g' libtool
  make
}

package() {
  cd ${pkgname}-${pkgver}
  make DESTDIR="${pkgdir}" install
  install -D -m644 COPYING "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
}
