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

gitlab.setup        irill cudf 0.10 v

name                libCUDF
revision            0
categories          devel ocaml
maintainers         {cal @neverpanic} openmaintainer
license             LGPL-3+
homepage            https://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.

checksums           rmd160  144ed9a93a38fc298849c8b2110b6db645ad6c5f \
                    sha256  066ba83f4bac30ed3ca6ce345079900226c2065e4715732ecf8a3751dde7ecc8 \
                    size    47723

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.1

    ocaml.build_type    dune

    depends_lib-append  port:ocaml-extlib

    livecheck.type      none
}

subport libCUDF {
    patchfiles-append       patch-c-lib-Makefile.diff
    depends_build-append    path:bin/pkg-config: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
    destroot.pre_args       -C c-lib
    destroot.args           install

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