pkgname=winc
pkgver=${WINC_ARCH_VERSION:?WINC_ARCH_VERSION is required}
pkgrel=1
pkgdesc='A lighter, faster desktop code editor'
arch=('x86_64')
url='https://winc.si'
license=('Apache-2.0')
depends=('glibc>=2.28' 'libgcc' 'fontconfig' 'ttf-font' 'libxkbcommon'
         'libxkbcommon-x11' 'libx11' 'libxcb' 'libxcursor' 'libxi' 'libxrandr' 'wayland')
options=('!strip' '!debug')

package() {
  install -Dm755 "$startdir/winc" "$pkgdir/usr/bin/winc"
  install -Dm755 "$startdir/winc-pty" "$pkgdir/usr/bin/winc-pty"
  # Uploaded to remote Linux hosts, never run from here: kept off the PATH.
  install -Dm755 "$startdir"/winc-server-Linux-* -t "$pkgdir/usr/lib/winc"
  install -Dm644 "$startdir/winc.desktop" "$pkgdir/usr/share/applications/winc.desktop"
  # Opens winc:// links; hidden from application menus.
  install -Dm644 "$startdir/winc-url-handler.desktop" "$pkgdir/usr/share/applications/winc-url-handler.desktop"
  install -Dm644 "$startdir/winc.png" "$pkgdir/usr/share/icons/hicolor/256x256/apps/winc.png"
  # The .winc-project type; the shared-mime-info hook updates the database.
  install -Dm644 "$startdir/winc.xml" "$pkgdir/usr/share/mime/packages/winc.xml"
  install -Dm644 "$startdir/project.svg" \
    "$pkgdir/usr/share/icons/hicolor/scalable/mimetypes/application-x-winc-project.svg"
  # Context menus of the Dolphin and Nemo file managers.
  install -Dm644 "$startdir/winc-open-file.desktop" "$startdir/winc-open-folder.desktop" \
    -t "$pkgdir/usr/share/kio/servicemenus"
  install -Dm644 "$startdir"/winc-open-*.nemo_action -t "$pkgdir/usr/share/nemo/actions"
  install -Dm644 "$startdir/LICENSE" "$startdir/NOTICE" -t "$pkgdir/usr/share/licenses/winc"
}
