# Maintainer: astar76
# Built by tools/package.sh from the release tar.gz (TARBALL=file://… for an offline build); it keeps pkgver,
# sha256sums and the glibc floor current.
pkgname=damson-bin
pkgver=0.1.1
pkgrel=1
pkgdesc='Material You code editor with 462 languages built in'
arch=('x86_64')
url='https://archlinux.tail7c4f5e.ts.net/git/astar76/Damson'
license=('MIT')
# Linked: libc, libm, libgcc_s. dlopened (strings of the binary): libEGL/libGL (libglvnd), libwayland-client/-egl, libxkbcommon(-x11), libX11, libX11-xcb, libxcb, libXcursor, libXi, libXrender, libfontconfig, libdbus-1. Runs fc-match (fontconfig); git only for the git panel.
depends=('glibc>=2.35' 'gcc-libs' 'dbus' 'fontconfig' 'libglvnd' 'wayland' 'libxkbcommon' 'libxkbcommon-x11' 'libx11' 'libxcb' 'libxcursor' 'libxi' 'libxrender' 'hicolor-icon-theme')
optdepends=(
    'xdg-desktop-portal: open and save dialogs'
    'git: the git panel and changed lines'
    'clang: C and C++ language server (clangd)'
    'rust-analyzer: Rust language server'
    'python-lsp-server: Python language server'
    'gopls: Go language server'
    'typescript-language-server: TypeScript and JavaScript language server'
    'bash-language-server: shell language server'
    'lua-language-server: Lua language server'
    'sudo: saving files that need root'
)
provides=('damson')
conflicts=('damson')
options=('!strip' '!debug')
source=("Damson-$pkgver-Linux-x86_64.tar.gz::${TARBALL:-$url/releases/download/v$pkgver/Damson-$pkgver-Linux-x86_64.tar.gz}")
sha256sums=('735e34e69160620da8cc9e930401d677eb938a68d7ffe4c505fa9d99b3af5d39')

package() {
    cd "$srcdir/damson-$pkgver"
    install -d "$pkgdir/usr"
    for d in bin lib share; do [ ! -d "$d" ] || cp -R "$d" "$pkgdir/usr/"; done
    if [ -d "$pkgdir/usr/share/licenses/damson" ] && [ "$pkgname" != damson ]; then
        mv "$pkgdir/usr/share/licenses/damson" "$pkgdir/usr/share/licenses/$pkgname"
    fi
    install -Dm644 README.md "$pkgdir/usr/share/doc/$pkgname/README.md"
}
