id: com.angoosh.RDPConnect
runtime: org.gnome.Platform
runtime-version: '47'
sdk: org.gnome.Sdk
command: rdpconnect

build-options:
  - cflags: "-03 -Wno-error"
  - cxxflags: "-03 -Wno-error"

cleanup:
  - "*.a"
  - "*.la"
  - /include
  - /lib/cmake
  - /lib/pkgconfig
  - /sbin
  - /share/doc
  - /share/examples
  - /share/man

finish-args:
  - --device=dri
  - --share=ipc
  - --socket=x11
  - --socket=wayland
  - --share=network
  - --socket=pulseaudio
  - --socket=cups
  - --filesystem=xdg-config
  - --filesystem=xdg-download
  - --socket=pcsc
#  - --socket=system-bus
  - --socket=session-bus
#  - --talk-name=org.freedesktop.Flatpak

add-build-extensions:
  org.freedesktop.Platform.ffmpeg-full:
    - directory: lib/ffmpeg
      version: 24.08
      add-ld-path: .
  org.freedesktop.Platform.openh264:
    - directory: lib/openh264
      version: 2.4.1
      add-ld-path: .
  
modules:
  - modules/libusb.json
  - modules/SDL2_ttf.json
  - modules/SDL2_image.json
  - modules/cJSON.json
  - modules/xprop.json
  - modules/pcsc.json
  - modules/uriparser.json
  - modules/pkcs11-helper.json
  - modules/opensc.json
  - modules/krb5.json
  - modules/freerdp.json

  - name: python
    sources:
      - type: archive
        url: https://www.python.org/ftp/python/3.9.9/Python-3.9.9.tar.xz
        sha256: 06828c04a573c073a4e51c4292a27c1be4ae26621c3edc7cf9318418ce3b6d27
        
  - name: pip-deps
    buildsystem: simple
    build-options:
      build-args:
        - --share=network
    build-commands:
      - pip3 install PyGObject cryptography keyring
    
  - name: rdpconnect
    buildsystem: simple
    build-commands:
      - ls -l ./
      - mkdir -p /app/share/icons/hicolor/scalable/apps/
      - mkdir -p /app/share/applications/
      - mkdir -p /app/share/metainfo/
      - install -Dm755 rdpconnect.sh /app/bin/rdpconnect
      - install -Dm755 main.py /app/
      - install com.angoosh.RDPConnect.ui /app/
      - install menu.ui /app/
      - install preferences.ui /app/
      - install style-dark.css /app/
      - install style-light.css /app/
      - install -Dm644 com.angoosh.RDPConnect.svg /app/share/icons/hicolor/scalable/apps/
      - install -Dm644 com.angoosh.RDPConnect.desktop /app/share/applications/
      - install -Dm644 com.angoosh.RDPConnect.metainfo.xml /app/share/metainfo/
    sources:
      - type: script
        dest-filename: rdpconnect.sh
        commands:
          - python3 /app/main.py
      - type: file
        path: main.py
      - type: file
        path: com.angoosh.RDPConnect.ui
      - type: file
        path: style-dark.css
      - type: file
        path: style-light.css
      - type: file
        path: com.angoosh.RDPConnect.svg
      - type: file
        path: com.angoosh.RDPConnect.desktop
      - type: file
        path: com.angoosh.RDPConnect.metainfo.xml
      - type: file
        path: menu.ui
      - type: file
        path: preferences.ui