#!/bin/sh

NAME="libebml"
DESC="C++ library to parse Extensible Binary Meta-Language files"

MAKEDEPS="cmake ninja"

PKG_VER=1.4.3
SOURCE="http://dl.matroska.org/downloads/libebml/libebml-$PKG_VER.tar.xz"

build() {
	if [ "$CBUILD" != "$CHOST" ]; then
		CMAKE_CROSSOPTS="-DCMAKE_SYSTEM_NAME=Linux -DCMAKE_HOST_SYSTEM_NAME=Linux"
	fi

	CXXFLAGS="$CXXFLAGS -flto=auto" \
	cmake -B build -G Ninja \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib \
		-DBUILD_SHARED_LIBS=True \
		-DCMAKE_BUILD_TYPE=None \
		$CMAKE_CROSSOPTS
	cmake --build build
}

package() {
	DESTDIR="$PKG_DEST" cmake --install build
}