summaryrefslogtreecommitdiff
blob: 1de1e9c1f80ebf60222e0d81445b5a3ba283e873 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# Copyright 1999-2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8

inherit desktop edos2unix java-pkg-2

DESCRIPTION="Unofficial online version of the Classic BattleTech board game"
HOMEPAGE="https://megamek.org/"
SRC_URI="
	https://downloads.sourceforge.net/project/megamek/Archived%20Stable/MegaMek%20v${PV}/MegaMek-v${PV}.zip
	https://dev.gentoo.org/~ionen/distfiles/${PN}.png"
S="${WORKDIR}"

LICENSE="GPL-2+"
SLOT="0"
KEYWORDS="~amd64 ~x86"

BDEPEND="app-arch/unzip"
DEPEND="
	>=dev-java/ant-1.10.14-r3
	>=virtual/jdk-1.8:*
"
RDEPEND=">=virtual/jre-1.8:*"

PATCHES=( "${FILESDIR}/megamek-0.34.10-source8.patch" )

src_prepare() {
	default #780585
	java-pkg-2_src_prepare

	rm MegaMek.jar || die

	sed -e "s|XmX|Xmx|" \
		-e "s|/usr/share/java|${EPREFIX}/usr/share/${PN}|" \
		-e "s|/usr/share/MegaMek|${EPREFIX}/usr/share/${PN}|" \
		startup.sh > ${PN} || die
	edos2unix ${PN}

	# workaround encoding issues posing problems with >=jdk-1.8
	find . -name '*.java' -exec sed -i 's/\xf6/\xc3\xb6/' {} + || die
}

src_compile() {
	eant \
		-Dant.build.javac.source="$(java-pkg_get-source)" \
		-Dant.build.javac.target="$(java-pkg_get-target)"
}

src_install() {
	dobin ${PN}

	insinto /usr/share/${PN}
	doins -r MegaMek.jar data docs l10n lib mmconf readme* # readme used at runtime

	dodoc HACKING readme.txt

	doicon "${DISTDIR}"/${PN}.png
	make_desktop_entry ${PN} MegaMek
}