base: core24

name: mediainfo
version: '26.01.20260411'
summary: Command-line 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.*

apps:
  mediainfo:
    environment:
      GVBINDIR: $SNAP/usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR/graphviz
    command: usr/bin/mediainfo
    plugs:
      - home
      - network
      - removable-media

parts:
  mediainfo:
    plugin: autotools
    source: MediaInfo
    source-subdir: Project/GNU/CLI
    autotools-configure-parameters:
      - --prefix=/usr
    stage-packages:
      - libcurl4t64
      - libmms0
      - libcdt5
      - libcgraph6
      - libgvc6
      - libpathplan4 
      - libxdot4
    after:
      - libmediainfo
      - libzen
      - build-essential
    prime:
      - usr/sbin/libgvc6-config-update
      - usr/bin/mediainfo
      - usr/lib/*
    override-prime: |
      craftctl default
      GVBINDIR=$CRAFT_PRIME/usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR/graphviz $CRAFT_PRIME/usr/sbin/libgvc6-config-update -c

  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
