# Contributor: Carlo Landmeter <clandmeter@gmail.com>
# Maintainer: Corey Oliver <corey.jon.oliver@gmail.com>

# Bundled libraries used in the package:
#
# Name         | License       | Location
# -------------+---------------+---------
# aes-gladman  | custom / GPL  | Source/ThirdParty/aes-gladman
# base64       | unknown       | Source/ThirdParty/base64
# hmac-gladman | custom / GPL  | Source/ThirdParty/hmac-gladman
# md5          | Public domain | Source/ThirdParty/md5
# sha1-gladman | custom / GPL  | Source/ThirdParty/sha1-gladman
# sha2-gladman | custom / GPL  | Source/ThirdParty/sha2-gladman

pkgname=libmediainfo
pkgver=17.12
pkgrel=0
pkgdesc="A shared library for mediainfo"
url="https://github.com/MediaArea/MediaInfoLib"
arch="all"
license="BSD custom"
depends_dev="zlib-dev"
makedepends="$depends_dev cmake curl-dev libmms-dev libzen-dev tinyxml2-dev"
subpackages="$pkgname-dev"
source="https://mediaarea.net/download/source/$pkgname/$pkgver/${pkgname}_$pkgver.tar.gz"
builddir="$srcdir/MediaInfoLib"
_cmakedir="$builddir/Project/CMake"
options="!check"  # upstream does not provide tests

prepare() {
	default_prepare
	cd "$builddir"

	rm -rf Project/MS*

	# Make sure that these bundled libs are not used.
	rm -R Project/zlib
	rm -R Source/ThirdParty/tinyxml2
}

build() {
	cd "$_cmakedir"

	cmake \
		-DCMAKE_BUILD_TYPE=Release \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_VERBOSE_MAKEFILE=ON \
		-DBUILD_SHARED_LIBS=ON
	make
}

package() {
	cd "$_cmakedir"

	make DESTDIR="$pkgdir" install
}

sha512sums="2433e33cfbd864e28342e5c199f6dc8ba166aa264b3713f061f8f875d151d20cd6de33ba2c1764ae04e4d66deef58a7eabb537d14cd1535f34ab1821e00c7a85  libmediainfo_17.12.tar.gz"
