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

github.setup        Exiv2 exiv2 0.28.9 v
revision            0
checksums           rmd160  f094b691f3af1759467fc10de8c9db20f76edcff \
                    sha256  700b76b97695b2fab4ef8c79619c68ae57d09e0c130724791cafbd39e0eb4aef \
                    size    47189810

categories          graphics
license             GPL-2+
maintainers         {ryandesign @ryandesign} openmaintainer

description         EXIF and IPTC metadata manipulation library and tools
long_description    Exiv2 comprises of a C++ library and a command line utility \
                    which allows you to manipulate EXIF and IPTC image metadata.

homepage            https://www.exiv2.org
github.tarball_from archive

set python_version  3.14

depends_build-append \
                    port:gmake \
                    port:python[string map {. {}} ${python_version}]

depends_lib-append  port:brotli \
                    port:expat \
                    port:inih \
                    port:libiconv \
                    port:zlib

compiler.cxx_standard 2017
# std::filesystem needs macOS 10.15
legacysupport.newest_darwin_requires_legacy 18
legacysupport.use_mp_libcxx yes

configure.args-append \
                    -DBUILD_WITH_STACK_PROTECTOR=ON \
                    -DEXIV2_BUILD_SAMPLES=ON \
                    -DEXIV2_ENABLE_BMFF=ON \
                    -DEXIV2_ENABLE_BROTLI=ON \
                    -DEXIV2_ENABLE_FILESYSTEM_ACCESS=ON \
                    -DEXIV2_ENABLE_INIH=ON \
                    -DEXIV2_ENABLE_NLS=OFF \
                    -DEXIV2_ENABLE_VIDEO=ON \
                    -DEXIV2_ENABLE_WEBREADY=OFF \
                    -DIconv_INCLUDE_DIR=${prefix}/include \
                    -DIconv_LIBRARY=${prefix}/lib/libiconv.dylib \
                    -DPython3_EXECUTABLE=${prefix}/bin/python${python_version} \
                    -DZLIB_ROOT=${prefix}

# upstream hardcodes @loader_path, so build-tree binaries need the build rpath for tests
configure.args-append \
                    -DCMAKE_BUILD_WITH_INSTALL_RPATH=OFF

depends_test-append port:py[string map {. {}} ${python_version}]-lxml
test.run            yes
test.cmd            ctest
test.target
test.args           --output-on-failure
# HTTP I/O needs EXIV2_ENABLE_WEBREADY; an empty EXIV2_HTTP skips those tests
test.env-append     EXIV2_HTTP=

github.livecheck.regex  {(\d+(?:\.\d+)+)}

