# -*- 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        thorfdbg libjpeg 25f71280913fde7400801772bbf885bb3e873242
# https://github.com/macports/macports-ports/pull/28116#issuecomment-2847585194
name                jpeg-xt
# https://github.com/thorfdbg/libjpeg/blob/master/README
version             1.71
revision            0
categories          graphics
license             GPL-3
maintainers         nomaintainer

description         Complete implementation of 10918-1 (JPEG) from jpeg.org

long_description    A complete implementation of 10918-1 (JPEG) coming \
                    from jpeg.org (the ISO group) with extensions for \
                    HDR standardized as 18477 (JPEG XT).

checksums           rmd160  4ff5a09bf6a3f4689ec618efc07b32fdfbbe82f0 \
                    sha256  2625a50fbf4751bb145b4704a55de3da77a946d589455acedbab41ddebb19d3a \
                    size    565066

post-patch {
    reinplace {s|-Wno-shift-negative-value||} \
        ${worksrcpath}/Makefile_Settings.gcc
}

use_autoreconf      yes
# https://trac.macports.org/wiki/WimplicitFunctionDeclaration#strchr
configure.checks.implicit_function_declaration.whitelist-append strchr
configure.args-append   --verbose

build.target        doc final

destroot.destdir    INSTALLDIR=${destroot}${prefix}/bin

if {[string match *clang* ${configure.cc}]} {
    build.target-append \
                    SETTINGS=clang
    destroot.post_args-append \
                    SETTINGS=clang
} elseif {[string match *gcc* ${configure.cc}]} {
    build.target-append \
                    SETTINGS=gcc
    destroot.post_args-append \
                    SETTINGS=gcc
}

post-destroot {
    move            ${destroot}${prefix}/bin/jpeg \
                    ${destroot}${prefix}/bin/jpeg-xt
}
