summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: c05da7a20e6099599092b010a30e481a45a5f364 (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
71
72
73
74
75
76
77
# Maintainer: 0x715C <https://www.t.me/hex715C>

pkgname=atomrpg
_pkgname=atom_rpg_post_apocalyptic_indie_game
pkgver=1.073.26991
pkgrel=1
pkgdesc='Post-apocalyptic indie game'
url="https://${pkgname}.com/"
license=('custom:None')
arch=('i686' 'x86_64')
depends=('libgl' 'libx11' 'glu' 'desktop-file-utils' 'gtk-update-icon-cache')
makedepnds=('imagemagick' 'zip' 'unzip')
noextract=("${_pkgname}_${pkgver//./_}.sh")
source=("gog://${_pkgname}_${pkgver//./_}.sh"
"${pkgname}.desktop")
sha256sums=('350bb3877a5a7959e8f0f3a39e49aa616c5adf548f5037de73a92e49f1715b50'
			'41ac5904f3c913a112d420960aaca0fd4967ac23274eb5161a74e9d967c0349d')

# You need to download the gog.com installer file manually or with lgogdownloader.
DLAGENTS+=("gog::/usr/bin/echo %u - This is is not a real URL, you need to download the GOG file manually to \"$PWD\" or setup a gog:// DLAGENT. Read this PKGBUILD for more information.")

# Prevent compressing final package
PKGEXT='.pkg.tar'

prepare(){

	# Remove non matching architecture code
    case $CARCH in
      i686) _notarch=x86_64 ;;
      x86_64) _notarch=x86 ;;
    esac
    find -name "*$_notarch" -exec rm -r {} +

    # Unzip will produce an error code because it is unable to unzip the Installer.
    # Therefore, a conditional into a no-op command will keep the PKGBUILD from failing
    # Of course, if you have any real problems unzipping the PKGBUILD will not abort.
	echo "Removing setup scripts from ${_pkgname}_${pkgver//./_}.sh"
    zip -Fq "${_pkgname}_${pkgver//./_}.sh" --output "${pkgname}-${pkgver}.zip"
	echo "Extracting game data"
	unzip -q "${pkgname}-${pkgver}.zip"
	echo "Data extracted"

    cd "${srcdir}"
    echo $PWD

    cd "${srcdir}/data/noarch"
    sed -r -i \
    's/(CURRENT_DIR="\$\( cd "\$\( dirname )'`
      `'"\$\{BASH_SOURCE\[0\]\}"(.*$)'`
      `'/\1$( readlink -nf "${BASH_SOURCE[0]}" )\2/' \
    "start.sh"
}

package(){
    cd "${srcdir}/data/noarch"
    destdir="$pkgdir/opt/$pkgname"
    install -dm 755 "$destdir"

    # Install game
    install -d "${pkgdir}/opt/${pkgname}/"
    install -d "${pkgdir}/opt/${pkgname}/support"
    install -d "${pkgdir}/usr/bin/"
    cp -r "game/" "${pkgdir}/opt/${pkgname}/"
    install -Dm755 "start.sh" "gameinfo" "${pkgdir}/opt/${pkgname}/"
    install -Dm755 support/*.{sh,shlib} "${pkgdir}/opt/${pkgname}/support"

    # Desktop integration
    install -Dm 644 "support/icon.png" \
        "${pkgdir}/usr/share/pixmaps/${pkgname}.png"
    install -Dm644 "docs/End User License Agreement.txt" \
        "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
    install -Dm 644 "${srcdir}/${pkgname}.desktop" \
        "${pkgdir}/usr/share/applications/${pkgname}.desktop"
    ln -s "/opt/${pkgname}/start.sh" "${pkgdir}/usr/bin/${pkgname}"

    install -dm 755 "$pkgdir/usr/{bin,share/{applications,icons/hicolor/{scalable,256x256,64x64}/apps}}" "$destdir"
}