# Maintainer: metamuffin pkgname=hurrycurry-standalone-files-git pkgver=r2462.46897ebd pkgrel=1 pkgdesc="A game about cooking (standalone files (git))" arch=('any') url="https://codeberg.org/hurrycurry/hurrycurry" license=('AGPL3') makedepends=( 'rustup' 'deno' 'graphviz' 'godot' 'esbuild' 'typst' 'nsis' 'mingw-w64-gcc' 'mingw-w64-binutils' 'lib32-rust-libs' ) source=("hurrycurry::git+https://codeberg.org/hurrycurry/hurrycurry.git" "hurrycurry-windows-installer::git+https://codeberg.org/hurrycurry/windows-installer.git" "hurrycurry-website::git+https://codeberg.org/hurrycurry/website.git") sha256sums=('SKIP' 'SKIP' 'SKIP') _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 } pkgver() { cd "hurrycurry" printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)" } 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 pushd "hurrycurry" git reset --hard 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[@]}" sed -i "s/^const DISTRIBUTION := .*/const DISTRIBUTION := \"standalone\"/" client/global.gd sed -i "s/^const VERSION := .*/const VERSION := \"$pkgver-$pkgrel\"/" client/global.gd 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 sed -i "s/^const DISTRIBUTION := .*/const DISTRIBUTION := \"windows-installer\"/" client/global.gd godot --headless --export-release "x86_64-pc-windows-gnu" "../../out/client-windows-installer-64.exe" client/project.godot godot --headless --export-release "i686-pc-windows-gnu" "../../out/client-windows-installer-32.exe" client/project.godot 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 popd pushd hurrycurry-windows-installer ln -svfT ../hurrycurry-website website make \ NSIFLAGS="-DVERSION=$pkgver-$pkgrel" \ DATA=../out/data.tar.zst \ CLIENT_64=../out/client-windows-installer-64.exe \ CLIENT_32=../out/client-windows-installer-32.exe \ SERVER_64=../hurrycurry/target/x86_64-pc-windows-gnu/release/hurrycurry-server.exe \ SERVER_32=../hurrycurry/target/i686-pc-windows-gnu/release/hurrycurry-server.exe \ DISCOVER_64=../hurrycurry/target/x86_64-pc-windows-gnu/release/hurrycurry-discover.exe \ DISCOVER_32=../hurrycurry/target/i686-pc-windows-gnu/release/hurrycurry-discover.exe popd } package() { out="$pkgdir/usr/share/hurrycurry/standalone-files/nightly" 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 install -Dvm644 "hurrycurry-windows-installer/hurrycurry-install-x86_64.exe" "$out/windows-installer-x86_64.exe" install -Dvm644 "hurrycurry-windows-installer/hurrycurry-install-i686.exe" "$out/windows-installer-i686.exe" }