# Maintainer: Jelle van der Waa <jelle@archlinux.org>

_commit=f124c5616cf38241e1a5e58808ed78e2d9a1d385
pkgname=marksman
pkgver=20241218
pkgrel=1
pkgdesc="Write Markdown with code assist and intelligence in the comfort of your favourite editor."
arch=('any')
url="https://github.com/artempyanykh/marksman"
license=('GPL')
makedepends=('dotnet-sdk-8.0' 'git')
depends=('dotnet-runtime-8.0')
options=('!strip')
source=($pkgname::git+https://github.com/artempyanykh/marksman.git#commit=$_commit)
b2sums=('5aab151cb0f913ee5ba932c11ed5ffbfed8ebef75536c2926ecb639d003346cef74c2ab4c8a9be6d86d54ca7a96dc9f4b19303d080c33670af81f136b714632e')

build() {
  cd "${srcdir}/marksman"
  git init

  # Disable dotnet telemetry
  export DOTNET_CLI_TELEMETRY_OPTOUT=1

  dotnet build --configuration Release Marksman.sln
  dotnet publish --configuration Release Marksman.sln --output "$PWD"/publish
}

package() {
  mkdir -p "$pkgdir"/usr/lib
  mkdir -p "$pkgdir"/usr/bin
  cp -dr --no-preserve='ownership' marksman/publish "$pkgdir"/usr/lib/marksman

  ln -s /usr/lib/marksman/marksman "$pkgdir"/usr/bin/marksman
}
