summaryrefslogtreecommitdiff
path: root/hurrycurry-standalone-files/PKGBUILD
blob: 4fa6ef8d06698f3bc927f7bdcbecea8486d21d12 (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
94
95
96
97
98
99
100
101
102
103
104
105
106
# Maintainer: metamuffin <metamuffin@disroot.org>

pkgname=hurrycurry-standalone-files
pkgver=2.3.3
pkgrel=2
pkgdesc="A game about cooking (standalone files)"
arch=('any')
url="https://codeberg.org/hurrycurry/hurrycurry"
license=('AGPL3')
makedepends=(
    'rustup'
    'deno'
    'graphviz'
    'godot'
    'esbuild'
    'typst'
    'mingw-w64-gcc'
    'mingw-w64-binutils'
    'lib32-rust-libs'
)
source=("hurrycurry-$pkgver.tar.gz::https://codeberg.org/hurrycurry/hurrycurry/archive/v$pkgver.tar.gz")
sha256sums=('cbad7db09db129cfc79ee7464d83b29daae3ff71c4cc33432b91d317242f9ddf')

_targets=(
    "x86_64-unknown-linux-gnu"
    "aarch64-unknown-linux-gnu"
    # "armv7-unknown-linux-gnueabi"
    "i686-unknown-linux-gnu"
    "x86_64-pc-windows-gnu"
    "i686-pc-windows-gnu"
    "aarch64-linux-android"
    "armv7-linux-androideabi"
    "i686-linux-android"
    "x86_64-linux-android"
)

_target_suf() {
    if echo "$t" | grep -q android; then
        echo -n ".apk"
    elif echo "$t" | grep -q windows; then
        echo -n ".exe"
    fi
}

prepare() {
    cd "hurrycurry"
    rustup default nightly
    for t in "${_targets[@]}"; do
        rustup target add --toolchain "$(cat rust-toolchain)" "$t"
        cargo fetch --locked --target "$t"
    done
}
build() {
    # this might be useful:
    # > ln -s /usr/x86_64-w64-mingw32/lib/lib{i,I}phlpapi.a
    # > ln -s /usr/x86_64-w64-mingw32/include/{i,I}phlpapi.h
    # > ln -s /usr/i686-w64-mingw32/lib/lib{i,I}phlpapi.a
    # > ln -s /usr/i686-w64-mingw32/include/{i,I}phlpapi.h

    export GODOT_ANDROID_KEYSTORE_RELEASE_PATH="$HOME/infra/misc/hurrycurry/hurrycurry.keystore" # this wont work on your machine :)
    export GODOT_ANDROID_KEYSTORE_RELEASE_USER="hurrycurry"
    export GODOT_ANDROID_KEYSTORE_RELEASE_PASSWORD="hurrycurry"
    export CXXFLAGS=
    export LDFLAGS=
    export CFLAGS=

    mkdir -p out
    cd "hurrycurry"

    make client
    make -C data all

    local datafiles
    datafiles=(data/recipes/*.yaml data/maps/*.yaml data/index.yaml data/book.json)
    tar --zstd -cvf ../out/data.tar.zst "${datafiles[@]}"
    zip ../out/data.zip "${datafiles[@]}"

    godot --headless --export-pack wasm32-unknown-unknown ../../out/client-any.pck client/project.godot
    godot --headless --export-release wasm32-unknown-unknown ../../out/client-wasm32-unknown-unknown.html client/project.godot
    for t in "${_targets[@]}"; do
        godot --headless --export-release "$t" "../../out/client-$t$(_target_suf "$t")" client/project.godot
    done

    for t in "${_targets[@]}"; do
        if echo "$t" | grep -q android; then echo skip "$t"; continue; fi
        echo build "$t"
        cargo build --release --target "$t" --bin hurrycurry-server
        cargo build --release --target "$t" --bin hurrycurry-discover
        cargo build --release --target "$t" --bin hurrycurry-replaytool
    done
}
package() {
    out="$pkgdir/usr/share/hurrycurry/standalone-files"
    install -Dvm644 "out/client-any.pck" "$out/client-any.pck"
    install -Dvm644 "out/data.tar.zst" "$out/data.tar.zst"
    install -Dvm644 "out/data.zip" "$out/data.zip"
    for t in "${_targets[@]}"; do
        local suf
        suf=$(_target_suf "$t")
        install -Dvm644 "out/client-$t$suf" "$out/client-$t$suf"
        if echo "$t" | grep -q android; then continue; fi
        install -Dvm644 "hurrycurry/target/$t/release/hurrycurry-server$suf" "$out/server-$t$suf"
        install -Dvm644 "hurrycurry/target/$t/release/hurrycurry-discover$suf" "$out/discover-$t$suf"
        install -Dvm644 "hurrycurry/target/$t/release/hurrycurry-replaytool$suf" "$out/replaytool-$t$suf"
    done
}