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

# FIXME: for some reason, it does not run on powerpc at the moment.
github.setup            FedericoBruzzone caml-writer 7b97b8ebcfc93d8806186f8abaec551d35a8347b
version                 20240813
revision                3
categories              editors ocaml
maintainers             {@barracuda156 macos-powerpc.org:barracuda} openmaintainer
license                 AGPL-3
description             CamlWriter is a terminal-based text editor
long_description        {*}${description}, developed using the OCaML.
checksums               rmd160  6b9d4f0a6d667240f25bbbb5eb4fa947616ddc2b \
                        sha256  e0c856948f812d1d28f83fc74b45ff4b7510b20f49c6ae62625f991a5f106944 \
                        size    25856
github.tarball_from     archive

patchfiles              patch-Makefile.diff

use_configure           no

depends_build-append    port:ocaml-dune

# Using Dune directly fails. And Makefile has no install target.
# https://github.com/FedericoBruzzone/caml-writer/issues/1
# ocaml.build_type        dune
# dune.packages           camlwriter
# dune.build.target       @all

# FIXME: this handles destroot in an ugly way, possibly incorrect, but the executable works.
destroot {
    copy ${worksrcpath}/_build/install/default/doc ${destroot}${prefix}/share/doc/${name}
    xinstall -m 755 ${worksrcpath}/_build/default/bin/main.exe ${destroot}${prefix}/bin/camlwriter
}
