summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 36922cf108b60d779047cd83464823843f6f6382 (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
# Maintainer: Tulpenkiste <tulpenkiste at the amogus email domain which is .cloud>
_pkgname=supertux-advance
pkgname=supertux-advance-git
pkgver=0.2.1.r600.g9ac64c2e
pkgrel=2
pkgdesc="A SuperTux game made in Brux GDK with 16bit-style graphics."

arch=(any)

url="https://github.com/KelvinShadewing/supertux-advance"
license=('AGPL-3.0-only')

depends=('brux-gdk-git')
makedepends=('git')

provides=("supertux-advance")
conflicts=("supertux-advance")

source=("$_pkgname::git+$url.git#branch=main" "$_pkgname-exec" "$_pkgname.desktop")
sha256sums=('SKIP' 'SKIP' 'SKIP')

pkgver() {
	cd "$_pkgname"

	local tag
	tag=$(git describe --tags --abbrev=0)

	# Get the number of commits since the last tag
	local commits
	commits=$(git rev-list "${tag}..HEAD" --count)

	# Get the current commit hash (abbreviated)
	local commit_hash
	commit_hash=$(git rev-parse --short HEAD)

	# Remove the 'v' prefix if it exists
	tag=${tag#v}

	# Construct the version string
	echo "${tag}.r${commits}.g${commit_hash}"
}

package() {
	# Executable and Desktop file
	install -Dm755 "$_pkgname-exec" "$pkgdir/usr/bin/$_pkgname"
	install -Dm644 "$_pkgname.desktop" "$pkgdir/usr/share/applications/$_pkgname.desktop"

	cd "$_pkgname"

	# Copy folder structure with good permissions
	/usr/bin/find . \
	-type d \
	-exec \
	/usr/bin/install -dm755 "${pkgdir}/opt/${_pkgname}/{}" \;

	# Populate with game-data, except the Windows bits and the executable
	/usr/bin/find . \
	-type f \
	-exec \
	/usr/bin/install -m644 "{}" "${pkgdir}/opt/${_pkgname}/{}" \;

	cd ..

	install -Dm644 "$_pkgname/icon.png" "$pkgdir/usr/share/icons/hicolor/16x16/apps/$_pkgname.png"
}