# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=portfile:et:sw=4:ts=4:sts=4

PortSystem          1.0
PortGroup           github 1.0
PortGroup           makefile 1.0

github.setup        Zibri gemini-cli 2.3.3
revision            0
categories          llm
maintainers         {@barracuda156 macos-powerpc.org:barracuda} openmaintainer
description         Portable command-line client for the Google Gemini API
long_description    {*}${description}
license             CC-BY-NC-SA-4
checksums           rmd160  7e6c532d539cf9f6ff9d5ad2001e14d0835a94ca \
                    sha256  756bd792641ee3ee5b5b920930136cf5c5d829fae22813cb6d73ade785b20379 \
                    size    85760
github.tarball_from archive

depends_lib-append  port:curl \
                    port:readline \
                    port:zlib

# Well, in 2.2.7 it is back to being broken.
# https://github.com/Zibri/gemini-cli/issues/7
post-patch {
    reinplace "s|CFLAGS =|CFLAGS +=|" ${worksrcpath}/Makefile
    reinplace "s|LDFLAGS =|LDFLAGS +=|" ${worksrcpath}/Makefile
}

# https://github.com/Zibri/gemini-cli/pull/4
configure.cflags-append \
                    -std=c99
build.env-append    CFLAGS=${configure.cflags}

destroot {
    copy ${worksrcpath}/${name} ${destroot}${prefix}/bin
}
