# Maintainer: suacayipkisi <konuki8523@gmail.com>
pkgname=t-code-ide
pkgver=0.4.1
pkgrel=1
pkgdesc='Lightweight C/C++ IDE: file tree, editor tabs with clangd and a shell'
arch=('x86_64')
url='https://github.com/suacayipkisi/t-code'
license=('MIT')
depends=('glib2' 'gtk4' 'gtksourceview5' 'json-glib' 'vte4' 'md4c' 'clang' 'git'
         'ttf-cascadia-code' 'hicolor-icon-theme')
makedepends=('pkgconf')
conflicts=('t-code')
optdepends=('ripgrep: faster Search panel (falls back to grep)'
            'gdb: the debugger (F5)')
# packaging/build.sh makes this tarball from the working tree
source=("t-code-$pkgver.tar.gz")
sha256sums=('SKIP')

build() {
  cd "t-code-$pkgver"
  make build/t-code
}

check() {
  cd "t-code-$pkgver"
  build/t-code --version | grep -qx "t-code $pkgver"
  # The other tests open windows and need a display.
  make build/test-searchmatch build/test-detect build/test-linediff
  build/test-searchmatch
  build/test-detect
  build/test-linediff
}

package() {
  cd "t-code-$pkgver"
  make DESTDIR="$pkgdir" PREFIX=/usr install
  install -Dm644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
  install -Dm644 THIRD-PARTY.md "$pkgdir/usr/share/licenses/$pkgname/THIRD-PARTY.md"
}
