From 9b449045fbd5fd3b58bcaff6cf0c5878cd6e64eb Mon Sep 17 00:00:00 2001
From: Michal Klocek <michal.klocek@qt.io>
Date: Wed, 30 Aug 2017 13:02:20 +0200
Subject: [PATCH] Require NSS for linux builds

OpenSSL certificate validation was dropped in
https://codereview.chromium.org/2862543003

Bundled NSS was deopped in
https://codereview.chromium.org/1882433002

Task-number: QTBUG-52193
Task-number: QTBUG-62891
Change-Id: I300c13c30a2625bbe56beb0659107d2a395b0a4d
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
---
 configure.json                 | 17 ++++-------------
 mkspecs/features/configure.prf |  7 ++++++-
 2 files changed, 10 insertions(+), 14 deletions(-)

diff --git a/configure.json b/configure.json
index d25517c33..19a32a17c 100644
--- a/configure.json
+++ b/configure.json
@@ -12,7 +12,6 @@
             "ffmpeg": { "type": "enum", "name": "system-ffmpeg", "values": { "system": "yes", "qt": "no" } },
             "opus": { "type": "enum", "name": "system-opus", "values": { "system": "yes", "qt": "no" } },
             "webp": { "type": "enum", "name": "system-webp", "values": { "system": "yes", "qt": "no" } },
-            "nss-certificate-handling": "boolean",
             "pepper-plugins": "boolean",
             "printing-and-pdf": "boolean",
             "proprietary-codecs": "boolean",
@@ -61,7 +60,7 @@
             ]
         },
         "nss": {
-            "label": "NSS",
+            "label": "nss",
             "sources": [
                 { "type": "pkgConfig", "args": "nss" }
             ]
@@ -182,12 +181,9 @@
             "autoDetect": "!features.embedded",
             "output": [ "privateFeature" ]
         },
-        "nss-certificate-handling": {
-            "label": "NSS certificate handling",
-            "purpose": "Use NSS to handle certificates instead of BoringSSL. Recommended on Linux.",
-            "section": "WebEngine",
-            "condition": "config.unix && !config.darwin",
-            "autoDetect": "libs.nss",
+        "system-nss": {
+            "label": "nss",
+            "condition": "config.unix && !config.darwin && libs.nss",
             "output": [ "privateFeature" ]
         },
         "system-webp": {
@@ -276,11 +272,6 @@
                     "args": "pulseaudio",
                     "condition": "config.unix"
                 },
-                {
-                    "type": "feature",
-                    "args": "nss-certificate-handling",
-                    "condition": "config.unix && !config.darwin"
-                },
                 {
                    "section": "System libraries",
                    "condition": "config.unix",
diff --git a/mkspecs/features/configure.prf b/mkspecs/features/configure.prf
index 6e9a28e4d..37128bf93 100644
--- a/mkspecs/features/configure.prf
+++ b/mkspecs/features/configure.prf
@@ -50,7 +50,7 @@ defineTest(runConfigure) {
     qtConfig(system-opus): WEBENGINE_CONFIG += use_system_opus
     qtConfig(system-ffmpeg): WEBENGINE_CONFIG += use_system_ffmpeg
     qtConfig(system-icu): WEBENGINE_CONFIG += use_system_icu
-    qtConfig(nss-certificate-handling): WEBENGINE_CONFIG += use_nss
+
     !contains(WEBENGINE_CONFIG, use_system_libwebp): WEBENGINE_CONFIG += use_bundled_libwebp
     !contains(WEBENGINE_CONFIG, use_system_opus): WEBENGINE_CONFIG += use_bundled_opus
     !contains(WEBENGINE_CONFIG, use_system_ffmpeg): WEBENGINE_CONFIG += use_bundled_ffmpeg
@@ -68,6 +68,11 @@ defineTest(runConfigure) {
             skipBuild("A suitable version of libc could not be found. See: https://sourceware.org/bugzilla/show_bug.cgi?id=14898")
             return(false)
         }
+        !qtConfig(system-nss) {
+            skipBuild("A suitable version of NSS could not be found.")
+            return(false)
+        }
+        WEBENGINE_CONFIG += use_nss
 
         QT_FOR_CONFIG += gui-private
         !config_khr:skipBuild("khronos development headers appear to be missing (mesa/libegl1-mesa-dev)")
-- 
GitLab