# -*- 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 18.5 cdecl-
github.tarball_from archive
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  af8eac3041a8541d0903b6b9c323a38349b0fa8d \
                    sha256  1cbe1352cc36b7eecabee1bf7434c66765116bb185df492b97677b928005a722 \
                    size    1062065

depends_build-append \
                    port:autoconf \
                    port:automake \
                    port:bison \
                    port:flex

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
