# Maintainer: Dany Thinnes <deine@email.de>

pkgname=barecode-git
pkgver=r1.0.0
pkgrel=1
pkgdesc="Modularer Code-Editor, entwickelt von Projekt Hirnfrei (git)"
arch=('x86_64' 'aarch64')
url="https://git.projekt-hirnfrei.de/diabolus/BareCode"
license=('MIT')
depends=('qt6-base')
makedepends=('cmake' 'ninja' 'git')
provides=('barecode')
conflicts=('barecode')

source=("$pkgname::git+$url.git")
sha256sums=('SKIP')

pkgver()
{
    cd "$pkgname"
    printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
}

build()
{
    cmake \
        -B build \
        -S "$pkgname" \
        -G Ninja \
        -DCMAKE_BUILD_TYPE=Release \
        -DCMAKE_INSTALL_PREFIX=/usr
    cmake --build build
}

package()
{
    DESTDIR="$pkgdir" cmake --install build

    install -Dm644 "$pkgname/barecode.desktop" \
        "$pkgdir/usr/share/applications/barecode.desktop"

    # install -Dm644 "$pkgname/resources/barecode.png" \
    #     "$pkgdir/usr/share/pixmaps/barecode.png"

    install -Dm644 "$pkgname/LICENSE" \
        "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}
