# -*- 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

name                libicns
version             0.8.1
revision            5
categories          graphics devel
# lib is LGPL, executables are GPL
license             {LGPL-2.1+ GPL-2+}
maintainers         {gmail.com:dardo82 @dardo82} openmaintainer

description         libicns is a library for manipulation of the Mac OS icns resource format and includes the icns2png converter
long_description \
    libicns is a library for manipulation of the Mac OS icns resource format, also known \
    as the IconFamily resource type. It can read and write files from the Mac OS X icns \
    format, as well as read from Mac OS resource files and macbinary encoded Mac OS \
    resource forks. As of release 0.5.9, it can fully read and write any 128x128 and all \
    smaller 32-bit icons, and read support for 8-bit, 4-bit, and 1-bit icons. If linked \
    against (a patched version of) Jasper, it also has full support for 256x256 and 512x512 \
    32-bit icons with masks as alpha channels. libicns includes icns2png, a tool for extracting \
    the images contained within icns files, and saving them as png images. It also includes \
    png2icns, a tool for creating icns files from a set of png images. \
    Furthermore, release 0.8.1 implements 1024x1024 support.

homepage            http://icns.sourceforge.net/
master_sites        sourceforge:icns

checksums           rmd160  e9609c97e76f54a16e1de0f79008fc74705b1aa6 \
                    sha256  335f10782fc79855cf02beac4926c4bf9f800a742445afbbf7729dab384555c2 \
                    size    460819

depends_lib         port:zlib port:libpng port:jasper path:include/turbojpeg.h:libjpeg-turbo

post-extract {
    # Convert DOS to UNIX line endings so we can patch
    # https://sourceforge.net/p/icns/code/ci/d20e6e5ce225f6095bbd70fac7e9e5b42972323a/
    reinplace "s|\r||g" ${worksrcpath}/icnsutils/png2icns.c
}

patchfiles          implicit.patch

livecheck.regex     ${name}-(\[0-9.\]+)${extract.suffix}