summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 2fc232deaf4433bfffd37c6d72e4e0598d1a7aa4 (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
# Contributor: Dirk Sohler <spam@0x7be.de>
# Maintainer: Dirk Sohler <spam@0x7be.de>
# vim: ts=4:sw=4


# Decide for what type of installation to build.
#
# If you have a modern (i.e. reflecting the 5.10.0 name change to
# Luanti) installation using the new name directories, then you need
# to set `luanti` here.
#
# If you use a legacy/old installation use `mintest`.
#
# If you use the luanti-modern-common package from the AUR, use `luanti-modern`
#
# This defines the dependency package name as well as the target directory
# for the game files.
_type='luanti-modern'


pkgname=minetest-game-cdb
pkgver=20241116
pkgrel=1
pkgdesc='Latest version of “Minetest Game” from the Luanti Content Database, but installed system-wide as a regular Arch package based on Luanti or Minetest installation type.'


url='https://content.luanti.org/packages/Minetest/minetest_game/'
arch=('any')
license=('LGPL-2.1')
depends=("${_type}-common")
makedepends=('curl' 'unzip' 'jq')


# Only the icon can have a checksum. The Minetest Game data is pulled from the
# Content Database. The Content Database does not provide a usable checksum.
source=('minetest_cdb_icon.png')
sha256sums=('77883f101d4b46e3ed37bfc6095e1b2143a79ff852c702d6d98509b6d998ca6b')


prepare() {
    cdb='https://content.luanti.org'
    releases=$(curl "${cdb}/api/packages/Minetest/minetest_game/releases/")
    dlpath=$(echo $releases | jq -r '.[0].url')
    curl "${cdb}${dlpath}" --output 'minetest-game-cdb.zip'
    unzip "${srcdir}/minetest-game-cdb.zip"
}


pkgver() {
    date -d "$(echo $releases | jq -r '.[0].release_date')" "+%Y%m%d"
}


build() {
    gamepath="${srcdir}/minetest_game"
    newtitle="Minetest Game (CDB, ${pkgver})"
    sed -i "/^title /s/=.*$/= ${newtitle}/" "${gamepath}/game.conf"
    cp "${srcdir}/minetest_cdb_icon.png" "${gamepath}/menu/icon.png"
}


package() {
    location="usr/share/${_type%-modern}/games"
    install -d "${pkgdir}/${location}"
    cp -r "${srcdir}/minetest_game" "${pkgdir}/${location}/minetest_game"
}