{
  "app-id": "com.freerdp.FreeRDP",
  "runtime": "org.freedesktop.Platform",
  "runtime-version": "22.08",
  "sdk": "org.freedesktop.Sdk",
  "build-options" : {
    "cflags": "-O3",
    "cxxflags": "-O3"
  },
  "command": "freerdp.sh",
  "cleanup": [
    "*.la",
    "/include",
    "/lib/cmake",
    "/lib/pkgconfig"
  ],
  "finish-args": [
    /* X11 + XShm access */
    "--share=ipc",
    "--socket=x11",
    /* Needs to talk to the network */
    "--share=network",
    /* Play sounds redirected from guests */
    "--socket=pulseaudio",
    "--socket=cups",
    /* Wayland access */
    "--socket=wayland",
    /* Allow rw access to download folder */
    "--filesystem=xdg-download"
  ],
  "add-build-extensions": {
    "org.freedesktop.Platform.ffmpeg-full": {
    "directory": "lib/ffmpeg",
    "version": "22.08",
    "add-ld-path": "."
    },
    "org.freedesktop.Platform.openh264": {
    "directory": "lib/openh264",
    "version": "2.3.0",
    "add-ld-path": "."
    }
  },
  "modules": [
    {
      /**
       * libfreerdp use xprop to try to detect keyboard layout
       */
      "name": "xprop",
      "sources": [
        {
          "type": "archive",
          "url": "https://xorg.freedesktop.org/releases/individual/app/xprop-1.2.5.tar.bz2",
          "sha256": "9b92ed0316bf2486121d8bac88bd1878f16b43bd335f18009b1f941f1eca93a1"
        }
      ],
      "cleanup": [
        "/share/doc",
        "/share/man"
      ]
    },
    {
      "name": "libusb",
      "config-opts": ["--disable-static"],
      "sources": [
        {
          "type": "git",
          "url": "https://github.com/libusb/libusb.git",
          "tag": "v1.0.26"
        }
      ],
      "cleanup": [
        "/share/doc",
        "/share/man"
      ]
    },
    {
      "name": "pcsc",
      "config-opts": [
        "--disable-libsystemd",
        "--enable-pic",
        "--disable-libusb",
        "--enable-shared",
        "--with-systemdsystemunitdir=/app/lib/systemd/"
      ],
      "sources": [
        {
          "type": "git",
          "url": "https://github.com/LudovicRousseau/PCSC.git",
          "tag": "1.9.9"
        }
      ],
      "cleanup": [
        "/share/doc",
        "/share/man"
      ]
    }, 
    {
      "name": "openssl111",
      "buildsystem": "simple",
      "build-commands": [
        "./config --prefix=/app",
        "make -j $FLATPAK_BUILDER_N_JOBS",
        "make install_sw"
      ],
      "cleanup": [
        "/share/doc",
        "/share/man",
        "/bin"
      ],
      "sources": [
        {
          "type": "archive",
          "url": "https://www.openssl.org/source/openssl-1.1.1t.tar.gz",
          "sha256": "8dee9b24bdb1dcbf0c3d1e9b02fb8f6bf22165e807f45adeb7c9677536859d3b"
        }
      ]
    },
    {
      "name": "cjson",
      "buildsystem": "cmake-ninja",
      "cleanup": [
      ],
      "config-opts": [
        "-DCMAKE_VERBOSE_MAKEFILE=ON",
        "-DCMAKE_BUILD_TYPE:STRING=Release",
        "-DCMAKE_INSTALL_LIBDIR:PATH=lib",
        "-DWITH_PULSE:BOOL=ON"
      ],
      "sources": [
        {
          "type": "git",
          "url": "https://github.com/DaveGamble/cJSON.git",
          "tag": "v1.7.15"
        }
      ]
    },
    {
      "name": "freerdp",
      "buildsystem": "cmake-ninja",
      "cleanup": [
      ],
      "config-opts": [
        "-DCMAKE_VERBOSE_MAKEFILE=ON",
        "-DCMAKE_BUILD_TYPE:STRING=Release",
        "-DCMAKE_INSTALL_LIBDIR:PATH=lib",
        "-DWITH_FREERDP_DEPRECATED_COMMANDLINE=ON",
        "-DCHANNEL_TSMF:BOOL=OFF",
        "-DCHANNEL_URBDRC:BOOL=ON",
        "-DBUILD_TESTING:BOOL=OFF",
        "-DWITH_MANPAGES:BOOL=OFF",
        "-DWITH_KRB5:BOOL=OFF",
        "-DWITH_PCSC:BOOL=ON",
        "-DWITH_PKCS11:BOOL=ON",
        "-DWITH_SWSCALE:BOOL=ON",
        "-DWITH_SERVER:BOOL=ON",
        "-DWITH_SAMPLE:BOOL=ON",
        "-DWITH_CUPS:BOOL=ON",
        "-DWITH_FFMPEG:BOOL=ON",
        "-DWITH_DSP_FFMPEG:BOOL=ON",
        "-DWITH_OSS:BOOL=OFF",
        "-DWITH_PULSE:BOOL=ON"
      ],
      "sources": [
      {
        "type": "dir",
        "path": "../.."
      }
      ]
    },
    {
      "name": "wrapper",
      "buildsystem": "simple",
      "build-commands": [
        "install -D freerdp.sh /app/bin/freerdp.sh",
        "mkdir -p /app/lib/ffmpeg",
        "mkdir -p /app/lib/openh264"
      ],
      "sources": [
        {
          "type": "file",
          "path": "freerdp.sh"
        }
      ]
    }
  ]
}
