#!/usr/bin/env bash
# Copyright (c) 2022 The Toltec Contributors
# SPDX-License-Identifier: MIT

pkgnames=(yaft)
pkgdesc="Yet another framebuffer terminal"
url=https://github.com/timower/rM2-stuff/tree/master/apps/yaft
_tag=0.1.1
pkgver=${_tag}-1
timestamp=2023-11-25T20:49:48Z
maintainer="Mattéo Delabre <spam@delab.re>"
license=GPL-3.0
section="admin"
image=base:v3.1
installdepends=(display terminfo)

source=()
sha256sums=()

prepare() {
    cd "$srcdir"
    mkdir -p yaft
    cd yaft
    git init
    git lfs install
    git remote add origin https://github.com/timower/rM2-stuff.git
    git fetch --depth 1 origin tag v${_tag} --no-tags
    git checkout v${_tag}
    git lfs fetch
    git lfs checkout
}

build() {
    mkdir build
    mkdir install
    cd build
    cmake -DCMAKE_TOOLCHAIN_FILE="/usr/share/cmake/$CHOST.cmake" \
        -DCMAKE_INSTALL_PREFIX="../install" -DCMAKE_BUILD_TYPE=Release ../yaft
    cd apps/yaft
    make
    make install
}

package() {
    cp -r "$srcdir/install/." "$pkgdir"
}
