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

# normally update mediainfolib port at the same time
github.setup        MediaArea MediaInfo 26.05 v
revision            0
name                [string tolower ${github.project}]
categories          multimedia
license             BSD
maintainers         {makr @mohd-akram} openmaintainer

description         Technical and tag data for video and audio files
long_description    MediaInfo is a convenient unified display of the most \
                    relevant technical and tag data for video and audio files.

homepage            https://mediaarea.net/en/MediaInfo

checksums           rmd160  08159f31a87a71a2ff789a39a3909859f315682b \
                    sha256  90dd67f5a70bb87158d7024456339f5062f59776188427d7158d07a43e6a46d1 \
                    size    18038139
github.tarball_from archive

installs_libs       no

# mediainfo(7567) malloc: *** error for object 0xa04da754: pointer being freed was not allocated
legacysupport.newest_darwin_requires_legacy 0

depends_build-append \
                    path:bin/pkg-config:pkgconfig
depends_lib-append  port:mediainfolib \
                    port:zenlib \
                    port:zlib

if {${subport} eq ${name}} {
    worksrcdir      ${worksrcdir}/Project/GNU/CLI

    legacysupport.redirect_bins ${name}
} else {
    worksrcdir      ${worksrcdir}/Project/GNU/GUI

    legacysupport.redirect_bins ${name}-gui
}

use_autoreconf          yes

compiler.cxx_standard   2011

subport mediainfo-gui {
    PortGroup           wxWidgets 1.0

    # wxGTK-3.2 needs this at least for strnlen etc.
    legacysupport.newest_darwin_requires_legacy 10

    revision            0

    description         Identifies audio and video codecs in a media file. GUI
    long_description    MediaInfo supplies technical and tag information \
                        about a video or audio file via graphical utility.

    wxWidgets.use       wxGTK-3.2

    depends_lib-append  port:${wxWidgets.port}

    depends_run-append  port:desktop-file-utils

    configure.args      --with-wxdir=${wxWidgets.wxdir}

    post-activate {
        system "${prefix}/bin/update-desktop-database ${prefix}/share/applications"
        system "${prefix}/bin/gtk-update-icon-cache -f -t ${prefix}/share/icons/hicolor"
    }
}
