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

# <fnctl.h> for identifier 'AT_FDCWD', arc4random_buf, clock_gettime
legacysupport.newest_darwin_requires_legacy 15

name                lowdown
categories          textproc
version             3.0.1
revision            0
license             BSD

description         Simple Markdown translator
long_description    ${name} is a Markdown translator producing HTML5, \
                    roff documents in the ms and man formats, LaTeX, \
                    gemini ("gemtext"), OpenDocument and ANSI/UTF8 \
                    terminal output. The open source C source code \
                    has no dependencies.

homepage            https://kristaps.bsd.lv/lowdown
master_sites        ${homepage}/snapshots/
maintainers         {judaew @judaew} openmaintainer

checksums           rmd160  433b221d28fd092139131f02465803f257cd100f \
                    sha256  ac9ea2b51c8bd59350c7bf8db5e2067e9d961b1f48d362cd8a56b022850e965c \
                    size    378740

# https://trac.macports.org/ticket/71204
depends_build-append    port:bmake \
                        path:bin/gmktemp:coreutils

# lowdown.h:460: error: wrong number of arguments specified for ‘deprecated’ attribute
compiler.blacklist-append \
                        *gcc-4.* {clang < 400}

configure.env-append    PATH=${prefix}/libexec/gnubin:${prefix}/bin:${prefix}/sbin:/usr/bin:/usr/sbin:/bin:/sbin

configure.universal_args
configure.pre_args      PREFIX=${prefix}
configure.args-append   MANDIR=${prefix}/share/man

if {${os.platform} eq "darwin" && ${os.major} <= 14} {
    configure.args-append \
                        LINKER_SOFLAG=-dynamiclib \
                        LINKER_SONAME=-install_name \
                        LINKER_SOSUFFIX=dylib
}

build.cmd               ${prefix}/bin/bmake
build.args              LDFLAGS="${configure.ldflags}"

# The install target installs only binaries but does not install the library
# and pkg-config pc file.
destroot.target-append  install_lib_common install_shared
