summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: eaef0e3223faca73c19acd708b1e3371b4faff47 (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
# 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=2.0.r2.ga70209e_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() {
    # 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 "%s_score_patch" \
    "$(git describe --long --tags | sed 's/^v//;s/\([^-]*-g\)/r\1/;s/-/./g')"
}


build() {
    cd "${pkgname%%-git}/sources"
    make
}


package() {
    mkdir -p "$pkgdir/usr/share/doc/${pkgname%%-git}"
    mkdir -p "$pkgdir/usr/share/licenses/${pkgname}"

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

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

    # 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
}