summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 3d86c599e11342156b2a67c6c797b37da7699a50 (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
# Maintainer: Lexi <@alexis@fearness.org> (a fediverse address)

pkgname=catgirl-engine-git
pkgdesc="A game engine for cool moddability and procedurally generated data"
arch=('any')
license=(Zlib)
url="https://github.com/lexi-the-cute/catgirl-engine"
pkgver=v0.14.36.alpha.r2.gbcf5489
pkgrel=1
provides=("catgirl-engine=${pkgver%%.r*}")
conflicts=(catgirl-engine)
source=("git+https://github.com/lexi-the-cute/catgirl-engine.git")
b2sums=("SKIP")
options=(!strip !debug)
depends=()
makedepends=(
    "git"
    "rustup"
    "cargo"
    "sed"
)
optdepends=(
    "wayland: Graphics display server"
    "xorg-server: Graphics display server"
)

# Automatically updates pkgver variable
pkgver() {
    cd "catgirl-engine"
    git describe --long --tags --abbrev=7 | sed 's/\([^-]*-g\)/r\1/;s/-/./g'
}

# Prepares for building
prepare() {
    export RUSTUP_TOOLCHAIN=stable

    cd "catgirl-engine"
    rustup install $RUSTUP_TOOLCHAIN
    cargo +$RUSTUP_TOOLCHAIN fetch --locked --target "$(rustc -vV | sed -n 's/host: //p')"
}

# Builds files
build() {
    export RUSTFLAGS="-L/usr/lib -lzstd"
    export RUSTUP_TOOLCHAIN=stable
    export CARGO_TARGET_DIR=target

    cd "catgirl-engine"
    cargo +$RUSTUP_TOOLCHAIN build --frozen --release
}

# Checks built files
check() {
    export RUSTUP_TOOLCHAIN=stable

    cd "catgirl-engine"
    cargo +$RUSTUP_TOOLCHAIN test --frozen --workspace
}

# Packages built files
package() {
    cd "catgirl-engine"
    sed -i "s/\${engine_path}/\/usr\/bin\/catgirl-engine/" client/assets/resources/catgirl-engine.desktop
    mv client/assets/vanilla/texture/logo/logo.svg client/assets/vanilla/texture/logo/catgirl-engine.svg

    install -Dm0755 -t "$pkgdir/usr/share/icons" "client/assets/vanilla/texture/logo/catgirl-engine.svg"
    install -Dm0755 -t "$pkgdir/usr/share/applications/" "client/assets/resources/catgirl-engine.desktop"
    install -Dm0755 -t "$pkgdir/usr/bin/" "target/release/catgirl-engine"
}