summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: ae8c87b0ef32f60b4480a6a1b65e75ca6ef49eb4 (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
# Maintainer: Elias Riedel GĂ„rding <eliasrg@kth.se>
# Author: Hossein Bakhtiarifar <abakh@tuta.io>
# Discussion: https://www.reddit.com/r/linux/comments/b8y7rp/i_have_made_a_bunch_of_fancy_terminal_games_more/
pkgname=nbsdgames-git
pkgver=r35.06237f9_score_patch
pkgrel=1
pkgdesc="A collection of curses-based console games"
arch=('x86_64' 'i686')
url="https://github.com/untakenstupidnick/nbsdgames"
license=('custom')
depends=('ncurses')
makedepends=('git' 'make')
provides=('nbsdgames')
conflicts=('nbsdgames')
install=nbsdgames-git.install
source=("git+https://github.com/untakenstupidnick/nbsdgames.git")
md5sums=('SKIP')


prepare() {
    # Save a copyright notice (copied from the source code)
    cat > LICENSE <<EOF
copyright Hossein Bakhtiarifar 2018 (c)
No rights are reserved and this software comes with no warranties of any kind to the extent permitted by law.
EOF

    # Configure jewels and pipes to store scores in ~/.local/games/nbsdgames
    # (more appropriate for single-user systems) and save a message about it
    savedir="$HOME/.local/games/${pkgname%%-git}"

    sed -i "1,2s_/usr/games_${savedir}_" \
        "${pkgname%%-git}/sources/config.h"

    cat > score.txt <<EOF
${pkgname%%-git} was compiled to store scores from jewels and pipes in $savedir.
EOF
}


pkgver() {
    cd "${pkgname%%-git}"
    printf "r%s.%s_score_patch" \
        "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
}


build() {
    # The repo contains pre-compiled binaries, but ignore them and build
    # from source instead.
    cd "${pkgname%%-git}/sources"
    make
}


package() {
    mkdir -p "$pkgdir/usr/share/licenses/${pkgname}"
    cp LICENSE "$pkgdir/usr/share/licenses/${pkgname}"

    mkdir -p "$pkgdir/usr/share/doc/${pkgname%%-git}"
    cp score.txt "$pkgdir/usr/share/doc/${pkgname%%-git}"

    cd "${pkgname%%-git}"
    cp README.md "$pkgdir/usr/share/doc/${pkgname%%-git}"

    # Install games as /usr/bin/nbsd_* to avoid conflicts
    mkdir -p "$pkgdir/usr/bin"
    find sources -type f -executable | while read f
    do
        cp "$f" "$pkgdir/usr/bin/nbsd_$(basename "$f")"
    done
}