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

PortSystem          1.0
PortGroup           github 1.0
PortGroup           golang 1.0

go.setup            github.com/samyfodil/musql 0.4.0 v
go.offline_build    no
revision            0

categories          databases
license             Apache-2
maintainers         @wu21-web openmaintainer

description         SQLite-compatible database with columnar storage and a JIT compiler
long_description    musql is a SQLite-compatible database written in pure Go, \
                    with columnar storage and just-in-time compilation. It \
                    includes the musqld server for libSQL and Turso clients, \
                    musql-convert for SQLite import and export, and the \
                    musql-doom example.

checksums           rmd160  92d76f8846d10c6a04443b3cb42b4bfc98727b47 \
                    sha256  30f7e3dc9a71203e6951984013f0176e107e26d66659e8ad995b0366e63f27db \
                    size    13881140

supported_archs     arm64 x86_64
installs_libs       no

build.env-append    CGO_ENABLED=0 GOTOOLCHAIN=local

build {
    foreach {directory binary package} {
        .               musql-convert   ./cmd/musql-convert
        hrana           musqld          ./cmd/musqld
        examples/doom   musql-doom      ./cmd/doom
    } {
        build.dir       ${worksrcpath}/${directory}
        build.pre_args  -trimpath -ldflags=\"-s -w\" -o ${workpath}/${binary}
        build.args      ${package}
        command_exec build
    }
}

destroot {
    foreach binary {musqld musql-convert musql-doom} {
        xinstall -m 0755 ${workpath}/${binary} ${destroot}${prefix}/bin/
    }
    xinstall -d ${destroot}${prefix}/share/doc/${name}
    xinstall -m 0644 ${worksrcpath}/LICENSE ${worksrcpath}/README.md \
        ${destroot}${prefix}/share/doc/${name}/
}
