# Maintainer: mhgu
pkgname=mhgu-relink
pkgver=0.2.2
pkgrel=1
pkgdesc="MHGU Relink: Monster Hunter Generations Ultimate recompiled runtime (Linux, Vulkan) with Rust networking"
arch=('x86_64')
url="https://github.com/MEKCCK/MHGU-Relink"
license=('MIT')
depends=('glibc' 'vulkan-icd-loader' 'sdl3' 'ffmpeg' 'shaderc')
optdepends=('pipewire: audio' 'libpulse: audio')
provides=('mhgu-recomp')
conflicts=('mhgu-recomp')
replaces=('mhgu-recomp')
# The translated game library (libmhgugame.so / mhgugame.so) is game code derived from the player's own
# dump: it is NOT packaged or distributed (the same rule as the Android APK, which only ships
# assets/gamelib_id.txt). The launcher loads it from your game folder. Run:
#   mhgu-relink /path/to/MHGU-1.4        (a folder with exefs/ and romfs/, 1.4.0 merged)
options=(!strip)

package() {
  cd "$startdir/../.."
  install -Dm755 build/mhgu-relink "$pkgdir/usr/lib/mhgu-relink/mhgu-relink"
  # The defaults (empty save/game folders): the program writes them out on its first run too.
  install -Dm644 packaging/default/mhgurecomp.ini "$pkgdir/usr/lib/mhgu-relink/mhgurecomp.ini"
  # pipelines.list is a pipeline cache: shipped when this checkout built one, else the game builds it.
  if [ -f build/pipelines.list ]; then
    install -Dm644 build/pipelines.list "$pkgdir/usr/lib/mhgu-relink/pipelines.list"
  fi
  if [ -d build/licenses ]; then cp -a build/licenses "$pkgdir/usr/lib/mhgu-relink/"; fi

  install -Dm755 packaging/arch-game/mhgu-relink.sh "$pkgdir/usr/bin/mhgu-relink"
  install -Dm644 packaging/arch-game/mhgu-relink.desktop "$pkgdir/usr/share/applications/mhgu-relink.desktop"
  install -Dm644 docs/pc.md "$pkgdir/usr/share/doc/$pkgname/README.md"
  install -Dm644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
  install -Dm644 THIRD_PARTY_NOTICES "$pkgdir/usr/share/licenses/$pkgname/THIRD_PARTY_NOTICES"
}
