# -*- 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           muniversal 1.0
PortGroup           github 1.0

github.setup        mozilla mozjpeg 3.3.1 v
# Change github.tarball_from to 'releases' or 'archive' next update
github.tarball_from tarball
conflicts           libjpeg-turbo
categories          graphics
supported_archs     i386 x86_64
license             BSD
maintainers         nomaintainer

description         A fork of libjpeg-turbo by Mozilla with 'jpgcrush' feature
long_description \
    mozjpeg is a fork of libjpeg-turbo with jpgcrush functionality to reduce \
    the size of JPEG images. The 'jpgcrush' feature finds the progressive \
    coding configuration which uses the fewest bits. This most frequently \
    reduces file size by 2-10%, but those are not hard limits. Significantly \
    greater reductions have been observed.

checksums           rmd160  3b275b5241375452d8e7135345ec008217db34aa \
                    sha256  74ed16b5b42a94b85120f3f0b17acc2581a51d4a0d9be9a214554ab913f94140 \
                    size    1251324

depends_build       port:pkgconfig \
                    port:nasm

use_autoreconf          yes
autoreconf.args-append  --force

configure.args      --disable-silent-rules \
                    --with-jpeg8 \
                    NASM=${prefix}/bin/nasm

array set merger_host {
    x86_64  x86_64-apple-darwin
    i386    i686-apple-darwin
}
if {(!${universal_possible} || ![variant_isset universal])
        && [info exists merger_host(${configure.build_arch})]} {
    configure.args-append --host=$merger_host(${configure.build_arch})
}

test.run            yes

destroot.args       docdir='${prefix}/share/doc/${name}' \
                    exampledir='${prefix}/share/doc/${name}'

github.livecheck.regex  {(([^"](?!-pre))+)}
