# Contributor: Alex <alex@alexyam.com>
# Contributor: Leo <thinkabit.ukim@gmail.com>
# Contributor: Cormac Stephenson <c7s@kasku.net>
# Maintainer: Cormac Stephenson <c7s@kasku.net>
pkgname=libhangul
pkgver=0.1.0
pkgrel=1
pkgdesc="Library for Korean input method logic"
url="https://github.com/libhangul/libhangul"
arch="all"
license="LGPL-2.1-or-later"
makedepends="automake autoconf libtool gettext-dev xz"
subpackages="$pkgname-dev $pkgname-lang"
source="https://github.com/libhangul/libhangul/archive/refs/tags/libhangul-$pkgver.tar.gz
	fix-gettext-version.patch
	"
builddir="$srcdir/libhangul-libhangul-$pkgver"

prepare() {
	default_prepare
	touch ChangeLog
	autoreconf -vif
}

build() {
	# fix: "libhangul.so: undefined reference to 'libintl_gettext'"
	# when building fcitx5-hangul and rime-hangul
	export LDFLAGS="$LDFLAGS -lintl"
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr
	make
}

check() {
	make check
}

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

sha512sums="
f601c18de0f29e8826373c77a7b96938a0a54b8b10a14c4daebf2a93d6fc567edc470608f1573853e28db1f9d7a6c66debdbf6dff0262f9d69d4af7ed730f611  libhangul-0.1.0.tar.gz
8d41a76c4c186068551ebeb5bbab983e43435178dcd516279d16a7a03648f45fecf3fe9792e061c4b6f0f5bb2791776c7d6c6608dc9e7035e4a48110a4ef1890  fix-gettext-version.patch
"
