# Template file for 'hunspell'
pkgname=hunspell
version=1.7.2
revision=1
build_style=gnu-configure
configure_args="--with-ui"
hostmakedepends="automake bison libtool pkg-config gettext-devel-tools"
makedepends="ncurses-devel"
short_desc="Spell checker and morphological analyzer"
maintainer="Orphaned <orphan@voidlinux.org>"
license="GPL-2.0-or-later, LGPL-2.1-or-later, MPL-1.1"
homepage="https://hunspell.github.io/"
changelog="https://github.com/hunspell/hunspell/releases"
distfiles="https://github.com/hunspell/hunspell/archive/v${version}.tar.gz"
checksum=69fa312d3586c988789266eaf7ffc9861d9f6396c31fc930a014d551b59bbd6e

pre_configure() {
	autoreconf -fi
}

libhunspell1.7_package() {
	short_desc+=" - runtime library"
	pkg_install() {
		vmove "usr/lib/*.so.*"
	}
}

hunspell-devel_package() {
	depends="ncurses-devel lib${sourcepkg}1.7>=${version}_${revision}"
	short_desc+=" - development files"
	pkg_install() {
		# Provides symlinks that don't have versions before the .so and .a parts
		# this fixes builds with stuff that uses -lhunspell instead of -lhunspell-x.y
		ln -rs "${DESTDIR}"/usr/lib/libhunspell-1.7.so ${DESTDIR}/usr/lib/libhunspell.so
		ln -rs "${DESTDIR}"/usr/lib/libhunspell-1.7.a ${DESTDIR}/usr/lib/libhunspell.a

		vmove usr/include
		vmove usr/lib/pkgconfig
		vmove usr/lib/*.a
		vmove usr/lib/*.so
		vmove usr/share/man/man3
	}
}
