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

PortSystem          1.0

name                libCUDF
version             0.7
revision            1
categories          devel ml
platforms           darwin
maintainers         gwmail.gwu.edu:egall cal openmaintainer
license             LGPL-3+
homepage            http://www.mancoosi.org/cudf/

description         ${name} is a library to manipulate so called CUDF documents.

long_description    ${description} A CUDF \
                    (Common Upgradeability Description Format) document describes an \
                    \"upgrade scenario\", as faced by package managers in popular \
                    package-based FOSS (Free and Open Source Software) distributions.

master_sites        https://gforge.inria.fr/frs/download.php/33593/

checksums           rmd160  dd9c5097a627856e0e74fe3052c2f5ee1fd1bec5 \
                    sha256  92c8a9ed730bbac73f3513abab41127d966c9b9202ab2aaffcd02358c030a701

worksrcdir          cudf-${version}

use_configure       no

# parallel building fails
use_parallel_build  no

build.env-append    CC=${configure.cc}\
                    CFLAGS=\"${configure.cflags} [get_canonical_archflags cc]\" \
                    LDFLAGS=\"${configure.ldflags} [get_canonical_archflags ld]\" \

post-patch {
    reinplace "s#/usr/#${prefix}/#g" ${worksrcpath}/Makefile.config
}

subport ocaml-cudf {
    PortGroup           ocaml 1.0

    depends_lib-append  port:camlp5 \
                        port:ocaml-findlib \
                        port:ocaml-extlib

    build.target-append opt

    test.target         test
    test.run            yes

    pre-test {
        if {[catch {registry_active ocaml-ounit}]} {
            ui_error "Testing requires ocaml-ounit, but it isn't installed."
            ui_error "Please install the ocaml-ounit port and try again."
            error "missing dependency"
        }
    }

    livecheck.type      none
}

subport libCUDF {
    depends_build-append    port:pkgconfig
    depends_lib-append      port:ocaml-cudf \
                            path:lib/pkgconfig/glib-2.0.pc:glib2
    build.pre_args          -C c-lib
    build.args              all opt

    post-destroot {
        file delete -force ${destroot}${prefix}/lib/ocaml
    }

    test.pre_args   -C c-lib
    test.args       test
    test.run        yes
}

livecheck.type      regex
livecheck.url       https://gforge.inria.fr/export/rss20_newreleases.php?group_id=4385
livecheck.regex     "cudf (\\d+(?:\\.\\d+)*)"