# -*- 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-c-auth 0.10.5 v
revision            0
categories          security net
license             Apache-2
maintainers         {@barracuda156 macos-powerpc.org:barracuda} openmaintainer
description         C99 library implementation of AWS client-side authentication
long_description    {*}${description}
checksums           rmd160  b1828751cf2a342fa671c3a97bf0b4f130e78e55 \
                    sha256  1ddd1dc476debdbf9ff083e254396fdc3ea0846dccf7d5f983a6571303abcb35 \
                    size    289569
github.tarball_from archive

depends_lib-append  port:aws-c-cal \
                    port:aws-c-common \
                    port:aws-c-compression \
                    port:aws-c-http \
                    port:aws-c-io \
                    port:aws-c-sdkutils \
                    port:s2n-tls

depends_run-append  port:curl-ca-bundle

compiler.c_standard 1999
# ___builtin_add_overflow, ___builtin_mul_overflow
compiler.blacklist-append \
                    *gcc-4.* {clang < 421}

configure.args-append \
                    -DBUILD_SHARED_LIBS=ON \
                    -DBUILD_TESTING=ON

# For tests:
configure.pre_args-replace \
                    -DCMAKE_BUILD_WITH_INSTALL_RPATH:BOOL=ON \
                    -DCMAKE_BUILD_WITH_INSTALL_RPATH:BOOL=OFF

# FIXME: many tests fail: 71% tests passed, 85 tests failed out of 293.
# Apparently env variable for ca-certs is not honored.
test.env-append     AWS_CA_BUNDLE=${prefix}/share/curl/curl-ca-bundle.crt
test.run            yes
