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

set realname        camlidl
set realversion     1.09
github.setup        xavierleroy ${realname} [join [split ${realversion} .] ""] ${realname}
# Change github.tarball_from to 'releases' or 'archive' next update
github.tarball_from tarball
name                ocaml-${realname}
version             ${realversion}
revision            0
categories          ocaml devel
license             {QPL LGPL}
maintainers         {takeshi @tenomoto} openmaintainer
description         stub code generator and COM binding for Objective Caml
long_description \
    CamlIDL comprises two parts: \
    * A stub code generator that generates the C stub code required for the Caml/C interface, \
      based on an MIDL specification. (MIDL stands for Microsoft's Interface Description Language \
      it looks like C header files with some extra annotations, plus a notion of object interfaces \
      that look like C++ classes without inheritance.) \
    * A (currently small) library of functions and tools to import COM components in Caml applications, \
      and export Caml code as COM components.

depends_build       port:ocaml

checksums           rmd160  d474837076b24527b4427a3cb6f68e680538cec9 \
                    sha256  f029fd926084b52f83f27ac9c2e7469a8c93c903d7c08a6a9b5c9e48eb1d62e3 \
                    size    125703

universal_variant   no

pre-build {
    file rename ${worksrcpath}/config/Makefile.unix ${worksrcpath}/config/Makefile
}

makefile.override-append CFLAGS

build.args          CPP=/usr/bin/cpp \
                    CAMLLIB=${prefix}/lib/ocaml \
                    OCAMLC="${prefix}/bin/ocamlc -g" \
                    OCAMLOPT=${prefix}/bin/ocamlopt \
                    OCAMLYACC="${prefix}/bin/ocamlyacc -v" \
                    OCAMLLEX=${prefix}/bin/ocamllex \
                    OCAMLDEP=${prefix}/bin/ocamldep

pre-destroot {
    xinstall -d -m 755 ${destroot}${prefix}/lib/ocaml
    xinstall -d -m 755 ${destroot}${prefix}/lib/ocaml/caml
    xinstall -d -m 755 ${destroot}${prefix}/lib/ocaml/stublibs
}

destroot.args       BINDIR=${destroot}${prefix}/bin \
                    CAMLLIB=${prefix}/lib/ocaml \
                    OCAMLLIB=${destroot}${prefix}/lib/ocaml
