# -*- 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        yhirose cpp-httplib 0.34.0 v
github.tarball_from archive
revision            0

categories          devel
license             MIT
maintainers         nomaintainer

description         C++11 single-file HTTP/HTTPS library

long_description    \
    ${name} is a C++11 single-file header-only cross platform HTTP/HTTPS \
    library.  This port also builds and installs the optional compiled \
    library variant.

checksums           rmd160  6963a38981f6163f14cbdb6fc1268facd0c34413 \
                    sha256  cb8e41c4b270f4fc520df71097089b71896c652927d61a94a11cd59689a0515b \
                    size    1415369

set py_ver          314
set py_branch       [string index ${py_ver} 0].[string range ${py_ver} 1 end]

depends_build-append \
                    port:python${py_ver}

cmake.build_type    Release

compiler.cxx_standard \
                    2011

configure.args-append \
                    -DBUILD_SHARED_LIBS=ON \
                    -DHTTPLIB_COMPILE=ON \
                    -DHTTPLIB_REQUIRE_BROTLI=OFF \
                    -DHTTPLIB_REQUIRE_OPENSSL=OFF \
                    -DHTTPLIB_REQUIRE_ZLIB=OFF \
                    -DHTTPLIB_USE_BROTLI_IF_AVAILABLE=OFF \
                    -DHTTPLIB_USE_OPENSSL_IF_AVAILABLE=OFF \
                    -DHTTPLIB_USE_ZLIB_IF_AVAILABLE=OFF \
                    -DHTTPLIB_USE_ZSTD_IF_AVAILABLE=OFF \
                    -DPython3_EXECUTABLE=${prefix}/bin/python${py_branch}

variant brotli description {Enable brotli support} {
    depends_lib-append \
                    port:brotli

    configure.args-replace \
                    -DHTTPLIB_REQUIRE_BROTLI=OFF -DHTTPLIB_REQUIRE_BROTLI=ON \
                    -DHTTPLIB_USE_BROTLI_IF_AVAILABLE=OFF -DHTTPLIB_USE_BROTLI_IF_AVAILABLE=ON
}

variant openssl description {Enable OpenSSL support} {
    PortGroup       openssl 1.0

    configure.args-replace \
                    -DHTTPLIB_REQUIRE_OPENSSL=OFF -DHTTPLIB_REQUIRE_OPENSSL=ON \
                    -DHTTPLIB_USE_OPENSSL_IF_AVAILABLE=OFF -DHTTPLIB_USE_OPENSSL_IF_AVAILABLE=ON
}

variant zlib description {Enable zlib support} {
    depends_lib-append \
                    port:zlib

    configure.args-replace \
                    -DHTTPLIB_REQUIRE_ZLIB=OFF -DHTTPLIB_REQUIRE_ZLIB=ON \
                    -DHTTPLIB_USE_ZLIB_IF_AVAILABLE=OFF -DHTTPLIB_USE_ZLIB_IF_AVAILABLE=ON
}

default_variants    +openssl +zlib

github.livecheck.regex  {([0-9.]+)}
