# -*- 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
PortGroup           legacysupport 1.1

# strlen
legacysupport.newest_darwin_requires_legacy 10

github.setup        google bloaty 4a601b636e2347322d0371c8bf8ca5eaeaca4bac
version             2026.06.01
revision            0
categories          devel
license             Apache-2
maintainers         nomaintainer

description         Size profiler for binaries
long_description    Ever wondered what's making your binary big? Bloaty will show you a size \
                    profile of the binary so you can understand what's taking up space inside.

github.tarball_from archive

# https://github.com/google/bloaty/tree/main/third_party
set demumble_hash   10e00fb708a3d24c1bb16682cac76925ffb76af5

master_sites-append https://github.com/nico/demumble/archive/${demumble_hash}/:demumble
distfiles-append    demumble-${demumble_hash}${extract.suffix}:demumble

checksums           ${distname}${extract.suffix} \
                    rmd160  4c41e6d82f63c9553a8e2097bd7b5785725260bc \
                    sha256  8a2028f376f7c511a7076d4ee6447b2ca91a03554eea014b153efd49efc63e30 \
                    size    3959863 \
                    demumble-${demumble_hash}${extract.suffix} \
                    rmd160  b838f2fbdebbc19075820237604c4a34253ea4d1 \
                    sha256  6be3415d9287fd31a834bb8533e32e664ba42048c2751c0fa5fca2369851c146 \
                    size    332243

extract.only        ${distname}${extract.suffix}

post-extract {
    set tar [findBinary tar ${portutil::autoconf::tar_command}]
    system -W ${workpath} "${tar} -zxf ${distpath}/demumble-${demumble_hash}${extract.suffix}"
    delete ${worksrcpath}/third_party/demumble
    move ${workpath}/demumble-${demumble_hash} ${worksrcpath}/third_party/demumble
}

# Unbreak big-endian:
patchfiles-append   patch-mach-o.diff

depends_build-append \
                    path:bin/pkg-config:pkgconfig

depends_lib-append  port:abseil \
                    port:capstone \
                    port:protobuf \
                    port:re2 \
                    port:zlib \
                    port:zstd

compiler.cxx_standard   2020

configure.args-append \
                    -DBLOATY_ENABLE_RE2=ON \
                    -DBLOATY_PREFER_SYSTEM_ABSL=ON \
                    -DBLOATY_PREFER_SYSTEM_CAPSTONE=ON \
                    -DBLOATY_PREFER_SYSTEM_PROTOBUF=ON \
                    -DBLOATY_PREFER_SYSTEM_RE2=ON \
                    -DBLOATY_PREFER_SYSTEM_ZLIB=ON \
                    -DBLOATY_PREFER_SYSTEM_ZSTD=ON \
                    -DBUILD_TESTING=OFF
