# -*- 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.20260803.0
revision            0
categories          devel security 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  0592cb4995b1dcf54c725f352ba1fd796397042f \
                    sha256  585c91782fc0651ba6f2376b672acdc30437705d8a50b4967c20e6293e318969 \
                    size    74621138
github.tarball_from archive

cmake.out_of_source no

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

patch.pre_args-replace  -p0 -p1
# See discussion in https://github.com/lexiforest/curl-impersonate/pull/231
patchfiles-append   0001-Fix-big-endian.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
