# Copyright 2026 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
inherit java-pkg-2
MY_P="LanguageTool-${PV}"
DESCRIPTION="Local server for LanguageTool"
HOMEPAGE="https://dev.languagetool.org/http-server.html"
SRC_URI="https://internal1.languagetool.org/snapshots/LanguageTool-${PV}-snapshot.zip"
# https://dev.languagetool.org/roadmap
# In March 2025, LanguageTool has switched to a snapshot-based release model
# There will be no new ZIP files with a fixed version number X.Y anymore
S="${WORKDIR}/LanguageTool-6.9-SNAPSHOT"
LICENSE="LGPL-2.1"
SLOT="0"
KEYWORDS="amd64"
#java-pkg-2 sets java based on RDEPEND so the java slot in rdepend is used to build
RDEPEND="dev-libs/fastText
>=virtual/jre-25:*"
DEPEND="${RDEPEND}"
BDEPEND="app-arch/unzip"
src_install() {
dodir /usr/share/${PN}
# Using doins -r would strip executable bits from all binaries
cp -pPR ./* "${D}"/usr/share/${PN} || die "Failed to copy files"
insinto /usr/share/${PN}
doins "${FILESDIR}"/server.properties
newinitd "${FILESDIR}"/${PN}.initd ${PN}
}