# -*- 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        crystal-lang shards 0.19.1 v

categories          devel
license             Apache-2
maintainers         {@conradwt gmail.com:conradwt} openmaintainer

description         Crystal application dependency manager

long_description    Shards is a dependency manager for the Crystal Programming Language.

depends_lib         port:crystal

depends_test        port:fossil \
                    port:mercurial

# Update with shard.lock, see Makefile.
set molinillo.version   0.2.0
set molinillo.distname  crystal-molinillo-${molinillo.version}

github.tarball_from archive
master_sites        ${master_sites}:main \
                    https://github.com/crystal-lang/crystal-molinillo/archive/v${molinillo.version}:molinillo

distfiles           ${distfiles}:main \
                    ${molinillo.distname}${extract.suffix}:molinillo

checksums           ${distname}${extract.suffix} \
                    rmd160  03c58972e12b1f2b1ab5c0a6ef10e309f57b0980 \
                    sha256  2a49e7ffa4025e0b3e8774620fa8dbc227d3d1e476211fefa2e8166dcabf82b5 \
                    size    83440 \
                    ${molinillo.distname}${extract.suffix} \
                    rmd160  6937976d1e249b1de948b8a88acc549b0f9f42ca \
                    sha256  e231cf2411a6a11a1538983c7fb52b19e650acc3338bd3cdf6fdb13d6463861a \
                    size    23959

pre-fetch {
    if {${os.major} < 16} {
        ui_error "${name} @${version} requires macOS 10.12 or newer."
        return -code error "incompatible macOS version"
    }
}

post-patch {
    xinstall -d ${worksrcpath}/lib
    move ${workpath}/${molinillo.distname} ${worksrcpath}/lib/molinillo
}

use_configure       no

build.args          release=1

destroot.args       PREFIX=${prefix}

test.run            yes
