# Template file for 'hunspell'
pkgname=hunspell
version=1.7.0
revision=2
build_style=gnu-configure
configure_args="--with-ui"
hostmakedepends="automake bison libtool pkg-config"
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/"
distfiles="https://github.com/hunspell/hunspell/archive/v${version}.tar.gz"
checksum=bb27b86eb910a8285407cf3ca33b62643a02798cf2eef468c0a74f6c3ee6bc8a

pre_configure() {
	autoreconf -fi
}

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

hunspell-devel_package() {
	depends="libstdc++-devel 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
	}
}
