base: core24

name: mediainfo-gui
version: '26.05.20260516'
summary: Graphical utility for reading information from audio/video files
description: |
  MediaInfo is a utility used for retrieving technical information and other
  metadata about audio or video files.
license: BSD-2-Clause
contact: info@mediaarea.net
website: https://mediaarea.net/MediaInfo
donation: https://mediaarea.net/MediaInfo/Donate
confinement: strict
grade: stable

lint:
  ignore:
    - classic
    - library:
      - usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR/libmms.*
      - usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR/libxdot.*

plugs:
  shared-memory:
    private: true

apps:
  mediainfo-gui:
    extensions:
      - kde-neon-6
    environment:
      GVBINDIR: $SNAP/usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR/graphviz
      QTWEBENGINE_DISABLE_SANDBOX: 1
    command: usr/bin/mediainfo-gui
    plugs:
      - x11
      - unity7
      - wayland
      - opengl
      - desktop
      - desktop-legacy
      - home
      - network
      - gsettings
      - removable-media

parts:
  mediainfo-gui:
    plugin: qmake
    source: MediaInfo
    qmake-major-version: 6
    qmake-project-file: Project/QMake/GUI/MediaInfoQt.pro
    build-environment:
      - PATH: "/usr/lib/qt6/bin:$PATH"
    build-packages:
      - qt6-tools-dev-tools
      - qt6-l10n-tools
      - qt6-base-dev
      - qt6-webengine-dev
      - qmake6
      - libglib2.0-bin
    stage-packages:
      - libcurl4t64
      - libmms0
      - libcdt5
      - libcgraph6
      - libgvc6
      - libpathplan4
      - libxdot4
      - libqt6widgets6t64
      - libqt6xml6t64
      - libqt6quickwidgets6
      - libqt6printsupport6t64
      - libqt6webenginecore6
      - libqt6webenginewidgets6
      - libgtk-3-common # needed by qt applications, but not pulled by kf6 part
    override-prime: |
      craftctl default
      GVBINDIR=$CRAFT_PRIME/usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR/graphviz $CRAFT_PRIME/usr/sbin/libgvc6-config-update -c
      glib-compile-schemas $CRAFT_PRIME/usr/share/glib-2.0/schemas
    after:
      - libmediainfo
      - libzen
      - build-essential

  libmediainfo:
    plugin: autotools
    source: MediaInfoLib
    source-subdir: Project/GNU/Library
    autotools-configure-parameters:
      - --prefix=/usr
      - --enable-shared
      - --disable-static
      - --with-graphviz=runtime
      - --with-libcurl
      - --with-libmms
    build-packages:
      - libcurl4-openssl-dev
      - libgraphviz-dev
      - libmms-dev
      - zlib1g-dev
    after:
      - libzen
      - build-essential
    prime:
      - usr/lib/libmediainfo.*

  libzen:
    plugin: autotools
    source: ZenLib
    source-subdir: Project/GNU/Library
    autotools-configure-parameters:
      - --prefix=/usr
      - --enable-shared
      - --disable-static
    after:
      - build-essential
    prime:
      - usr/lib/libzen.*

  build-essential:
    plugin: nil
    build-packages:
      - build-essential
      - pkgconf
