# Maintainer: Celeste <cielesti@protonmail.com>
pkgname=m17n-lib
pkgver=1.8.4
pkgrel=2
pkgdesc="gnu M-text multilingualization library"
url="https://www.nongnu.org/m17n/"
arch="all"
license="LGPL-2.1-or-later"
depends="m17n-db"
depends_dev="
	m17n-db-dev
	$pkgname-tools=$pkgver-r$pkgrel
	"
makedepends="
	anthy-dev
	fontconfig-dev
	freetype-dev
	fribidi-dev
	gettext-dev
	libthai-dev
	libx11-dev
	libxaw-dev
	libxft-dev
	libxml2-dev
	libxt-dev
	"
subpackages="
	$pkgname-dev
	libm17n-core
	libm17n-flt
	$pkgname-tools
	"
source="https://download.savannah.gnu.org/releases/m17n/m17n-lib-$pkgver.tar.gz"

build() {
	export CFLAGS="$CFLAGS -flto=auto $(pkg-config --cflags glib-2.0)"
	export LIBS="-lintl"

	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--localstatedir=/var \
		--disable-dependency-tracking \
		--disable-static
	make
}

check() {
	make check
}

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

core() {
	pkgdesc="$pkgdesc (-core lib)"

	amove usr/lib/libm17n-core.so.*
}

flt() {
	pkgdesc="$pkgdesc (-flt lib)"

	amove usr/lib/libm17n-flt.so.*
}

tools() {
	pkgdesc="$pkgdesc (extra tools)"

	amove usr/bin
}

sha512sums="
7e322788aed8a758a8c289112433aabccd12dacf14b247ba9060503bcc44930c9251f0c4e718987b9a151de097e72bc1e07c8096f7f4ad83a7d7183a549721d6  m17n-lib-1.8.4.tar.gz
"
