# Copyright 1999-2026 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI="8"

DESCRIPTION="An open source modelling toolkit for creating ArchiMate models and sketches."
HOMEPAGE="https://www.archimatetool.com https://github.com/archimatetool/archi"
SRC_URI="https://www.archimatetool.com/downloads/archi/${PV}.1/Archi-Linux64-${PV}.tgz"
S="${WORKDIR}/Archi"
LICENSE="MIT"
SLOT="0"
KEYWORDS="~amd64"
IUSE="doc"
RESTRICT="mirror"
RDEPEND="
	>=dev-java/jna-5.14.0
	>=virtual/jre-21
"
INSTALLDIR="/opt/Archi"
DOCS="docs/LICENSE.txt docs/change-log.txt docs/known-issues.txt"

src_install() {
	# QA, removing files containing writable executable sections and soname issues
	jna_dir="plugins/com.sun.jna_5.14.0.v20231211-1200/com/sun/jna"
	rm -rf "${S}/${jna_dir}"

	insinto ${INSTALLDIR}
	doins -r configuration features p2 plugins
	doins Archi.ini artifacts.xml icon.xpm

	exeinto ${INSTALLDIR}
	doexe Archi Archi.sh

	if use doc; then
		mv docs/Archi\ User\ Guide.pdf docs/Archi-User-Guide.pdf
		DOCS="${DOCS} docs/Archi-User-Guide.pdf"
	fi

	einstalldocs
}