# -*- 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           github 1.0
PortGroup           muniversal 1.0

github.setup        paul-j-lucas cdecl 14.2 cdecl-
# Change github.tarball_from to 'releases' or 'archive' next update
github.tarball_from tarball
revision            0
categories          devel
license             GPL-3
maintainers         lucasmail.org:paul openmaintainer

description         Composing and deciphering C (or C++) type declarations \
                    or casts.
long_description    cdecl (see-deh-kull) is a program for composing \
                    and deciphering C (or C++) type declarations or casts, \
                    a.k.a. \"gibberish.\" It can be used interactively on a \
                    terminal or accept input from either the command line \
                    or standard input.

checksums           rmd160  bb0a06f1d7b620e00b20dd502878de334d5d0b9e \
                    sha256  eacb3bbf3f3ea1ec44a7169ae656cd7988a3e75ccf28739440753e1bd5e2a84a \
                    size    831992

# Reduce the noise from warnings, particularly those related to sign conversion
patchfiles-append   patch-configure.ac-disable-warnings.diff

depends_build-append \
                    port:autoconf \
                    port:automake

depends_lib-append \
                    port:ncurses \
                    port:readline

compiler.c_standard 2011

# lexer.l:437:7: error: expected expression
#       FALLTHROUGH;
# ../lib/attribute.h:165:21: note: expanded from macro 'FALLTHROUGH'
# #define FALLTHROUGH _GL_ATTRIBUTE_FALLTHROUGH
# ./config.h:1158:37: note: expanded from macro '_GL_ATTRIBUTE_FALLTHROUGH'
# #define _GL_ATTRIBUTE_FALLTHROUGH __attribute__ ((__fallthrough__))
compiler.blacklist-append {clang < 700}

# gcc-4.2 fails to build it
compiler.blacklist-append *gcc-4*

platform darwin {
    if { ${os.major} == 10 && ${configure.build_arch} eq "ppc" } {
        # Without this Rosetta uses clang, and the build fails.
        # This is only needed for Rosetta, not 10.6 PPC, but it won’t hurt.
        compiler.blacklist-append *clang*
        configure.pre_args  --build=powerpc-apple-darwin10
    }
}

if { [string match *clang* ${configure.compiler}] } {
    configure.cflags-append \
                    -Wno-implicit-int-conversion \
                    -Wno-unknown-pragmas \
                    -Wno-unknown-warning-option \
                    -Wno-error=unknown-warning-option
}

use_autoreconf      yes
autoreconf.args     -fvi

test.run            yes
test.target         check
test.env-append     TERM=xterm
