# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=libwmf
pkgver=0.2.13
pkgrel=1
pkgdesc="A library for reading vector images in Microsoft's native Windows Metafile Format (WMF)."
url="https://wvware.sourceforge.net/libwmf.html"
arch="all"
license="LGPL-2.0-or-later"
makedepends="
	autoconf
	automake
	expat-dev
	freetype-dev
	libjpeg-turbo-dev
	libpng-dev
	libtool
	"
subpackages="
	$pkgname-dev
	libwmflite:_lite
	"
source="$pkgname-$pkgver.tar.gz::https://github.com/caolanm/libwmf/archive/v$pkgver.tar.gz
	Fix-font-installation-dir.patch
	"

prepare() {
	default_prepare
	autoreconf -fi -Ipatches
}

build() {
	CFLAGS="$CFLAGS -flto=auto" \
	./configure \
		--host=$CHOST \
		--build=$CBUILD \
		--prefix=/usr \
		--with-gsfontdir=/usr/share/fonts/Type1 \
		--with-fontdir=/usr/share/fonts/Type1 \
		--with-gsfontmap=/usr/share/ghostscript/9.10/lib/Fontmap.GS
	make
}

package() {
	make -j1 DESTDIR="$pkgdir" install
}

_lite() {
	pkgdesc="A library for parsing Windows MetaFile vector graphics (WMF)."
	amove usr/lib/libwmflite*
}

sha512sums="
f45a936c9bc98fc1a5f2b0808b497119e4dcd3c132615fdddb7583e5719c7d1d7f85c16ebf313cad453e5b7ae3508bf6b80c4ed2b42322b7dec295d8f4eb86ce  libwmf-0.2.13.tar.gz
9330dce774ac70a1c70a5c4bc54a5a597fee5ab6c702464d6fd6ee204c4160798ae7ec9a107a61328d7b7b5d41898ac27f3fa152343f707f7bfe2a21291d7843  Fix-font-installation-dir.patch
"
