summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: c7ac5b5286b85ed8703c5e4fbe7ce6d7e70dc106 (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
61
62
63
64
65
66
# Maintainer: Patrick Northon <northon_patrick3@yahoo.ca>
# Contributor: Mathias Walters <waltersm@protonmail.com>

pkgname=maptool
_pkgname=MapTool
pkgver=1.14.3
pkgrel=1
pkgdesc="An open source virtual tabletop program"
arch=('x86_64')
url='https://rptools.net/tools/maptool'
license=('AGPL3')
depends=()
makedepends=('git' 'dpkg' 'jdk21-openjdk' 'gradle' 'xdg-utils' 'rpm-tools')
source=(
	"git+https://github.com/RPTools/${pkgname}.git#tag=${pkgver}"
	"${pkgname}.sh")
sha256sums=('6c7ba98ffb42566e26f802f7dc59b46352ce08a44749fa397f540d240a711c33'
            'c1b1977801cfd84514359f405b5cb3fbeb56b1466d8cabc2ab87c41f79a590f9')
install="${pkgname}.install"

_prefix="opt/$pkgname"
_java_home='/usr/lib/jvm/java-21-openjdk'

prepare() {
	cd "${pkgname}"
	sed -i -r "s|jdkHome = jdkDownload.+$|jdkHome = \"$_java_home\"|" 'build.gradle'
}

build() {
	cd "${pkgname}"
	export JAVA_HOME="$_java_home"
	export PATH="$_java_home/bin:$PATH"
	gradle --no-daemon --parallel jpackage -x spotlessJavaCheck
}

check() {
	cd "${pkgname}"
	export JAVA_HOME="$_java_home"
	export PATH="$_java_home/bin:$PATH"
	gradle --no-daemon --parallel check
}

package() {
	depends+=('java-runtime=21' 'java-openjfx=21')
	
	cd "${pkgdir}"
	
	dpkg-deb -x "${srcdir}/${pkgname}/releases/"*.deb .
	
	install -dm755 "usr/share/java/${pkgname}"
	rm "${_prefix}/lib/app"/javafx*.jar
	mv "${_prefix}/lib/app"/*.jar "usr/share/java/${pkgname}"
	mv "${_prefix}/lib/"*.xml "usr/share/java/${pkgname}/${pkgname}-mimeinfo.xml"
	
	install -dm755 'usr/share/pixmaps'
	mv "${_prefix}/lib/"*.png "usr/share/pixmaps/${pkgname}.png"
	
	install -dm755 'usr/share/applications'
	mv "${pkgdir}/${_prefix}/lib/"*.desktop "usr/share/applications/${pkgname}.desktop"
	sed -i 's|Exec=/opt/maptool/bin/MapTool|Exec=/usr/bin/maptool|' "usr/share/applications/${pkgname}.desktop"
	sed -i -E 's|Icon=.*|Icon=maptool|' "usr/share/applications/${pkgname}.desktop"
	
	install -Dm755 "${srcdir}/${pkgname}.sh" "usr/bin/${pkgname}"
	
	rm -rf "${_prefix}"
}