summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: aed97df490dc1b74d1ee4f42a93b364734f40000 (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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
# Maintainer: Rafael Fontenelle <rafaelff@gnome.org>

_name=ddnet
pkgname=$_name-git
pkgver=11.1.4.r0.g160b4df81
pkgrel=1
pkgdesc="DDraceNetwork, a mod of Teeworlds"
arch=('x86_64')
url="https://ddnet.tw"
license=('custom:BSD' 'CCPL:by-nc-sa')
depends=('alsa-lib' 'sdl2' 'freetype2' 'opusfile' 'curl' 'glew' 'wavpack')
makedepends=('git' 'cmake' 'python')
checkdepends=('gtest')
optdepends=('ddnet-skins: more skins for your tee'
            'ddnet-maps-git: have all DDNet maps available offline')
provides=('teeworlds-ddnet-git' 'ddnet')
conflicts=('teeworlds-ddnet-git' 'ddnet')
replaces=('teeworlds-ddnet-git')
source=("git+https://github.com/$_name/$_name"
        'ddnet.desktop' 'ddnet-server.desktop'
        'DDNet.png' 'DDNet-Server.png')
sha256sums=('SKIP'
            '11402ed2cf323e350e381588c7cb4fa1d450c19645a0a079897912134bb436bd'
            'fc8c27e129f92c5dddf96a079306a2439c8cc14d4b8ce719c5fa2f59aceee367'
            '1dc83efd9fdab2597fc4d41358628422a9550d4d23b60d273f2f30cf7b76dfaa'
            'e4083f1c40569146caabd21b8f24fdd7862e2f3040552e9c6a260df603249274')

pkgver() {
    cd $_name
    v=$(grep "GAME_RELEASE_VERSION" src/game/version.h | cut -d\" -f2)
    _commit=$(git log --pretty=oneline | grep "Version $v" | cut -d' ' -f1)
    r=$(git log $_commit..HEAD --pretty=oneline | wc -l)
    h=$(git rev-parse --short HEAD)
    printf $v.r$r.g$h
}

build() {
    [ -d build ] && rm -rf build
    mkdir build

    cd build
    cmake ../$_name -DCMAKE_BUILD_TYPE=Release
    make all tools
}

check() {
    cd build
    make -k run_tests
}

package() {
    cd build

      # Install DDNet client/server binaries
    install -d -m755 "$pkgdir/usr/bin"
    install -m755 DDNet                "$pkgdir/usr/bin/"
    install -m755 DDNet-Server         "$pkgdir/usr/bin/"

      # Install extra tools
    install -d -m755 "$pkgdir/usr/lib/ddnet/tools/"
    install -m755 config_retrieve      "$pkgdir/usr/lib/ddnet/tools/"
    install -m755 config_store         "$pkgdir/usr/lib/ddnet/tools/"
    install -m755 confusables          "$pkgdir/usr/lib/ddnet/tools/"
    install -m755 crapnet              "$pkgdir/usr/lib/ddnet/tools/"
    install -m755 dilate               "$pkgdir/usr/lib/ddnet/tools/"
    install -m755 dummy_map            "$pkgdir/usr/lib/ddnet/tools/"
    install -m755 fake_server          "$pkgdir/usr/lib/ddnet/tools/"
    install -m755 map_diff             "$pkgdir/usr/lib/ddnet/tools/"
    install -m755 map_extract          "$pkgdir/usr/lib/ddnet/tools/"
    install -m755 map_replace_image    "$pkgdir/usr/lib/ddnet/tools/"
    install -m755 map_resave           "$pkgdir/usr/lib/ddnet/tools/"
    install -m755 map_version          "$pkgdir/usr/lib/ddnet/tools/"
    install -m755 packetgen            "$pkgdir/usr/lib/ddnet/tools/"
    install -m755 tileset_borderadd    "$pkgdir/usr/lib/ddnet/tools/"
    install -m755 tileset_borderfix    "$pkgdir/usr/lib/ddnet/tools/"
    install -m755 tileset_borderrem    "$pkgdir/usr/lib/ddnet/tools/"
    install -m755 tileset_borderset    "$pkgdir/usr/lib/ddnet/tools/"
    install -m755 uuid                 "$pkgdir/usr/lib/ddnet/tools/"

      # Install data files
    install -d -m755 "$pkgdir/usr/share/ddnet/data/"
    cp -r data/* "$pkgdir/usr/share/ddnet/data/"
    rm -rf "$pkgdir/usr/share/ddnet/data/languages/scripts/"

      # Install desktop and icon files
    install -Dm644 DDNet.desktop        "$pkgdir/usr/share/applications/ddnet.desktop"
    install -Dm644 DDNet-Server.desktop "$pkgdir/usr/share/applications/ddnet-server.desktop"
    install -Dm644 DDNet-5.png          "$pkgdir/usr/share/pixmaps/DDNet.png"
    install -Dm644 DDNet-Server-8.png   "$pkgdir/usr/share/pixmaps/DDNet-Server.png"

      # Install license files
    install -Dm644 ../$_name/license.txt "$pkgdir/usr/share/licenses/$pkgname/license.txt"
}