app-id: io.github.swanux.hbud
runtime: org.gnome.Platform
runtime-version: '44'
sdk: org.gnome.Sdk
command: hbud
sdk-extensions:
  - org.freedesktop.Sdk.Extension.rust-stable

build-options:
  append-path: "/usr/lib/sdk/rust-stable/bin"

cleanup:
  - "/include"
  - "/share/gdb"
  - "/share/man"
  - "/share/gst-plugins-base"
  - "/share/gir-1.0"
  - ".ref"

finish-args:
  - --share=network
  - --socket=wayland
  - --socket=fallback-x11
  - --device=dri
  - --socket=pulseaudio
  - --share=ipc
  - --own-name=org.mpris.MediaPlayer2.hbud
  - --env=GST_PLUGIN_SYSTEM_PATH=/app/lib/gstreamer-1.0

modules:
  - "lib/libass.json"
  - "lib/ffmpeg.json"
  - "lib/libmpeg2.json"
  - "gstreamer-1.0/gstreamer.json"
  - "pypi-dependencies.json"

  - name: gtk4paintablesink
    buildsystem: simple
    build-options:
      env:
        CARGO_HOME: "/run/build/gtk4paintablesink/cargo"
    build-commands:
      - cargo --offline fetch --manifest-path Cargo.toml --verbose
      - cargo build --offline --release --verbose --features wayland,x11egl,x11glx
      - install -Dm755 target/release/libgstgtk4.so -t /app/lib/gstreamer-1.0
    sources:
    - type: archive
      url: https://github.com/swanux/hbud/releases/download/v0.4.2/gtk4paintablesink_230309.tar.xz
      sha256: a9e23356b6df9d2b25046fee782a70318f749fc0ac6a0b8daa81257b208ed11f

  - name: io.github.swanux.hbud
    buildsystem: simple
    sources:
      - type: dir
        path: ../../.
    build-commands:
      - make prefix=${FLATPAK_DEST} install

cleanup-commands:
  - ln -s /lib/$FLATPAK_ARCH-linux-*/gstreamer-1.0/libgstpipewire.so /app/lib/gstreamer-1.0/
  - pip3 uninstall -y nuitka ordered-set
