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

name                    pcc
version                 1.1.0
categories              lang
platforms               darwin
maintainers             nomaintainer
license                 BSD
description             the portable C compiler
long_description        \
    This compiler is based on the original Portable C Compiler by S. C. \
    Johnson, written in the late 70's. Even though much of the compiler \
    has been rewritten, some of the basics still remain. \
    The intention is to write a C99 compiler while still keeping it small, \
    simple, fast and understandable.

homepage                http://pcc.ludd.ltu.se/
master_sites            http://pcc.ludd.ltu.se/ftp/pub/pcc-releases/
distname                ${subport}-${version}
extract.suffix          .tgz
use_parallel_build      no
universal_variant       no

if {${subport} eq ${name}} {
    checksums           rmd160  be1a8ea9b7bc231f47e75f351db9769e8fad2a58 \
                        sha256  d9e3fed84c767dcddefb6b1f854d5da8921f3f65d8bd02997743412f41474d64 \
                        size    848427

    depends_build       port:flex port:m4 port:bison
    depends_run         port:pcc-libs

    # fix typo
    # avoid
    #    error: subscripted value is neither array nor pointer nor vector
    # certain file names are defined as empty in os/darwin/ccconfig.h
    patchfiles-append   patch-typo.diff \
                        patch-string.diff \
                        patch-no_empty.diff
    configure.env       "YACC=${prefix}/bin/bison -y"
}

configure.args-append --host=${build_arch}-apple-${os.platform}${os.major}.0.0

subport pcc-libs {
    checksums           rmd160  049c0a083ed46e3f22990c07bfcee4eac6daf660 \
                        sha256  dd4cb124da0b2edcda6ceb823c3ca8fc05919d35c89c34dec617517afe6bbfee \
                        size    198204

    supported_archs     ppc i386

    configure.cc-append [get_canonical_archflags cc]
}
