# $Id$

PortSystem 1.0

name                ocamlduce
version             3.12.1.0
revision            4
categories          lang ml
maintainers         mww openmaintainer
license             {QPL LGPL}
description         Objective Caml extensions for manipulating XML
long_description    OCamlDuce is a merger between OCaml and CDuce. It \
                    comes as a modified version of OCaml which integrates \
                    CDuce features: expressions, types, patterns.
homepage            http://www.cduce.org/ocaml.html
platforms           darwin
master_sites        http://forge.ocamlcore.org/frs/download.php/644/:duce \
                    http://caml.inria.fr/pub/distrib/ocaml-3.12/:ocaml

distfiles           ${name}-${version}.tar.gz:duce ocaml-3.12.1.tar.bz2:ocaml
checksums           ocamlduce-3.12.1.0.tar.gz \
                    rmd160  33078e31c4cffade2f6d762fa9e9e4023f96fec4 \
                    sha256  3eda11591d9babf9f6fc25f257367cd36fffe3cc03a6b0105a2d49fc62aa91ab \
                    ocaml-3.12.1.tar.bz2 \
                    rmd160  61d38c0785491c8790ac02ab78fb2f26ea490fc1 \
                    sha256  edcf563da75e0b91f09765649caa98ab1535e0c7498f0737b5591b7de084958d
depends_lib         port:ocaml port:ocaml-findlib

use_parallel_build  no

extract.only        ${name}-${version}.tar.gz

patch {
    system -W ${worksrcpath} "make prepare OCAML_SOURCE=${distpath}/ocaml-3.12.1.tar.bz2"
}

# all options are identical to ones in the ocaml port
configure.dir       ${worksrcpath}/ocaml-3.12.1
configure.pre_args  -prefix ${prefix}
configure.args      -no-tk -cc ${configure.cc} -aspp \"${configure.cc} -c\"

build.dir           ${configure.dir}
build.target        world.opt
build.args          -f Makefile.ocamlduce
build.cmd           "unset LD_PREBIND LD_PREBIND_ALLOW_OVERLAP && ${build.cmd}"

destroot.dir        ${configure.dir}
destroot.args       -f Makefile.ocamlduce
destroot.target     installopt installbyte
destroot.destdir    BINDIR=${destroot}${prefix}/bin \
                    LIBDIR=${destroot}${prefix}/lib/ocaml \
                    MANDIR=${destroot}${prefix}/share/man

post-destroot {
    xinstall -m 755 -d ${destroot}${prefix}/lib/ocaml/site-lib
    system "cd ${destroot}${prefix}/lib/ocaml/site-lib && ln -s ../ocamlduce"
}

# ocaml is not universal
universal_variant   no