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

# getentropy
legacysupport.newest_darwin_requires_legacy 10

github.setup        google boringssl 0.20251002.0
revision            0
categories          security devel crypto
license             Apache-2
maintainers         {@barracuda156 macos-powerpc.org:barracuda}

description         Fork of OpenSSL
long_description    {*}${description}
homepage            https://boringssl.googlesource.com/boringssl
checksums           rmd160  d6f48a8edcfb213cde5ac7d494ec610b77f59762 \
                    sha256  f96733fc3df03d4195db656d1b7b8c174c33f95d052f811f0ecc8f4e4e3db332 \
                    size    47389161
github.tarball_from archive

cmake.out_of_source no

# Install in a dedicated subprefix:
cmake.install_prefix \
                    ${prefix}/libexec/${name}

patchfiles-append   0001-target.h-unbreak-arch-detection.patch \
                    0002-Define-__STDC_FORMAT_MACROS-for-PRIu64-and-friends.patch

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

configure.perl      ${prefix}/bin/perl5

configure.args-append \
                    -DBUILD_SHARED_LIBS=1 \
                    -DOPENSSL_NO_ASM=1

# It uses a really ridiculous way to detect macOS, which fails,
# and the build tries to compile iOS sources instead -_-
configure.cppflags-append \
                    -DTARGET_OS_OSX=1

# pki/path_builder.cc:253:1: error: 'bssl::{anonymous}::CertIssuersIter::CertIssuersIter(std::shared_ptr<const bssl::ParsedCertificate>,
# bssl::{anonymous}::CertIssuerSources*, bssl::TrustStore*)' defined but not used [-Werror=unused-function]
configure.cxxflags-append \
                    -Wno-error=unused-function

compiler.c_standard     2011
compiler.cxx_standard   2017
