# -*- 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
legacysupport.newest_darwin_requires_legacy 18
legacysupport.use_mp_libcxx yes

# src/third_party/blake3/CMakeLists.txt checks CMAKE_SIZEOF_VOID_P
PortGroup           muniversal 1.0

github.setup        ccache ccache 4.13.1 v
revision            0

checksums           rmd160  7441461f9b34838d3dff7a3b42441266ce8d2e5f \
                    sha256  85638df95c4d3907d9dd686583f2e0b2bd4c232d36e025a5c48e91524b491c4b \
                    size    534316

categories          devel
platforms           darwin freebsd
license             GPL-3+
maintainers         {ryandesign @ryandesign} openmaintainer

description         object-file caching compiler wrapper

long_description \
    ccache is a compiler cache.  It acts as a caching pre-processor to C/C++ \
    compilers, using the -E compiler switch and a hash to detect when a \
    compilation can be satisfied from cache.  This often results in a 5 to 10 \
    times speedup in common compilations.

homepage            https://ccache.dev
github.tarball_from releases
use_xz              yes

compiler.c_standard 1999

compiler.cxx_standard \
                    2020

depends_build-append \
                    port:doctest \
                    bin:perl:perl5 \
                    path:bin/pkg-config:pkgconfig

depends_lib-append  port:hiredis \
                    port:xxhashlib \
                    port:zstd

# Use bundled copies of these dependencies that aren't in MacPorts (or, in the
# case of fmt, aren't in the standard location).
configure.args-append \
                    -DDEP_BLAKE3=BUNDLED \
                    -DDEP_CPPHTTPLIB=BUNDLED \
                    -DDEP_FMT=BUNDLED \
                    -DDEP_NONSTDSPAN=BUNDLED \
                    -DDEP_TLEXPECTED=BUNDLED

# Do not download other required dependencies that couldn't be found.
configure.args-append \
                    -DDEPS=LOCAL

configure.args-append -DENABLE_DOCUMENTATION=OFF

variant doc description {Enable documentation} {
    configure.args-replace -DENABLE_DOCUMENTATION=OFF -DENABLE_DOCUMENTATION=ON
    depends_build-append \
                    port:asciidoctor
    license_noconflict  asciidoctor
}

default_variants    +doc

test.run            yes
