# Maintainer: metamuffin pkgname=hurrycurry-standalone-files pkgver=2.3.5 pkgrel=1 pkgdesc="A game about cooking (standalone files)" 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' ) _inst_version=2.3.4 _website_version=2.3.4 source=("hurrycurry-$pkgver.tar.gz::https://codeberg.org/hurrycurry/hurrycurry/archive/v$pkgver.tar.gz" "hurrycurry-windows-installer-$_inst_version.tar.gz::https://codeberg.org/hurrycurry/windows-installer/archive/v$_inst_version.tar.gz" "hurrycurry-website-$_website_version.tar.gz::https://codeberg.org/hurrycurry/website/archive/v$_website_version.tar.gz") sha256sums=('d822c088806717055040d26d5c8e50508cf90a766b512b1acaabc7f42bc2d255' 'd071e15ca639ea481ccd96e3585a46acc8fb5f71a8d73124a7d98ff22eb40043' '5c63e7db9ff2fbb2f7f82ef04b63412913beb276e75b755a4c91967a390c2fea') _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 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 windows-installer ln -svfT ../hurrycurry main ln -svfT ../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" 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 "windows-installer/hurrycurry-install-x86_64.exe" "$out/windows-installer-x86_64.exe" install -Dvm644 "windows-installer/hurrycurry-install-i686.exe" "$out/windows-installer-i686.exe" }