# Maintainer: Sven-Hendrik Haase <svenstaro@archlinux.org>
# Contributor: Matthew Bowra-Dean <matthew@ijw.co.nz>
pkgname=openra
pkgver=20250330
pkgrel=1
pkgdesc="An open-source implementation of the Red Alert engine using .NET/Mono and OpenGL"
arch=('any')
url="https://www.openra.net"
license=('GPL3')
install=openra.install
depends=('ttf-dejavu' 'openal' 'libgl' 'freetype2' 'sdl2' 'lua51' 'hicolor-icon-theme'
         'gtk-update-icon-cache' 'desktop-file-utils' 'xdg-utils' 'zenity' 'dotnet-runtime-6.0')
makedepends=('git' 'unzip' 'dotnet-sdk-6.0')
options=(!debug)
source=("git+https://github.com/OpenRA/OpenRA.git#tag=release-${pkgver}")
sha512sums=('15857c788fdcb739f6392b9abc9281ef16ff6e3fd21c9af998aae02356f0c83ebb17e10232f2bb61f38c883cffe2c0739f3ca704e5a1b8d22eeadb5dd4f68386')

prepare() {
  cd OpenRA

  make version VERSION="release-${pkgver}"
}

build() {
  cd OpenRA

  make RUNTIME=net6 TARGETPLATFORM=unix-generic
}

package() {
  cd OpenRA
  mkdir -p "$pkgdir/usr/lib/openra/"
  cp -r bin/* "$pkgdir/usr/lib/openra/"
  source ./packaging/functions.sh
  install_data . "$pkgdir/usr/lib/openra/" cnc d2k ra
  make prefix=/usr DESTDIR="$pkgdir" install-linux-shortcuts
  make prefix=/usr DESTDIR="$pkgdir" install-linux-appdata
  # make prefix=/usr DESTDIR="$pkgdir" install-man
}
