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

github.setup        cartocss carto 1.3.1 v
github.tarball_from archive
revision            0

checksums           rmd160  6396be71a957adaee19ad7d8cff90652831b47bc \
                    sha256  61007bb25f1a895f21fc9bc3b9e487e4173b77aa47198880d2d4c61386613d06 \
                    size    235277

categories          gis
platforms           any
supported_archs     noarch
maintainers         {@frankdean fdsd.co.uk:frank.dean} openmaintainer

license             Apache-2 BSD ISC MIT PSF \
                    public-domain {AFL-2.1 BSD} {BSD MIT} {WTFPL MIT}

description         Fast CSS-like map stylesheets

long_description    CartoCSS (short: Carto) is a language for map \
                    design. It is similar in syntax to CSS, but builds \
                    upon it with specific abilities to filter map data \
                    and by providing things like variables. It targets \
                    the Mapnik renderer and is able to generate Mapnik \
                    XML and a JSON variant of Mapnik XML.

# Note: Version of nodejs must be the same as defined for npm Portfile
depends_lib-append  path:bin/node:nodejs24

depends_build-append \
                    path:bin/npm:npm11

patchfiles          bin-carto.diff \
                    eslintrc-yml.diff \
                    lib-carto-mml-js.diff \
                    package-json.diff \
                    package-lock-json.diff \
                    test-eclint-test-js.diff

use_configure       no

test.run yes
test.cmd            "npm"

build               {}

destroot {
    xinstall -m 755 -d "${destroot}${prefix}/lib/node_modules"
    file copy "${worksrcpath}" "${destroot}${prefix}/lib/node_modules/${name}"
    system -W "${destroot}${prefix}/lib/node_modules/${name}" "npm install --production"
    ln -s ${prefix}/lib/node_modules/${name}/bin/${name} ${destroot}${prefix}/bin/${name}
}
