{
    "module": "webenginecore",
    "depends": [
        "buildtools-private",
        "core-private",
        "gui-private",
        "printsupport"
    ],
    "condition": "module.gui && features.build-qtwebengine-core && features.webengine-core-support",
    "testDir": "../../config.tests",
    "commandline": {
        "options": {
            "webengine-alsa": "boolean",
            "webengine-embedded-build": "boolean",
            "webengine-full-debug-info": "boolean",
            "webengine-icu": { "type": "enum", "name": "webengine-system-icu", "values": { "system": "yes", "qt": "no" } },
            "webengine-ffmpeg": { "type": "enum", "name": "webengine-system-ffmpeg", "values": { "system": "yes", "qt": "no" } },
            "webengine-opus": { "type": "enum", "name": "webengine-system-opus", "values": { "system": "yes", "qt": "no" } },
            "webengine-webp": { "type": "enum", "name": "webengine-system-libwebp", "values": { "system": "yes", "qt": "no" } },
            "webengine-pepper-plugins": "boolean",
            "webengine-printing-and-pdf": "boolean",
            "webengine-proprietary-codecs": "boolean",
            "webengine-pulseaudio": "boolean",
            "webengine-spellchecker": "boolean",
            "webengine-native-spellchecker": "boolean",
            "webengine-extensions": "boolean",
            "webengine-webrtc": "boolean",
            "webengine-webrtc-pipewire": "boolean",
            "webengine-geolocation": "boolean",
            "webengine-webchannel": "boolean",
            "webengine-kerberos": "boolean",
            "alsa": { "type": "boolean", "name": "webengine-alsa" },
            "pulseaudio": { "type": "boolean", "name": "webengine-pulseaudio" },
            "ffmpeg": { "type": "enum", "name": "webengine-system-ffmpeg", "values": { "system": "yes", "qt": "no" } },
            "opus": { "type": "enum", "name": "webengine-system-opus", "values": { "system": "yes", "qt": "no" } },
            "webp": { "type": "enum", "name": "webengine-system-libwebp", "values": { "system": "yes", "qt": "no" } },
            "pepper-plugins": { "type": "boolean", "name": "webengine-pepper-plugins" },
            "printing-and-pdf": { "type": "boolean", "name": "webengine-printing-and-pdf" },
            "proprietary-codecs": { "type": "boolean", "name": "webengine-proprietary-codecs" },
            "spellchecker": { "type": "boolean", "name": "webengine-spellchecker" },
            "extensions": { "type": "boolean", "name": "webengine-extensions" },
            "webrtc": { "type": "boolean", "name": "webengine-webrtc" }
        }
    },

    "libraries": {
        "webengine-alsa": {
            "label": "alsa",
            "test": {
                "tail": [
                    "#if SND_LIB_VERSION < 0x1000a  // 1.0.10",
                    "#error Alsa version found too old, require >= 1.0.10",
                    "#endif"
                ]
            },
            "headers" : ["alsa/asoundlib.h"],
            "sources" : [{ "type": "pkgConfig", "args": "alsa" }
            ]
        },
        "webengine-poppler-cpp": {
            "label": "poppler-cpp",
            "sources": [
                { "type": "pkgConfig", "args": "poppler-cpp" }
            ]
        },
        "webengine-pulseaudio": {
            "label": "pulseaudio >= 0.9.10",
            "sources": [
                { "type": "pkgConfig", "args": "libpulse >= 0.9.10 libpulse-mainloop-glib" }
            ]
        },
        "webengine-gio": {
            "label": "gio",
            "sources": [
                { "type": "pkgConfig", "args": "gio-2.0" }
            ]
        }
    },
    "tests" : {
        "webengine-host-compiler": {
            "label": "host compiler",
            "test": "hostcompiler",
            "host": "true",
            "type": "compile"
        },
        "webengine-host-pkg-config": {
            "label": "host pkg-config",
            "type": "detectHostPkgConfig",
            "log": "path"
        },
        "webengine-embedded-build": {
            "label": "embedded build",
            "type": "detectEmbedded"
        }
    },
    "features": {
        "webengine-embedded-build": {
            "label": "Embedded build",
            "purpose": "Enables the embedded build configuration.",
            "condition": "config.unix",
            "autoDetect": "tests.webengine-embedded-build",
            "output": [ "privateFeature" ]
        },
        "webengine-alsa": {
            "label": "Use ALSA",
            "condition": "config.unix && libs.webengine-alsa",
            "output": [ "privateFeature" ]
        },
        "webengine-v8-snapshot-support": {
            "label" : "Building v8 snapshot supported",
            "condition": "!config.unix || !features.cross_compile || arch.arm64 || tests.webengine-host-compiler",
            "output": [ "privateFeature" ]
        },
        "webengine-geolocation": {
            "label": "Geolocation",
            "condition": "module.positioning",
            "output": [ "publicFeature" ]
        },
        "webengine-pulseaudio": {
            "label": "Use PulseAudio",
            "autoDetect": "config.unix",
            "condition": "libs.webengine-pulseaudio",
            "output": [ "privateFeature" ]
        },
        "webengine-pepper-plugins": {
            "label": "Pepper Plugins",
            "purpose": "Enables use of Pepper Flash plugins.",
            "autoDetect": "!features.webengine-embedded-build",
            "output": [ "privateFeature" ]
        },
        "webengine-printing-and-pdf": {
            "label": "Printing and PDF",
            "purpose": "Provides printing and output to PDF.",
            "condition": "module.printsupport && features.printer",
            "autoDetect": "!features.webengine-embedded-build",
            "output": [ "privateFeature" ]
        },
        "webengine-webchannel": {
            "label": "WebChannel support",
            "purpose": "Provides QtWebChannel integration.",
            "section": "WebEngine",
            "condition": "module.webchannel",
            "output": [ "publicFeature" ]
        },
        "webengine-proprietary-codecs": {
            "label": "Proprietary Codecs",
            "purpose": "Enables the use of proprietary codecs such as h.264/h.265 and MP3.",
            "autoDetect": false,
            "output": [ "privateFeature" ]
        },
        "webengine-kerberos": {
            "label": "Kerberos Authentication",
            "purpose": "Enables Kerberos Authentication Support",
            "autoDetect": "config.win32",
            "section": "WebEngine",
            "output": [ "privateFeature" ]
        },
        "webengine-spellchecker": {
            "label": "Spellchecker",
            "purpose": "Provides a spellchecker.",
            "output": [ "publicFeature" ]
        },
        "webengine-native-spellchecker": {
            "label": "Native Spellchecker",
            "purpose": "Use the system's native spellchecking engine.",
            "autoDetect": false,
            "condition": "config.macos && features.webengine-spellchecker",
            "output": [ "publicFeature" ]
        },
        "webengine-extensions": {
            "label": "Extensions",
            "purpose": "Enables Chromium extensions within certain limits. Currently used for enabling the pdf viewer.",
            "section": "WebEngine",
            "condition": "features.webengine-printing-and-pdf",
            "autoDetect": "features.webengine-printing-and-pdf",
            "output": [ "publicFeature" ]
        },
        "webengine-webrtc": {
            "label": "WebRTC",
            "purpose": "Provides WebRTC support.",
            "autoDetect": "!features.webengine-embedded-build",
            "output": [ "privateFeature" ]
        },
        "webengine-webrtc-pipewire": {
            "label": "PipeWire over GIO",
            "purpose": "Provides PipeWire support in WebRTC using GIO.",
            "condition": "features.webengine-webrtc && libs.webengine-gio",
            "autoDetect": "false",
            "output": [ "privateFeature" ]
        },
        "webengine-ozone" : {
             "label": "Support qpa-xcb",
             "condition": "features.webengine-ozone-x11",
             "output": [ "privateFeature" ]
        },
        "webengine-poppler-cpp": {
            "label": "poppler-cpp",
            "autoDetect": "config.unix",
            "condition": "libs.webengine-poppler-cpp",
            "output": [ "privateFeature" ]
        },
        "webengine-full-debug-info": {
            "label": "Full debug information",
            "purpose": "Enables debug information for Blink and V8.",
            "autoDetect": false,
            "condition": "config.debug || features.debug_and_release || features.force_debug_info",
            "output": [
              { "type": "privateConfig", "name": "v8base_debug" },
              { "type": "privateConfig", "name": "webcore_debug" }
            ]
        }
    },

    "report": [
        {
            "type": "warning",
            "condition": "config.unix && !features.webengine-host-pkg-config",
            "message": "host pkg-config not found"
        },
        {
            "type": "warning",
            "condition": "config.linux && features.webengine-embedded-build && !features.webengine-system-ffmpeg && arch.arm && !features.webengine-arm-thumb",
            "message": "Thumb instruction set is required to build ffmpeg for QtWebEngine."
        },
        {
            "type": "warning",
            "condition": "config.unix && config.cross_compile && !features.webengine-v8-snapshot-support",
            "message": "V8 snapshot cannot be built. Most likely, the 32-bit host compiler does not work. Please make sure you have 32-bit devel environment installed."
        }
    ],

    "summary": [
        {
            "section": "Qt WebEngineCore",
            "condition": "features.build-qtwebengine-core",
            "entries": [
                "webengine-embedded-build",
                "webengine-full-debug-info",
                "webengine-pepper-plugins",
                "webengine-printing-and-pdf",
                "webengine-proprietary-codecs",
                "webengine-spellchecker",
                "webengine-native-spellchecker",
                "webengine-webrtc",
                "webengine-webrtc-pipewire",
                "webengine-geolocation",
                "webengine-webchannel",
                "webengine-kerberos",
                "webengine-extensions",
                {
                    "type": "feature",
                    "args": "webengine-ozone",
                    "condition": "config.unix"
                },
                {
                    "type": "feature",
                    "args": "webengine-v8-snapshot-support",
                    "condition": "config.unix && config.cross_compile"
                },
                {
                    "type": "feature",
                    "args": "webengine-alsa",
                    "condition": "config.unix"
                },
                {
                    "type": "feature",
                    "args": "webengine-pulseaudio",
                    "condition": "config.unix"
                },
                {
                    "message": "macOS version",
                    "type": "macosToolchainVersion",
                    "args": "macosVersion",
                    "condition": "config.macos"
                },
                {
                    "message": "Xcode version",
                    "type": "macosToolchainVersion",
                    "args": "xcodeVersion",
                    "condition": "config.macos"
                },
                {
                    "message": "Clang version",
                    "type": "macosToolchainVersion",
                    "args": "clangVersion",
                    "condition": "config.macos"
                },
                {
                    "message": "macOS SDK version",
                    "type": "macosToolchainVersion",
                    "args": "sdkVersion",
                    "condition": "config.macos"
                },
                {
                    "message": "macOS minimum deployment target",
                    "type": "macosToolchainVersion",
                    "args": "deploymentTarget",
                    "condition": "config.macos"
                }
            ]
        }
    ]
}
