# -*- 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 4ab68bbd20618a663255625160c40875713f5485
github.tarball_from     archive
version                 20250428
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  b6ce31ca151c087ad25edaeffcedfd115b216b81 \
                        sha256  79384e6e24ce07bdfcbea8bcf63d4b26b2b3eb66d15579bd8973c639e919176e \
                        size    16237

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
