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

EAPI=8

COMMIT="33d17845e34c7c8b897224d0d1c243951398f853"
JAVA_PKG_IUSE="doc source"

inherit java-pkg-2 java-pkg-simple

DESCRIPTION="UPnP port mapping library for Java based on sbbi-upnplib"
HOMEPAGE="https://github.com/RPTools/upnplib"
SRC_URI="https://github.com/RPTools/upnplib/archive/${COMMIT}.tar.gz -> ${P}.tar.gz"

LICENSE="LGPL-3+"
SLOT="0"
KEYWORDS="~amd64 ~x86"

CP_DEPEND="
	dev-java/commons-jxpath:0
	dev-java/log4j-12-api:2"

DEPEND="${CP_DEPEND}
	>=virtual/jdk-1.8:*"

RDEPEND="${CP_DEPEND}
	>=virtual/jre-1.8:*"

JAVA_SRC_DIR="src"

S="${WORKDIR}/${PN}-${COMMIT}"

src_prepare() {
	default
	# mx4j has been last-rited.
	rm -rv src/net/sbbi/upnp/jmx/ || die
}

src_install() {
	java-pkg-simple_src_install
	use doc && dodoc README.md docs/html/*.pdf
}