# Contributor: Alex Yam <alex@alexyam.com>
# Maintainer: Celeste <cielesti@protonmail.com>
maintainer="Celeste <cielesti@protonmail.com>"
pkgname=libdatrie
pkgver=0.2.13
pkgrel=1
pkgdesc="library for double-array trie"
url="https://github.com/tlwg/libdatrie"
arch="all"
license="LGPL-2.1-or-later"
subpackages="$pkgname-dev $pkgname-libs $pkgname-doc"
source="https://github.com/tlwg/libdatrie/releases/download/v$pkgver/libdatrie-$pkgver.tar.xz"

prepare() {
	default_prepare
	update_config_sub
}

build() {
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--localstatedir=/var
	make
}

check() {
	make check
}

package() {
	# add -j1 to fix error:
	#   make[3]: Entering directory 'src/libdatrie-0.2.13/tools'
	#   rm -f pkg/libdatrie/usr/bin/trietool-0.2
	#   ln -s trietool pkg/libdatrie/usr/bin/trietool-0.2
	#   ln: pkg/libdatrie/usr/bin/trietool-0.2: No such file or directory
	#   make[3]: *** [Makefile:654: install-data-hook] Error 1
	make DESTDIR="$pkgdir" -j1 install
}

sha512sums="
db3c879d825ead5871c12ef3a06bb093cb1708a6e7e20775eaf82356af9dd6ad54c6b5cabbe1773f2494d3dfa2426528fdd49441038b6294b70ccb1a3d90099a  libdatrie-0.2.13.tar.xz
"
