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

github.setup        camlp5 camlp5 8.05.02
github.tarball_from archive
revision            1
categories          lang ocaml
license             BSD
maintainers         {pmetzger @pmetzger} openmaintainer

description         Camlp5 is a preprocessor-pretty-printer of OCaml.
long_description    Camlp5 is a preprocessor and pretty-printer for \
        OCaml programs. It also provides parsing and printing tools. \
        As a preprocessor, it allows to: extend the syntax of OCaml, \
        redefine the whole syntax of the language. As a pretty printer, \
        it allows to: display OCaml programs in an elegant way, convert \
        from one syntax to another, check the results of syntax \
        extensions. Camlp5 also provides some parsing and pretty \
        printing tools: extensible grammars, extensible printers, \
        stream parsers and lexers pretty print module.  It works as a \
        shell command and can also be used in the OCaml toplevel.

homepage            https://camlp5.github.io/

checksums           rmd160  53af269ac6f8bdb7f001bfbc8acd8627035ece7b \
                    sha256  ceceb2377563f5483738090b614447536daa4cea119dc768a0659543727b4497 \
                    size    1506228

depends_build       bin:perl:perl5
depends_lib         port:ocaml \
    port:ocaml-bos \
    port:ocaml-camlp-streams \
    port:ocaml-camlp5-buildscripts \
    port:ocaml-findlib \
    port:ocaml-fmt \
    port:ocaml-pcre2 \
    port:ocaml-re \
    port:ocaml-rresult

configure.pre_args  --prefix "${prefix}"
configure.args      --mandir "${prefix}/share/man"

if {${build_arch} in [list i386 ppc ppc64]} {
    build.target    world
    } else {
    build.target    world.opt
}

use_parallel_build  no

# ocaml is not universal
universal_variant   no

post-destroot {
    # Install META file not installed by the Makefile, with directory field
    # so ocamlfind can locate the compiled modules in ${prefix}/lib/${name}
    xinstall -m 755 -d ${destroot}${prefix}/lib/ocaml/site-lib/${name}
    set meta_fd [open ${worksrcpath}/etc/META r]
    set meta_content [read $meta_fd]
    close $meta_fd
    set out_fd [open ${destroot}${prefix}/lib/ocaml/site-lib/${name}/META w]
    puts $out_fd "directory = \"${prefix}/lib/${name}\""
    puts -nonewline $out_fd $meta_content
    close $out_fd
}
