From 6bc675d8a7f89cb8c1ce4fc48dfeedcc8028c76f Mon Sep 17 00:00:00 2001 From: Michal Klocek <michal.klocek@qt.io> Date: Thu, 31 Aug 2017 10:34:25 +0200 Subject: [PATCH] Migrate configuration lefovers to new configure system Use new configure system for all package detection. Move config test execution to new configure system. However, keep old configure.prf for error hanlding. Split configuration summary into: * optional system libraries used * required system libraries * required system libraries for qpa-xcb (on linux) Change-Id: I5108456caa024a1ada9bb54750693064a2d36f78 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io> --- configure.json | 333 +++++++++++++++++++++++++++++++-- configure.pri | 20 ++ mkspecs/features/configure.prf | 141 +++++--------- src/core/config/linux.pri | 2 +- 4 files changed, 384 insertions(+), 112 deletions(-) diff --git a/configure.json b/configure.json index 82c41a882..900fbf854 100644 --- a/configure.json +++ b/configure.json @@ -17,20 +17,111 @@ "proprietary-codecs": "boolean", "pulseaudio": "boolean", "spellchecker": "boolean", - "webrtc": "boolean" + "native-spellchecker": "boolean", + "webrtc": "boolean", + "geolocation" : "boolean" } }, "libraries": { - "alsa": { - "label": "ALSA", - "test": "alsa", + "dbus": { + "label": "d-bus", + "sources": [ + { "type": "pkgConfig", "args": "dbus-1" } + ] + }, + "fontconfig": { + "label": "fontconfig", + "sources": [ + { "type": "pkgConfig", "args": "fontconfig" } + ] + }, + "libdrm": { + "label": "libdrm", + "sources": [ + { "type": "pkgConfig", "args": "libdrm" } + ] + }, + "xcomposite": { + "label": "xcomposite", + "sources": [ + { "type": "pkgConfig", "args": "xcomposite" } + ] + }, + "xcursor": { + "label": "xcursor", + "sources": [ + { "type": "pkgConfig", "args": "xcursor" } + ] + }, + "xi": { + "label": "xi", + "sources": [ + { "type": "pkgConfig", "args": "xi" } + ] + }, + "xrandr": { + "label": "xrandr", + "sources": [ + { "type": "pkgConfig", "args": "xrandr" } + ] + }, + "xtst": { + "label": "xtst", + "sources": [ + { "type": "pkgConfig", "args": "xtst" } + ] + }, + "harfbuzz": { + "label": "harfbuzz >= 1.4.2", + "sources": [ + { "type": "pkgConfig", "args": "harfbuzz >= 1.4.2" } + ] + }, + "glib": { + "label": "glib-2.0 >= 2.32.0", + "sources": [ + { "type": "pkgConfig", "args": "glib-2.0 >= 2.32.0" } + ] + }, + "zlib": { + "label": "zlib", "sources": [ - "-lasound" + { "type": "pkgConfig", "args": "zlib" } + ] + }, + "minizip": { + "label": "minizip", + "sources": [ + { "type": "pkgConfig", "args": "minizip" } + ] + }, + "libevent": { + "label": "libevent", + "sources": [ + { "type": "pkgConfig", "args": "libevent" } + ] + }, + "libxml2": { + "label": "libxml2 and libxslt", + "sources": [ + { "type": "pkgConfig", "args": "libxml-2.0 libxslt" } + ] + }, + "jsoncpp": { + "label": "jsoncpp", + "sources": [ + { "type": "pkgConfig", "args": "jsoncpp" } + ] + }, + "protobuf": { + "label": "protobuf", + "sources": [ + { "type": "pkgConfig", "args": "protobuf" } ] }, "pulseaudio": { - "label": "PulseAudio >= 0.9.10", + "label": "pulseaudio >= 0.9.10", "sources": [ { "type": "pkgConfig", "args": "libpulse >= 0.9.10 libpulse-mainloop-glib" } ] @@ -64,12 +155,52 @@ "sources": [ { "type": "pkgConfig", "args": "nss" } ] + }, + "png": { + "label": "libpng >= 1.6.0", + "sources": [ + { "type": "pkgConfig", "args": "libpng >= 1.6.0" } + ] } }, "tests" : { + "alsa": { + "label": "alsa", + "test": "alsa", + "type": "compile" + }, + "khr": { + "label": "khr", + "test": "khr", + "type": "compile" + }, + "libvpx": { + "label": "libvpx", + "test": "libvpx", + "type": "compile" + }, + "snappy": { + "label": "snappy", + "test": "snappy", + "type": "compile" + }, + "srtp": { + "label": "srtp", + "test": "srtp", + "type": "compile" + }, + "winversion": { + "label": "winversion", + "test": "winversion", + "type": "compile" + }, + "protoc": { + "label": "protoc", + "type": "detectProtoc" + }, "python2": { - "label": "Python 2", + "label": "python2", "type": "detectPython2", "log": "location" }, @@ -105,12 +236,96 @@ "glibc": { "label": "glibc > 2.16", "type": "detectGlibc" + }, + "icuuc": { + "label" : "libxml2 configured with icuuc", + "type": "detectIcuuc" } }, "features": { + "system-fontconfig": { + "label": "fontconfig", + "condition": "libs.fontconfig", + "output": [ "privateFeature" ] + }, + "system-dbus": { + "label": "dbus", + "condition": "libs.dbus", + "output": [ "privateFeature" ] + }, + "system-libdrm": { + "label": "libdrm", + "condition": "libs.libdrm", + "output": [ "privateFeature" ] + }, + "system-xcomposite": { + "label": "xcomposite", + "condition": "libs.xcomposite", + "output": [ "privateFeature" ] + }, + "system-xcursor": { + "label": "xcursor", + "condition": "libs.xcursor", + "output": [ "privateFeature" ] + }, + "system-xi": { + "label": "xi", + "condition": "libs.xi", + "output": [ "privateFeature" ] + }, + "system-xrandr": { + "label": "xrandr", + "condition": "libs.xrandr", + "output": [ "privateFeature" ] + }, + "system-xtst": { + "label": "xtst", + "condition": "libs.xtst", + "output": [ "privateFeature" ] + }, + "webengine-system-harfbuzz": { + "label": "harfbuzz", + "condition": "libs.harfbuzz", + "output": [ "privateFeature" ] + }, + "system-glib" : { + "label": "glib", + "condition": "config.unix && libs.glib", + "output": [ "privateFeature" ] + }, + "system-minizip" : { + "label": "minizip", + "condition": "config.unix && libs.minizip", + "output": [ "privateFeature" ] + }, + "system-zlib" : { + "label": "zlib", + "condition": "config.unix && libs.zlib", + "output": [ "privateFeature" ] + }, + "system-libevent" : { + "label": "libevent", + "condition": "config.unix && libs.libevent", + "output": [ "privateFeature" ] + }, + "system-jsoncpp" : { + "label": "jsoncpp", + "condition": "config.unix && libs.jsoncpp", + "output": [ "privateFeature" ] + }, + "system-protobuf" : { + "label": "protobuf", + "condition": "config.unix && libs.protobuf && tests.protoc", + "output": [ "privateFeature" ] + }, + "webengine-system-png" : { + "label": "png", + "condition": "config.unix && libs.png", + "output": [ "privateFeature" ] + }, "python2": { - "label": "Python 2", + "label": "python2", "condition": "tests.python2", "output": [ "privateFeature", @@ -141,12 +356,47 @@ "output": [ "privateFeature" ] }, "alsa": { - "label": "ALSA", - "condition": "config.unix && libs.alsa", + "label": "Use ALSA", + "condition": "config.unix && tests.alsa", + "output": [ "privateFeature" ] + }, + "system-khr" : { + "label": "khr", + "condition": "config.unix && tests.khr", + "output": [ "privateFeature" ] + }, + "system-libvpx" : { + "label": "libvpx", + "condition": "config.unix && tests.libvpx", + "output": [ "privateFeature" ] + }, + "system-snappy" : { + "label": "snappy", + "condition": "config.unix && tests.snappy", + "output": [ "privateFeature" ] + }, + "system-libsrtp" : { + "label": "libsrtp", + "condition": "config.unix && tests.srtp", + "output": [ "privateFeature" ] + }, + "system-libxml2" : { + "label": "libxml2", + "condition": "config.unix && tests.srtp", + "output": [ "privateFeature" ] + }, + "winversion" : { + "label": "winversion", + "condition": "config.win32 && tests.winversion", + "output": [ "privateFeature" ] + }, + "geolocation": { + "label": "Geolocation", + "condition": "module.positioning", "output": [ "privateFeature" ] }, "pulseaudio": { - "label": "PulseAudio", + "label": "Use PulseAudio", "autoDetect": "config.unix", "condition": "libs.pulseaudio", "output": [ "privateFeature" ] @@ -179,6 +429,13 @@ "section": "WebEngine", "output": [ "privateFeature" ] }, + "native-spellchecker": { + "label": "Native Spellchecker", + "purpose": "Provides a native spellchecker.", + "condition": "config.macos", + "section": "WebEngine", + "output": [ "privateFeature" ] + }, "webrtc": { "label": "WebRTC", "purpose": "Provides WebRTC support.", @@ -198,7 +455,7 @@ "output": [ "privateFeature" ] }, "system-opus": { - "label": "Opus", + "label": "opus", "autoDetect": "config.unix", "condition": "libs.opus", "output": [ "privateFeature" ] @@ -210,7 +467,7 @@ "output": [ "privateFeature" ] }, "system-icu": { - "label": "ICU", + "label": "icu", "autoDetect": false, "condition": "libs.icu", "output": [ "privateFeature" ] @@ -222,12 +479,12 @@ "output": [ "privateFeature" ] }, "system-ninja": { - "label": "Using system ninja", + "label": "Use System Ninja", "condition": "tests.ninja", "output": [ "privateFeature" ] }, "system-gn": { - "label": "Using system gn", + "label": "Use System Gn", "autoDetect": false, "condition": "tests.gn", "output": [ "privateFeature" ] @@ -236,6 +493,11 @@ "label": "glibc", "condition": "config.linux && tests.glibc", "output": [ "privateFeature" ] + }, + "system-libxml2": { + "label": "libxml2 and libxslt", + "condition": "config.unix && libs.libxml2 && tests.icuuc", + "output": [ "privateFeature" ] } }, @@ -271,8 +533,10 @@ "printing-and-pdf", "proprietary-codecs", "spellchecker", + "native-spellchecker", "webrtc", "system-ninja", + "geolocation", { "type": "feature", "args": "alsa", @@ -284,14 +548,49 @@ "condition": "config.unix" }, { - "section": "System libraries", + "section": "Optional system libraries used", "condition": "config.unix", "entries": [ "system-re2", "system-icu", "system-webp", "system-opus", - "system-ffmpeg" + "system-ffmpeg", + "system-libvpx", + "system-snappy", + "system-libsrtp", + "system-glib", + "system-zlib", + "system-minizip", + "system-libevent", + "system-jsoncpp", + "system-protobuf", + "system-libxml2", + "webengine-system-png", + "webengine-system-harfbuzz" + ] + }, + { + "section": "Required system libraries", + "condition": "config.unix && !config.macos", + "entries": [ + "system-fontconfig", + "system-dbus", + "system-nss", + "system-khr", + "system-glibc" + ] + }, + { + "section": "Required system libraries for qpa-xcb", + "condition": "config.unix && !config.macos", + "entries": [ + "system-libdrm", + "system-xcomposite", + "system-xcursor", + "system-xi", + "system-xrandr", + "system-xtst" ] } ] diff --git a/configure.pri b/configure.pri index c7ce83bb3..549b1efd0 100644 --- a/configure.pri +++ b/configure.pri @@ -116,6 +116,16 @@ defineTest(qtConfTest_detectNinja) { return(false) } +defineTest(qtConfTest_detectProtoc) { + protoc = $$qtConfFindInPath("protoc") + isEmpty(protoc) { + qtLog("Optional protoc could not be found.") + return(false) + } + qtLog("Found protoc from path: $$protoc") + return(true) +} + defineTest(qtConfTest_detectGn) { gn = $$qtConfFindInPath("gn$$EXE_SUFFIX") !isEmpty(gn) { @@ -136,3 +146,13 @@ defineTest(qtConfTest_embedded) { $$qtConfEvaluate("features.cross_compile"): return(true) return(false) } + +defineTest(qtConfTest_detectIcuuc) { + pkgConfig = $$first($$list($$pkgConfigExecutable())) + !isEmpty(pkgConfig) { + qtRunLoggedCommand("$$pkgConfig --libs --static libxml-2.0", xmllibs) + contains(xmllibs,".*-licuuc.*"):return(true) + qtLog("System libxml2 is not configured with ICU") + } + return(false) +} diff --git a/mkspecs/features/configure.prf b/mkspecs/features/configure.prf index b270c71f4..79b54daba 100644 --- a/mkspecs/features/configure.prf +++ b/mkspecs/features/configure.prf @@ -8,17 +8,6 @@ defineTest(runConfigure) { skipBuild("pkg-config is required") return(false) } - # Ignore the cached config tests results in case they were not successful - CONFIG += recheck - #Override the config.tests path - QMAKE_CONFIG_TESTS_DIR = $$QTWEBENGINE_ROOT/config.tests - CONFIG_TESTS = $$files($$QMAKE_CONFIG_TESTS_DIR/*.pro, true) - log("Running configure tests$${EOL}") - for(test, CONFIG_TESTS) { - test = $$basename(test) - test ~= s/\\.pro$// - qtCompileTest($$test) - } include($$QTWEBENGINE_OUT_ROOT/qtwebengine-config.pri) QT_FOR_CONFIG += webengine-private @@ -69,75 +58,67 @@ 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.") + + QT_FOR_CONFIG += gui-private + + !qtConfig(system-khr) { + skipBuild("khronos development headers appear to be missing (mesa/libegl1-mesa-dev)") return(false) } + + for(package, $$list("nss dbus fontconfig")) { + !qtConfig(system-$$package) { + skipBuild("A suitable version of $$package 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)") - - REQUIRED_PACKAGES = dbus-1 fontconfig - !contains(WEBENGINE_CONFIG, embedded_build): qtConfig(xcb): REQUIRED_PACKAGES += libdrm xcomposite xcursor xi xrandr xtst - qtConfig(pulseaudio): REQUIRED_PACKAGES += libpulse - qtConfig(system-png) { - packagesExist("\'libpng >= 1.6.0\'"): WEBENGINE_CONFIG += use_system_libpng - else: log("System libpng is too old (min. version 1.6). Using Chromium's copy.$${EOL}") - } - qtConfig(system-harfbuzz) { - packagesExist("\'harfbuzz >= 1.2.0\'"): WEBENGINE_CONFIG += use_system_harfbuzz - else: log("System harfbuzz is too old (min. version 1.2). Using Chromium's copy.$${EOL}") - } - qtConfig(glib) { - packagesExist("\'glib-2.0 >= 2.32.0\'"): WEBENGINE_CONFIG += use_glib + !contains(WEBENGINE_CONFIG, embedded_build): qtConfig(xcb) { + for(package, $$list("libdrm xcomposite xcursor xi xrandr xtst")) { + !qtConfig(system-$$package) { + skipBuild("A suitable version of $$package could not be found.") + return(false) + } + } } - for(package, $$list($$REQUIRED_PACKAGES)) { - !packagesExist($$package):skipBuild("Unmet dependency: $$package") + # Fix me: mamke system-png a public feature in gui + qtConfig(system-png): qtConfig(webengine-system-png) { + WEBENGINE_CONFIG += use_system_libpng } - packagesExist(minizip, zlib): WEBENGINE_CONFIG += use_system_minizip use_system_zlib - else: log("System zlib or minizip not found. Using Chromium's copies.$${EOL}") - packagesExist(libxml-2.0,libxslt) { - PKGCONFIG_LIBS_STATIC = $$system($$PKG_CONFIG --libs --static libxml-2.0) - contains(PKGCONFIG_LIBS_STATIC, -licuuc) { - WEBENGINE_CONFIG += use_system_libxslt use_system_libxml2 - } else { - log("System libxml2 is not configured with ICU. Using Chromium's copy.$${EOL}") - } + # Fix me: make system-harfbuzz a public feautre in gui + qtConfig(system-harfbuzz): qtConfig(webengine-system-harfbuzz) { + WEBENGINE_CONFIG += use_system_harfbuzz } - else: log("System libxml2 or libxslt not found. Using Chromium's copies.$${EOL}") - for(package, $$list("libevent jsoncpp protobuf")) { - packagesExist($$package): WEBENGINE_CONFIG += use_system_$$package - else { - log("System $$package not found. Using Chromium's copy.$${EOL}") - WEBENGINE_CONFIG += use_bundled_$$package - } + qtConfig(system-glib) { + WEBENGINE_CONFIG += use_glib } - use?(system_protobuf) { - !system("which protoc > /dev/null") { - log("Protobuf compiler not found. Using Chromium's copy of protobuf.$${EOL}") - WEBENGINE_CONFIG -= use_system_protobuf - WEBENGINE_CONFIG += use_bundled_protobuf - } + qtConfig(system-minizip) { + WEBENGINE_CONFIG += use_system_minizip } - config_libvpx: WEBENGINE_CONFIG += use_system_vpx - else { - log("Compatible system libvpx not found. Using Chromium's copy.$${EOL}") - WEBENGINE_CONFIG += use_bundled_libvpx + qtConfig(system-zlib) { + WEBENGINE_CONFIG += use_system_zlib } - config_snappy: WEBENGINE_CONFIG += use_system_snappy - else { - log("System snappy not found. Using Chromium's copy.$${EOL}") - WEBENGINE_CONFIG += use_bundled_snappy + qtConfig(system-libxml2) { + WEBENGINE_CONFIG += use_system_libxslt use_system_libxml2 + } + + for(package, $$list("libevent jsoncpp protobuf libvpx libsrtp snappy")) { + qtConfig(system-$$package) { + WEBENGINE_CONFIG += use_system_$$package + } else { + WEBENGINE_CONFIG += use_bundled_$$package + } } } - win32 { - !config_winversion: skipBuild("Needs VS 2015 Update 3 with Cumulative Servicing Release or higher") + win32:!qtConfig(winversion) { + skipBuild("Needs VS 2015 Update 3 with Cumulative Servicing Release or higher") } - isEmpty(skipBuildReason): { + isEmpty(skipBuildReason) { cache(CONFIG, add, $$list(webengine_successfully_configured)) !isEmpty(WEBENGINE_CONFIG) { cache(WEBENGINE_CONFIG, add, $$list($$WEBENGINE_CONFIG)) @@ -145,36 +126,8 @@ defineTest(runConfigure) { } } - unix:!darwin { - log("System library dependencies:$${EOL}") - for(config, WEBENGINE_CONFIG) { - match = $$find(config, "^use_system_") - !isEmpty(match) { - use_system += $$replace(match, ^use_system_,) - } - match = $$find(config, "^use_bundled_") - !isEmpty(match) { - use_bundled += $$replace(match, ^use_bundled_,) - } - } - !isEmpty(use_system): log(" Optional system libraries used ..... $$use_system$${EOL}") - !isEmpty(use_bundled): log(" Optional bundled libraries used .... $$use_bundled$${EOL}") - } - log("Configurable features:$${EOL}") - qtHaveModule(positioning): { - log(" Geolocation ........................ Enabled$${EOL}") - } else { - log(" Geolocation ........................ Not enabled (Requires Qt Positioning module)$${EOL}") - } - osx { - use?(native_spellchecker) { - log("Native Spellchecker .............. Enabled$${EOL}") - } else { - log("Native Spellchecker .............. Not enabled (Default, enable with WEBENGINE_CONFIG+=use_native_spellchecker)$${EOL}") - } - !isMinOSXSDKVersion(10, 10, 3) { - log(" Force Touch API usage .............. Not enabled (Because the OS X SDK version to be used \"$${WEBENGINE_OSX_SDK_PRODUCT_VERSION}\" is lower than the required \"10.10.3\")$${EOL}") - } + macos:qtConfig(native-spellchecker) { + WEBENGINE_CONFIG+=use_native_spellchecker } } diff --git a/src/core/config/linux.pri b/src/core/config/linux.pri index ee410bdde..1cc6065ac 100644 --- a/src/core/config/linux.pri +++ b/src/core/config/linux.pri @@ -148,7 +148,7 @@ host_build { #use?(system_jsoncpp): gn_args += use_system_jsoncpp=true use?(system_opus): gn_args += use_system_opus=true use?(system_snappy): gn_args += use_system_snappy=true - use?(system_vpx): gn_args += use_system_libvpx=true + use?(system_libvpx): gn_args += use_system_libvpx=true use?(system_icu): gn_args += use_system_icu=true icu_use_data_file=false use?(system_ffmpeg): gn_args += use_system_ffmpeg=true use?(system_re2): gn_args += use_system_re2=true -- GitLab