# -*- 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               cmake 1.1
PortGroup               github 1.0

github.setup            google flatbuffers 24.3.25 v
github.tarball_from     archive
revision                0

description             Memory Efficient Serialization Library

long_description        FlatBuffers is a cross platform serialization library \
                        architected for maximum memory efficiency. It allows \
                        you to directly access serialized data without \
                        parsing/unpacking it first, while still having great \
                        forwards/backwards compatibility.
homepage                https://google.github.io/flatbuffers/

categories              devel
license                 Apache-2

maintainers             {gmail.com:herby.gillot @herbygillot} {judaew @judaew} \
                        openmaintainer

checksums               rmd160  3886d6516183bb4a82ae7321dde728d409f71e0d \
                        sha256  4157c5cacdb59737c5d627e47ac26b140e9ee28b1102f812b36068aab728c1ed \
                        size    2297829

compiler.cxx_standard   2011
# Needed for - error: unknown attribute 'no_sanitize' ignored [-Werror,-Wattributes]
compiler.blacklist-append {clang < 800}

set fb_doc_dir          ${prefix}/share/doc/${name}
set fb_share_dir        ${prefix}/share/${name}

set fb_langs            {
                            android
                            dart
                            go
                            java
                            js
                            kotlin
                            lobster
                            lua
                            net
                            php
                            python
                            rust
                            swift
                            ts
                        }

configure.args-append   -DFLATBUFFERS_OSX_BUILD_UNIVERSAL=OFF

post-destroot {
    file mkdir ${destroot}${fb_doc_dir}
    file mkdir ${destroot}${fb_share_dir}

    copy {*}[glob ${worksrcpath}/docs/*] ${destroot}${fb_doc_dir}/

    foreach lang ${fb_langs} {
        copy ${worksrcpath}/${lang} ${destroot}${fb_share_dir}/
    }
}

notes "
Flatbuffers documentation can be found in:

    ${fb_doc_dir}


Flatbuffers implementations for various programming languages can be found in:

    ${fb_share_dir}
"
