{
    "app-id": "org.psi_im.Psi",
    "runtime": "org.kde.Platform",
    "runtime-version": "5.9",
    "sdk": "org.kde.Sdk",
    "command": "psi",
    "rename-desktop-file": "psi.desktop",
    "rename-appdata-file": "psi.appdata.xml",
    "rename-icon": "psi",
    "finish-args": [
        "--socket=x11",
        "--socket=wayland",
        "--socket=pulseaudio",
        "--socket=system-bus",
        "--socket=session-bus",
        "--share=ipc",
        "--share=network",
        "--filesystem=xdg-documents",
        "--filesystem=xdg-download",
        "--filesystem=xdg-music",
        "--filesystem=xdg-pictures",
        "--filesystem=xdg-videos",
        "--talk-name=org.kde.StatusNotifierWatcher",
        "--talk-name=org.freedesktop.Notifications",
        "--device=dri"],
    "build-options": {
        "cflags": "-O2 -g",
        "cxxflags": "-O2 -g"
    },
    "cleanup": [
        "/cache",
        "/man",
        "/share/man",
        "/lib/systemd",
        "*.la", "*.a"
    ],
    "modules": [
        {
            "name": "qca",
            "buildsystem": "cmake",
            "build-options": {"cxxflags": "-O2 -g -DWITH_ossl_PLUGIN=yes -DWITH_gnupg_PLUGIN=yes"},
            "sources": [
                {
                    "type": "archive",
                    "url": "http://download.kde.org/stable/qca/2.1.3/src/qca-2.1.3.tar.xz",
                    "sha256": "003fd86a32421057a03b18a8168db52e2940978f9db5ebbb6a08882f8ab1e353"
                }
            ]
        },
        {
            "name": "libgpg-error",
            "sources": [
                {
                    "type": "archive",
                    "url": "https://www.gnupg.org/ftp/gcrypt/libgpg-error/libgpg-error-1.28.tar.bz2",
                    "sha256": "3edb957744905412f30de3e25da18682cbe509541e18cd3b8f9df695a075da49"
                }
            ]
        },
        {
            "name": "libgcrypt",
            "sources": [
                {
                    "type": "archive",
                    "url": "https://www.gnupg.org/ftp/gcrypt/libgcrypt/libgcrypt-1.8.2.tar.bz2",
                    "sha256": "c8064cae7558144b13ef0eb87093412380efa16c4ee30ad12ecb54886a524c07"
                }
            ]
        },
        {
            "name": "libotr",
            "config-opts": ["--with-pic"],
            "sources": [
                {
                    "type": "archive",
                    "url": "https://otr.cypherpunks.ca/libotr-4.1.1.tar.gz",
                    "sha256": "8b3b182424251067a952fb4e6c7b95a21e644fbb27fbd5f8af2b2ed87ca419f5"
                }
            ]
        },
        {
            "name": "tidy-html",
            "buildsystem": "simple",
            "build-commands": [
                "cd build/cmake && cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/app ../.. ",
                "cd build/cmake && make && make install"],
            "sources": [
                {
                    "type": "archive",
                    "url": "https://github.com/htacg/tidy-html5/archive/5.6.0.zip",
                    "sha256": "53e71d63eabdf4d9a29c7b8d242b008b185556ad6761d7f1bceebc8400715a88"
                }
            ]
        },
        {
            "name": "psi",
            "buildsystem": "cmake",
            "builddir": true,
            "config-opts": ["-DENABLE_PLUGINS=ON", "-DPLUGINS_PATH=lib/psi/plugins"],
            "post-install": [
                "for icon_size in 16 32 48 64 128; do
                     install -dm755 /app/share/icons/hicolor/${icon_size}x${icon_size}/apps
                     install -m644 /app/share/psi/iconsets/system/default/logo_${icon_size}.png /app/share/icons/hicolor/${icon_size}x${icon_size}/apps/psi.png
                 done"
            ],
            "sources": [
                {
                    "type": "archive",
                    "url": "https://github.com/psi-im/psi/archive/1.3.zip",
                    "sha256": "e1ec29d3f01aaf696f8ded7631e36c613816e4ba4be73a3f7827cb2d0a7ea114"
                },
                {
                    "dest": "iris",
                    "type": "git",
                    "url": "https://github.com/psi-im/iris.git",
                    "commit": "13078a405242f03412ae91e9c65e79cd44282cb2"
                },
                {
                    "dest": "src/libpsi",
                    "type": "git",
                    "url": "https://github.com/psi-im/libpsi.git",
                    "commit": "22d5ff63bd38362bd8771dbcecb98c71bf172c30"
                },
                {
                    "dest": "psi-l10n",
                    "type": "git",
                    "url": "https://github.com/psi-im/psi-l10n.git"
                },
                {
                    "dest": "3rdparty/http-parser",
                    "type": "git",
                    "url": "https://github.com/nodejs/http-parser.git",
                    "commit": "9f489a474d5761ca5715f1e13a3d39023a656424"
                },
                {
                    "dest": "3rdparty/qhttp",
                    "type": "git",
                    "url": "https://github.com/azadkuh/qhttp.git",
                    "commit": "2cc654a126b80cd081d2985d5e08437e9eafd877"
                },
                {
                    "dest": "psi-plugins",
                    "type": "archive", 
                    "url": "https://github.com/psi-im/plugins/archive/1.3.zip", 
                    "sha256": "084a6c408bd034ec5ff17a2c572e7c17518d29c1edbfbcdb483f83b12b4e2a22"
                },
                {
                    "type": "shell",
                    "commands": [
                        "cp -R psi-l10n/translations .",
                        "cp -R psi-plugins/* src/plugins"]
                }
            ]
        }
    ]
}
