# -*- 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                pascal-p5
version             1.4
revision            0
categories          lang
platforms           darwin
license             GPL-2
maintainers         {@kamischi web.de:karl-michael.schindler} openmaintainer

description         P5, Zuerich type ISO 7185 Pascal compiler
long_description    This is the 5th version of the Pascal-P compiler from Zuerich. \
                    It is modified to be ISO 7185 Pascal compliant, both in \
                    the implementation language, and in the language it processes.
homepage            https://www.standardpascal.com/p5.html

fetch.type          git
git.url             https://git.code.sf.net/p/pascalp5/code
git.branch          75a0a8

depends_build       port:fpc

supported_archs     x86_64

installs_libs       no
use_configure       no
universal_variant   no

# patching the Makefile is more involved.
build {
    file mkdir ${worksrcpath}/build
    system  -W ${worksrcpath} " \
            fpc -Miso -ap -FEbuild source/pcom.pas && \
            fpc -Miso -ap -FEbuild source/pint.pas "
}

destroot {
    xinstall -m 755 -d                        ${destroot}${prefix}/bin/
    xinstall -m 755 ${worksrcpath}/build/pint ${destroot}${prefix}/bin/
    xinstall -m 755 ${worksrcpath}/build/pcom ${destroot}${prefix}/bin/
    xinstall -m 755 ${filespath}/p5           ${destroot}${prefix}/bin/
}

notes "\
p5 is a shell script, which calls the compiler pcom and the interpreter pint. \
The compiler pcom creates an intermediate file NAME.p5, which is run by \
the interpreter pint. \
"
