# -*- 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
# $Id: Portfile 115574 2014-01-05 19:58:38Z jeremyhu@macports.org $

PortSystem          1.0

name                makeicns
version             1.4.10a
revision            2
categories          graphics
maintainers         mk pixilla
platforms           darwin
license             MIT

description         This program lets you convert all kinds of images to Apple icns format on the command line.
long_description    ${description}

homepage            https://bitbucket.org/mkae/makeicns
master_sites        ${homepage}/downloads

use_bzip2           yes

worksrcdir          ${name}

checksums           md5     29613f4774d4dc2871a0052826abe1ae \
                    sha1    2a3b1229781516c8cc36089bf09729d5c17ac17c \
                    rmd160  8bf438b375dbc3d84a7dc47cef39c5c290a4c2ed

use_configure       no

variant universal {
}

platform darwin 13 {
    patchfiles      patch-IconFamily.m.diff
}

# TODO: Check ${configure.cxx_stdlib} directly once MacPorts 2.3 is released
platform darwin {
    set cxxstdlib {}

    if {[info exists configure.cxx_stdlib] &&
        ${configure.cxx_stdlib} ne {} &&
        [string match *clang* ${configure.cxx}]} {
        set cxxstdlib ${configure.cxx_stdlib}
    } elseif {[string match *clang* ${configure.cxx}] &&
              ${os.major} >= 13} {
        set cxxstdlib libc++
    } else {
        set cxxstdlib libstdc++
    }

    if {[string match *clang* ${configure.cxx}]} {
        configure.cxxflags-append -stdlib=${cxxstdlib}
        configure.ldflags-append -stdlib=${cxxstdlib}
    }
}

build.env-append    CC=${configure.cc} \
                    CXX=${configure.cxx} \
                    CFLAGS="${configure.cflags} [get_canonical_archflags cc]" \
                    CXXFLAGS="${configure.cxxflags} [get_canonical_archflags cxx]" \
                    LDFLAGS="[join ${configure.ldflags}] [get_canonical_archflags ld]"

if {${configure.sdkroot} != ""} {
    build.env-append SDK=${configure.sdkroot}
}

destroot {
    xinstall ${worksrcpath}/${name} ${destroot}${prefix}/bin/${name}
}

livecheck.type      regex
livecheck.url       [lindex ${master_sites} 0]
livecheck.regex     "(?!${name}).*${name}-((?!${extract.suffix}).*)${extract.suffix}"
