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

github.setup        xavierleroy camlidl 113 camlidl
github.tarball_from archive
name                ocaml-camlidl
version             1.13
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  bcf39747396f4afcfbd90c5b0b5013295458f7da \
                    sha256  c82bfd106208ebedd8c264300e939010f87eed83e6f6339e3a6cf8f66caeed54 \
                    size    183353

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
}

# 1.13 added $(DESTDIR) support to runtime and lib install targets;
# pass OCAMLLIB without ${destroot} prefix so DESTDIR applies correctly.
destroot.args       BINDIR=${destroot}${prefix}/bin \
                    CAMLLIB=${prefix}/lib/ocaml \
                    OCAMLLIB=${prefix}/lib/ocaml
