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

# clock_gettime
legacysupport.newest_darwin_requires_legacy 15

github.setup    pantoniou libfyaml 0.9.6 v
revision        0
maintainers     nomaintainer
categories      devel
license         MIT

description     High-performance YAML parser and emitter library
long_description \
                Fully feature complete YAML parser and emitter, \
                supporting the latest YAML spec and \
                passing the full YAML testsuite.

checksums       rmd160  eb916191b89856a26286d5395ced0649fc3e716e \
                sha256  a59cc3331e2eb903ec36933ad52a45888041cac31e44f553a00511131242c483 \
                size    1146628

patchfiles      fy_skip_size32.patch

# https://github.com/macos-powerpc/powerpc-ports/issues/178
if {${os.platform} eq "darwin" && ${os.major} < 10} {
    patchfiles-append \
                0001-fy-thread-fix-macOS-10.6.patch
}

configure.args-append \
                -DBUILD_TESTING=OFF

if { ${configure.build_arch} eq "i386" } {
    configure.args-append -DENABLE_PORTABLE_TARGET=ON
}

# __c11_atomic_load from Apple Clang 9.1.0 and earlier rejects const pointers
compiler.c_standard 2017

if {[string match macports-gcc* ${configure.compiler}]} {
    # https://github.com/pantoniou/libfyaml/issues/285
    configure.cflags-append \
                -Wno-error=incompatible-pointer-types

    # https://github.com/pantoniou/libfyaml/issues/286
    if {${configure.build_arch} in [list arm i386 ppc]} {
        configure.ldflags-append \
                -latomic
    }
}

# only allow numbers, to avoid pre-release versions
github.livecheck.regex          {([0-9.]+)}
