# Maintainer: J. Peter Mugaas <jpmugaas@suddenlink.net>

_realname=libbdplus
pkgbase=mingw-w64-${_realname}
pkgname=("${MINGW_PACKAGE_PREFIX}-${_realname}")
pkgver=0.1.2
pkgrel=1
pkgdesc="Library for handling the BD+ protection scheme on bluray discs (mingw-w64)"
arch=('any')
mingw_arch=('mingw32' 'mingw64' 'ucrt64' 'clang64' 'clang32')
license=('LGPL')
url="https://www.videolan.org/developers/libbdplus.html"
depends=("${MINGW_PACKAGE_PREFIX}-libaacs>=0.7.0" "${MINGW_PACKAGE_PREFIX}-libgpg-error")
source=("https://download.videolan.org/pub/videolan/${_realname}/${pkgver}/${_realname}-${pkgver}.tar.bz2")
sha256sums=('a631cae3cd34bf054db040b64edbfc8430936e762eb433b1789358ac3d3dc80a')

build() {
  cd "$srcdir"/${_realname}-${pkgver}
  [[ -d "${srcdir}"/build-${CARCH} ]] && rm -rf "${srcdir}"/build-${CARCH}
  mkdir -p "${srcdir}"/build-${CARCH} && cd "${srcdir}"/build-${CARCH}
  ../${_realname}-${pkgver}/configure \
    --prefix=${MINGW_PREFIX} \
    --build=${MINGW_CHOST} \
    --host=${MINGW_CHOST} \
    --target=${MINGW_CHOST} \
    --enable-static \
    --enable-shared

  make
}

package() {
  cd "${srcdir}"/build-${CARCH}
  make install DESTDIR="${pkgdir}"
  install -Dm644 "$srcdir"/${_realname}-${pkgver}/COPYING "${pkgdir}${MINGW_PREFIX}/share/doc/${_realname}"/COPYING
  install -Dm644 "$srcdir"/${_realname}-${pkgver}/README.txt "${pkgdir}${MINGW_PREFIX}/share/doc/${_realname}"/README.txt
}
