# Copyright 2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI="8"

inherit desktop java-pkg-2

DESCRIPTION="A visualization platform for molecular interaction networks"
HOMEPAGE="https://www.cytoscape.org/"
SRC_URI="https://github.com/cytoscape/cytoscape/releases/download/${PV}/cytoscape-unix-${PV}.tar.gz"

S="${WORKDIR}"

LICENSE="LGPL-2.1"
SLOT="0"
KEYWORDS="~amd64 ~x86"
RDEPEND="virtual/jdk:17"

src_install() {
	MY_PN="cytoscape"
	MYW="${WORKDIR}/${MY_PN}-unix-${PV}"

	insinto "/opt/${MY_PN}"
	doins -r ${MYW}/apps
	doins -r ${MYW}/framework
	doins -r ${MYW}/sampleData

	cd ${MYW}
	sh gen_vmoptions.sh
	doins Cytoscape.vmoptions
	exeinto "/opt/${MY_PN}"
	doexe "${MYW}/${MY_PN}.sh"
	dosym "${EPREFIX}/opt/${MY_PN}/${MY_PN}.sh" "${EPREFIX}/opt/bin/${MY_PN}"

	exeinto "/opt/${MY_PN}/framework/bin"
	doexe framework/bin/karaf

	newicon framework/cytoscape_logo_512.png cytoscape_logo.png
	make_desktop_entry ${MY_PN} CytoScape cytoscape_logo Science
}
