# -*- 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           openssl 1.0

github.setup        awslabs aws-sdk-cpp 1.11.716
revision            0
categories          devel
license             Apache-2
maintainers         {@barracuda156 macos-powerpc.org:barracuda} openmaintainer
description         C++ interface for Amazon Web Services (AWS)
long_description    {*}${description}
checksums           rmd160  553b674efad45b5c0a8899a92b2bc948b84b6944 \
                    sha256  c2d8e1504fdc4f8ca10dafff5bd631a0abc20b0844094dc37be906698558ec56 \
                    size    80433457
github.tarball_from archive

set py_ver          3.13
set py_ver_nodot    [string map {. {}} ${py_ver}]

depends_build-append \
                    path:bin/pkg-config:pkgconfig \
                    port:python${py_ver_nodot}

depends_lib-append  port:aws-crt-cpp \
                    port:curl \
                    port:zlib

compiler.cxx_standard   2011

configure.python        ${prefix}/bin/python${py_ver}

configure.args-append \
                    -DAUTORUN_UNIT_TESTS=OFF \
                    -DAWS_SDK_WARNINGS_ARE_ERRORS=OFF \
                    -DBUILD_DEPS=OFF \
                    -DBUILD_OPTEL=OFF \
                    -DBUILD_PERFORMANCE_TESTS=OFF \
                    -DBUILD_SHARED_LIBS=ON \
                    -DCUSTOM_MEMORY_MANAGEMENT=OFF \
                    -DENABLE_ADDRESS_SANITIZER=OFF \
                    -DENABLE_CURL_CLIENT=ON \
                    -DENABLE_OPENSSL_ENCRYPTION=ON \
                    -DENABLE_TESTING=OFF \
                    -DENABLE_ZLIB_REQUEST_COMPRESSION=ON \
                    -DFORCE_CURL=ON \
                    -DHAVE_PULSE=OFF \
                    -DPYTHON_CMD=${configure.python} \
                    -DPYTHON3_CMD=${configure.python}

# https://github.com/aws/aws-sdk-cpp/issues/3546
if {[string match *gcc* ${configure.compiler}] && ${configure.build_arch} in [list arm i386 ppc]} {
    configure.ldflags-append \
                    -latomic
}
