summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: ed49888f86b047217db07f6bb968a302ad946f27 (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
67
68
69
70
# Maintainer: piegames <aur@piegames.de>
pkgname=blockmap-git
pkgver=2.4.0.r0.d47e3d4
pkgrel=1
pkgdesc="Minecraft map viewer/renderer"
arch=('any')
url="https://github.com/Minecraft-Technik-Wiki/BlockMap"
license=('MIT')
depends=('java-runtime>=17' 'hicolor-icon-theme' 'archlinux-java-run>=8' 'sh')
makedepends=('java-environment>=17' 'git')
source=("${pkgname}"::'git+https://github.com/Minecraft-Technik-Wiki/BlockMap'
		"blockmap.sh"
		"blockmap-gui.sh"
		"BlockMap.desktop")
sha512sums=('SKIP'
	'4b311ac92be3984eca9457f72c0fd87327532b063d5d6bdf38fec683ed2f14fd3dd252f7441e3b15429dcfe7618715da2c2c88adb9ef5b7be85b56d2b7aab35b'
	'5915722b07aba215978ab13531e672f54fc26ebb27cc82fbd8c6103b2ba28c7a1829128dbad31e1682525e78812a8d472d92a66653a4f2d49d7fc5b2ac175bb5'
	'1dee9e62b7b957fc0eb241555cd6037b3e6e4866ff9a05840fcff8f4f59082a212bbe8a4ff35b4dbc1ae605ba64c58a87044e34df21a50bb564b707600ff3025')

pkgver() {
	cd "$srcdir/${pkgname}"
	printf "%s" "$(git describe --long --tags | sed 's/\([^-]*-\)g/r\1/;s/-/./g')"
}

build() {
	cd "$srcdir/${pkgname}"
	
	# Taken from the JabRef AUR package
	mkdir -p ${srcdir}/gradle
	export GRADLE_USER_HOME=${srcdir}/gradle
	export JAVA_HOME=$(archlinux-java-run -a 17 -f jdk -j)
	echo "Using JDK from $JAVA_HOME to build BlockMap."
	
	# This *must* be in separate commands
	./gradlew --no-daemon clean
	./gradlew --no-daemon generateData
	./gradlew --no-daemon jar
	./gradlew --no-daemon copyLibs
}

package() {
	cd "$srcdir"
	
	# Install Arch-Linux specific files
	install -Dm755 'blockmap.sh'                                    "$pkgdir/usr/bin/blockmap"
	install -Dm755 'blockmap-gui.sh'                                "$pkgdir/usr/bin/blockmap-gui"
	install -Dm644 'BlockMap.desktop'                               "$pkgdir/usr/share/applications/BlockMap.desktop"

	cd "${pkgname}"
	
	# Install the license
	install -Dm644 'LICENSE'                                        "$pkgdir/usr/share/licenses/${pkgname}/license.txt"
	
	# Install the icon
	icon_sizes=(16 22 32 48 64 128 256 512 1024)
	for s in "${icon_sizes[@]}"; do
		install -Dm644 "icon/blockmap-${s}.png"                 "$pkgdir/usr/share/icons/hicolor/${s}x${s}/apps/blockmap.png"
	done
	
	# Install the binaries
	install -Dm644 "BlockMap-cli/build/libs/BlockMap-cli.jar"       "$pkgdir/usr/share/java/blockmap/BlockMap-cli.jar"
	install -Dm644 "BlockMap-gui/build/libs/BlockMap-gui-linux.jar" "$pkgdir/usr/share/java/blockmap/BlockMap-gui.jar"
	
	cd "build/libs/"

	# Install all the dependencies
	for name in *.jar ; do
		install -Dm644 "${name}"                                "$pkgdir/usr/share/java/blockmap/${name}"
	done
}