# Maintainer: ced0180 <countbaster@gmail.com>

pkgname=skull-shell
pkgver=0.1.0.r7.gd1c6715
pkgrel=1
pkgdesc='Tiny POSIX-style shell written in C++20'
arch=('x86_64' 'aarch64')
url='https://codeberg.org/SkullOS/skull-shell'
license=('Apache-2.0')
depends=()
makedepends=('gcc')
provides=('skull')
conflicts=('skull-shell-git' 'skull')
options=('!debug')
install='skull-shell.install'
_commit='d1c6715ab082fae28686fb10022901c2d62a85cc'
source=("skull-shell-$_commit.tar.gz")
sha256sums=('e6bcf32faefe620153e6cf260e5ce65d0c11d3711fc96b1c8d07ebfeb199b856')

build() {
    cd "$srcdir/skull-shell-$_commit"
    mapfile -t sources < <(find src -name '*.cpp' -print | sort)
    g++ ${CXXFLAGS:-} ${CPPFLAGS:-} -std=c++20 -Isrc "${sources[@]}" \
        -o skull \
        ${LDFLAGS:-} -static-libstdc++ -static-libgcc -ldl
}

package() {
    cd "$srcdir/skull-shell-$_commit"
    install -Dm755 skull "$pkgdir/usr/bin/skull"
    install -Dm644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
    install -Dm644 README.md "$pkgdir/usr/share/doc/$pkgname/README.md"
    install -Dm644 README.ja.md "$pkgdir/usr/share/doc/$pkgname/README.ja.md"
}
