# -*- 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        hpjansson chafa 1.18.2
revision            2
categories          graphics
license             LGPL-3
maintainers         {gmail.com:herby.gillot @herbygillot} \
                    openmaintainer
platforms           darwin linux

description         Terminal graphics for the 21st century
long_description    {*}${description}. Chafa is a command-line utility that \
                    converts all kinds of images, including animated GIFs, \
                    into sixel or ANSI/Unicode character output that can be \
                    displayed in a terminal. It is highly configurable, with \
                    support for alpha transparency and multiple color modes \
                    and color spaces, combining selectable ranges of Unicode \
                    characters to produce the desired output.
homepage            https://hpjansson.org/chafa
use_xz              yes
checksums           rmd160  45606c254c8b6994a4649b4ec784d468e0b61c96 \
                    sha256  0b8d9ba9f347e8b6c0c71878217c9b0e478b4a42aa4babea0bf20840567239c2 \
                    size    1063448
github.tarball_from releases

depends_build-append \
                    port:gtk-doc \
                    bin:pkg-config:pkgconfig

depends_lib-append  path:lib/pkgconfig/cairo.pc:cairo \
                    path:lib/pkgconfig/freetype2.pc:freetype \
                    path:lib/pkgconfig/gdk-pixbuf-2.0.pc:gdk-pixbuf2 \
                    port:gettext-runtime \
                    path:lib/pkgconfig/glib-2.0.pc:glib2 \
                    port:ImageMagick \
                    port:libavif \
                    port:libheif \
                    path:include/turbojpeg.h:libjpeg-turbo \
                    port:libjxl \
                    path:lib/pkgconfig/librsvg-2.0.pc:librsvg \
                    port:tiff \
                    port:webp

platform darwin {
    # https://github.com/hpjansson/chafa/issues/344
    if {${os.major} < 17} {
        patchfiles-append \
                    patch-fix-CG-loader.diff
    }
    # So that we know if it gets broken again.
    configure.args-append \
                    --with-coregraphics
}

# smolscale.c:640:5: error: use of unknown
# builtin '__builtin_cpu_init'
# uses newer intrinsic functions
# https://trac.macports.org/ticket/66729
compiler.blacklist-append \
                    {*gcc-[3-4].*} {clang < 1001}

platform darwin 8 {
    configure.cflags-append -Wno-incompatible-pointer-types
}
