# $Id$
# Maintainer: MediaArea.net SARL <info@mediaarea.net>
# Contributor: hydro <hydro@freenet.de>

pkgname=('libmediainfo' 'python-mediainfo')
pkgver=23.04
pkgrel=1
pkgdesc="shared library for mediainfo"
arch=('i686' 'x86_64')
url="http://mediaarea.net"
license=('BSD-2-Clause')
makedepends=('libtool' 'automake' 'autoconf' 'python')
depends=( 'curl' 'libmms' 'libzen>=0.4.41')
source=(${pkgname}_${pkgver}.orig.tar.xz)
md5sums=('00000000000000000000000000000000')

build() {
  cd $srcdir/MediaInfoLib/Project/GNU/Library
  sh ./autogen.sh
  ./configure --prefix=/usr --enable-shared --disable-static --with-libcurl --with-libmms
  make clean
  make
}

package_libmediainfo() {
  cd $srcdir/MediaInfoLib/Project/GNU/Library
  make DESTDIR=$pkgdir install
  for i in MediaInfo MediaInfoDLL; do
    install -dm 755 $pkgdir/usr/include/$i
    install -m 644 $srcdir/MediaInfoLib/Source/$i/*.h $pkgdir/usr/include/$i
  done
}

package_python-mediainfo() {
  pkgdesc="shared library for mediainfo - python3 binding"
  depends=('python3' 'libmediainfo')
  local dst=$(python3 -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")
  install -dm 755 $pkgdir/$dst
  install -m 644 $srcdir/MediaInfoLib/Source/MediaInfoDLL/MediaInfoDLL3.py $pkgdir/$dst
  python3 -m compileall -b $pkgdir/$dst
}
