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

name                libdevil
conflicts           ResIL
version             1.8.0
revision            5
checksums           rmd160  411efa9982a1dfd9075536a80c1eb3d8c2ed15e8 \
                    sha256  0075973ee7dd89f0507873e2580ac78336452d29d34a07134b208f44e2feb709 \
                    size    3084833

categories          devel multimedia
license             LGPL-2.1
maintainers         {ryandesign @ryandesign} openmaintainer

description         Library to develop applications with powerful image \
                    loading capabilities

long_description    Developer's Image Library (DevIL) is a programmer's \
                    library to develop applications with very powerful image \
                    loading capabilities, yet is easy for a developer to \
                    learn and use. Ultimate control of images is left to the \
                    developer, so unnecessary conversions, etc. are not \
                    performed. DevIL utilizes a simple, yet powerful, \
                    syntax. DevIL can load, save, convert, manipulate, \
                    filter and display a wide variety of image formats. \
                    Formerly known as OpenIL, but the name was changed due \
                    to SGI's request.

homepage            https://openil.sourceforge.net
master_sites        sourceforge:project/openil/DevIL/${version}
distname            DevIL-${version}
worksrcdir          DevIL/DevIL

depends_lib         port:jasper \
                    path:include/turbojpeg.h:libjpeg-turbo \
                    port:lcms2 \
                    port:libmng \
                    port:libpng \
                    port:openexr2 \
                    port:squish \
                    port:tiff \
                    port:zlib \

patchfiles          case.patch \
                    endian.patch \
                    jasper.patch \
                    jpeg-boolean.patch \
                    igetfitshead.patch \
                    ivec_align_buffer.patch \
                    miplengths.patch

configure.env       OPENEXR_DIR=${prefix}/libexec/openexr2
# OpenExr requires C++11
compiler.cxx_standard 2011
configure.cxxflags-append -std=gnu++11

# I don't know what the deal is with plural vs. singular cmake flags.
configure.args-append \
                    -DJASPER_INCLUDE_DIR=${prefix}/include \
                    -DJASPER_INCLUDE_DIRS=${prefix}/include \
                    -DJASPER_LIBRARIES=${prefix}/lib/libjasper.dylib \
                    -DJASPER_LIBRARY=${prefix}/lib/libjasper.dylib \
                    -DJPEG_INCLUDE_DIR=${prefix}/include \
                    -DJPEG_INCLUDE_DIRS=${prefix}/include \
                    -DJPEG_LIBRARIES=${prefix}/lib/libjpeg.dylib \
                    -DJPEG_LIBRARY=${prefix}/lib/libjpeg.dylib \
                    -DLCMS2_INCLUDE_DIR=${prefix}/include \
                    -DLCMS2_INCLUDE_DIRS=${prefix}/include \
                    -DLCMS2_LIBRARIES=${prefix}/lib/liblcms2.dylib \
                    -DLCMS2_LIBRARY=${prefix}/lib/liblcms2.dylib \
                    -DLIBSQUISH_INCLUDE_DIR=${prefix}/include \
                    -DLIBSQUISH_INCLUDE_DIRS=${prefix}/include \
                    -DLIBSQUISH_LIBRARIES=${prefix}/lib/libsquish.dylib \
                    -DLIBSQUISH_LIBRARY=${prefix}/lib/libsquish.dylib \
                    -DMNG_INCLUDE_DIR=${prefix}/include \
                    -DMNG_INCLUDE_DIRS=${prefix}/include \
                    -DMNG_LIBRARIES=${prefix}/lib/libmng.dylib \
                    -DMNG_LIBRARY=${prefix}/lib/libmng.dylib \
                    -DOPENEXR_Half_LIBRARY=${prefix}/libexec/openexr2/lib/libHalf.dylib \
                    -DOPENEXR_Half_LIBRARIES=${prefix}/libexec/openexr2/lib/libHalf.dylib \
                    -DOPENEXR_INCLUDE_DIR=${prefix}/libexec/openexr2/include/OpenEXR \
                    -DOPENEXR_INCLUDE_DIRS=${prefix}/libexec/openexr2/include/OpenEXR \
                    -DOPENEXR_Iex_LIBRARY=${prefix}/libexec/openexr2/lib/libIex.dylib \
                    -DOPENEXR_Iex_LIBRARIES=${prefix}/libexec/openexr2/lib/libIex.dylib \
                    -DOPENEXR_IlmImf_LIBRARY=${prefix}/libexec/openexr2/lib/libIlmImf.dylib \
                    -DOPENEXR_IlmImf_LIBRARIES=${prefix}/libexec/openexr2/lib/libIlmImf.dylib \
                    -DOPENEXR_IlmThread_LIBRARIES=${prefix}/libexec/openexr2/lib/libIlmThread.dylib \
                    -DOPENEXR_IlmThread_LIBRARY=${prefix}/libexec/openexr2/lib/libIlmThread.dylib \
                    -DPNG_INCLUDE_DIR=${prefix}/include \
                    -DPNG_INCLUDE_DIRS=${prefix}/include \
                    -DPNG_LIBRARIES=${prefix}/lib/libpng.dylib \
                    -DPNG_LIBRARY=${prefix}/lib/libpng.dylib \
                    -DTIFF_INCLUDE_DIR=${prefix}/include \
                    -DTIFF_INCLUDE_DIRS=${prefix}/include \
                    -DTIFF_LIBRARIES=${prefix}/lib/libtiff.dylib \
                    -DTIFF_LIBRARY=${prefix}/lib/libtiff.dylib \
                    -DZLIB_INCLUDE_DIR=${prefix}/include \
                    -DZLIB_INCLUDE_DIRS=${prefix}/include \
                    -DZLIB_LIBRARIES=${prefix}/lib/libz.dylib \
                    -DZLIB_LIBRARY=${prefix}/lib/libz.dylib

post-destroot {
    xinstall -m 0755 -d ${destroot}${prefix}/share/doc/${name}
    xinstall -m 0644 -W ${worksrcpath} AUTHORS COPYING CREDITS ChangeLog \
        NEWS README.md TODO ${destroot}${prefix}/share/doc/${name}
}

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