app-id: sa.sy.bluerecorder
runtime: org.gnome.Platform
runtime-version: "40"
sdk: org.gnome.Sdk
sdk-extensions:
  - org.freedesktop.Sdk.Extension.rust-stable
cleanup:
  - /share/man
  - /share/doc
  - /share/gtk-doc
command: /app/opt/blue-recorder
finish-args:
  - --filesystem=home
  - --share=ipc
  - --socket=x11
  - --socket=pulseaudio
  - --device=dri
  - --talk-name=org.gnome.Shell.Screencast
  - --talk-name=org.kde.StatusNotifierWatcher
modules:
  - shared-modules/libappindicator/libappindicator-gtk3-12.10.json
  - shared-modules/dbus-glib/dbus-glib-0.110.json

  - name: bluerecorder
    buildsystem: simple
    build-options:
      append-path: /usr/lib/sdk/rust-stable/bin
      env:
        CARGO_HOME: "/run/build/bluerecorder/cargo"
        RUST_BACKTRACE: "1"
    build-commands:
      - mkdir -p $FLATPAK_DEST/opt $FLATPAK_DEST/share/icons/hicolor/128x128/apps/
      - install -D flatpak/sa.sy.bluerecorder.metainfo.xml -t $FLATPAK_DEST/share/metainfo/
      - install -D flatpak/sa.sy.bluerecorder.desktop -t $FLATPAK_DEST/share/applications/
      - cp -v data/blue-recorder@x128.png $FLATPAK_DEST/share/icons/hicolor/128x128/apps/sa.sy.bluerecorder.png
      - cargo --offline fetch --manifest-path Cargo.toml --verbose 
      - cargo --offline build --release --verbose
      - cp target/release/blue-recorder $FLATPAK_DEST/opt 
      - cp -a data interfaces po $FLATPAK_DEST/opt
    sources:
      - cargo-sources.json
      - type: git
        url: https://github.com/xlmnxp/blue-recorder.git

  - name: xwininfo
    sources: 
      - type: archive
        url: https://xorg.freedesktop.org/archive/individual/app/xwininfo-1.1.5.tar.bz2
        md5: 26d46f7ef0588d3392da3ad5802be420

  - name: libx264
    config-opts:
      - --enable-shared
      - --disable-cli
    sources:
      - type: git
        url: https://code.videolan.org/videolan/x264.git
        branch: stable

  - name: ffmpeg
    config-opts:
      - --enable-shared
      - --disable-static
      - --disable-doc
      - --disable-htmlpages
      - --disable-manpages
      - --disable-podpages
      - --disable-txtpages
      - --enable-libpulse
      - --enable-gpl
      - --enable-libx264
      - --enable-version3
      - --enable-libvorbis
    sources:
      - type: archive
        url: http://www.ffmpeg.org/releases/ffmpeg-4.3.2.tar.xz
        md5: 29529337d9b8f794a6142db10b717ec5