# -*- coding: utf-8; mode: tcl; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- vim:fenc=utf-8:ft=tcl:et:sw=2:ts=2:sts=2

PortSystem              1.0
PortGroup               github 1.0
PortGroup               makefile 1.0

github.setup            phoboslab qoi f65b365318df43cd0d7de8b51473dabcbefc04a6
# Change github.tarball_from to 'releases' or 'archive' next update
github.tarball_from     tarball
version                 20230616
revision                0

categories              graphics
license                 MIT
maintainers             nomaintainer

description             The “Quite OK Image Format” for fast, lossless image \
                        compression.
long_description        {*}${description} It losslessly compresses images to a similar \
                        size of PNG, while offering 20x-50x faster encoding and \
                        3x-4x faster decoding. The reference en-/decoder fits \
                        in about 300 lines of C.

homepage                https://qoiformat.org/

checksums               rmd160  d6680209b5de616e31b54afe6ada147dcc4cb007 \
                        sha256  25d1aac8c16e44051988c9f9e7078c27261d9d7ceea6af9ad01b0fa33631f90e \
                        size    15511

depends_build           port:libpng \
                        port:stb

patchfiles              patch-makefile.diff

post-patch {
    reinplace "s|@PREFIX@|${prefix}|g" ${worksrcpath}/Makefile
}

build.target            all

destroot {
    set doc_dir ${destroot}${prefix}/share/doc/${name}

    xinstall -d -m 0755 ${doc_dir}
    xinstall -m 0644 -W ${worksrcpath} LICENSE README.md ${doc_dir}
    xinstall -m 0644 {*}[glob ${worksrcpath}/*.h] ${destroot}${prefix}/include/
    xinstall -m 0755 -W ${worksrcpath} qoibench qoiconv ${destroot}${prefix}/bin/
}

livecheck.type          none