summaryrefslogtreecommitdiffstats
path: root/mkspecs/features/configure.prf
blob: c1e919603b0d114733108c4ed50ecc0f4cd44977 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
# Load configure.prf from qtbase first
load(configure)
load(functions)

defineTest(runConfigure) {
    webengine_successfully_configured: return(true)
    linux:contains(QT_CONFIG,no-pkg-config) {
        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)
    }

    isQtMinimum(5, 8) {
        include($$QTWEBENGINE_OUT_ROOT/qtwebengine-config.pri)
        QT_FOR_CONFIG += webengine-private

        qtConfig(pepper-plugins): WEBENGINE_CONFIG += use_pepper_plugins
        qtConfig(printing-and-pdf): WEBENGINE_CONFIG += use_printing use_pdf
        qtConfig(proprietary-codecs): WEBENGINE_CONFIG += use_proprietary_codecs
        qtConfig(spellchecker): WEBENGINE_CONFIG += use_spellchecker
        qtConfig(webrtc): WEBENGINE_CONFIG += use_webrtc
        qtConfig(embedded): WEBENGINE_CONFIG += embedded_build
        qtConfig(system-webp): WEBENGINE_CONFIG += use_system_libwebp
        qtConfig(system-opus): WEBENGINE_CONFIG += use_system_opus
        qtConfig(system-ffmpeg): WEBENGINE_CONFIG += use_system_ffmpeg
        qtConfig(system-icu): WEBENGINE_CONFIG += use_system_icu
        !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
        !contains(WEBENGINE_CONFIG, use_system_icu): WEBENGINE_CONFIG += use_bundled_icu
    } else {
        # Feature defaults when building with Qt 5.6 LTS:
        cross_compile {
            WEBENGINE_CONFIG += embedded_build reduce_binary_size
        } else {
            WEBENGINE_CONFIG += use_spellchecker use_webrtc use_pepper_plugins use_printing use_pdf
        }
    }
    isQtMinimum(5, 9) {
        qtConfig(appstore-compliant): WEBENGINE_CONFIG += use_appstore_compliant_code
        optimize_size: WEBENGINE_CONFIG += reduce_binary_size
    } else {
        qtConfig(embedded): WEBENGINE_CONFIG += reduce_binary_size
    }

    linux {
        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): REQUIRED_PACKAGES += libpng
        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
        }

        for(package, $$list($$REQUIRED_PACKAGES)) {
            !packagesExist($$package):skipBuild("Unmet dependency: $$package")
        }
        packagesExist(minizip, zlib): WEBENGINE_CONFIG += use_system_minizip use_system_zlib
        else: log("System zlib or minizip not found. Using Chromium's copies.$${EOL}")
        !isQtMinimum(5, 8) {
            packagesExist(libwebp,libwebpdemux): WEBENGINE_CONFIG += use_system_libwebp use_system_libwebpdemux
            else: log("System libwebp or libwebpdemux not found. Using Chromium's copies.$${EOL}")
            packagesExist(opus): WEBENGINE_CONFIG += use_system_opus
            else: log("System opus not found. Using Chromium's copy.$${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}")
            }
        }
        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
            }
        }
        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
            }
        }
        config_libvpx: WEBENGINE_CONFIG += use_system_vpx
        else {
            log("Compatible system libvpx not found. Using Chromium's copy.$${EOL}")
            WEBENGINE_CONFIG += use_bundled_libvpx
        }
        config_srtp: WEBENGINE_CONFIG += use_system_libsrtp
        else {
            log("System libsrtp not found. Using Chromium's copy.$${EOL}")
            WEBENGINE_CONFIG += use_bundled_srtp
        }
        config_snappy: WEBENGINE_CONFIG += use_system_snappy
        else {
            log("System snappy not found. Using Chromium's copy.$${EOL}")
            WEBENGINE_CONFIG += use_bundled_snappy
        }

        packagesExist(nss): WEBENGINE_CONFIG += use_nss
        else: log("System NSS not found, BoringSSL will be used.$${EOL}")
    }

    win32 {
        !config_winversion: skipBuild("Needs VS 2015 Update 3 with Cumulative Servicing Release or higher")
    }

    isEmpty(skipBuildReason): {
        cache(CONFIG, add, $$list(webengine_successfully_configured))
        !isEmpty(WEBENGINE_CONFIG) {
            cache(WEBENGINE_CONFIG, add, $$list($$WEBENGINE_CONFIG))
            export(WEBENGINE_CONFIG)
        }
        # Set a global WEBENGINE_ARCH for the target architecture we can also read from option(host_build)
        WEBENGINE_ARCH = $$QT_ARCH
        cache(WEBENGINE_ARCH)
        export(WEBENGINE_ARCH)
    }

    unix:!darwin {
        log("System library dependencies:$${EOL}")
        !isQtMinimum(5, 8) {
            use?(system_icu) {
                packagesExist("\'icu-uc >= 53\', \'icu-i18n >= 53\'") {
                    log("  ICU ................................ Using system version$${EOL}")
                } else {
                    log("  ICU ................................ System ICU not found$${EOL}")
                    skipBuild("Unmet dependencies: icu-uc, icu-i18n")
                }
            } else {
                log("  ICU ................................ Using internal copy (Default, force system ICU with WEBENGINE_CONFIG+=use_system_icu)$${EOL}")
                WEBENGINE_CONFIG += use_bundled_icu
            }
            use?(system_ffmpeg) {
                packagesExist("libavcodec libavformat libavutil") {
                    packagesExist("libwebp, libwebpdemux, opus, \'vpx >= 1.4\'"){
                        log("  FFMPEG ............................. Using system version$${EOL}")
                    } else {
                        log("  FFMPEG ............................. Conflicting FFMPEG dependencies$${EOL}")
                        skipBuild("Unmet dependencies: opus, vpx, libwebp, libwebpdemux")
                    }
                } else {
                    log("  FFMPEG ............................. System FFMPEG not found$${EOL}")
                    skipBuild("Unmet dependencies: libavcodec, libavformat, libavutil")
                }
            } else {
                log("  FFMPEG ............................. Using internal copy (Default, force system FFMPEG with WEBENGINE_CONFIG+=use_system_ffmpeg)$${EOL}")
                WEBENGINE_CONFIG += use_bundled_ffmpeg
            }
        }
        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}")
    use?(proprietary_codecs) {
        log("  Proprietary codecs (H264, MP3) ..... Enabled$${EOL}")
    } else {
        log("  Proprietary codecs (H264, MP3) ..... Not enabled         (Default, enable with -proprietary-codecs)$${EOL}")
    }
    qtHaveModule(positioning): {
        log("  Geolocation ........................ Enabled$${EOL}")
    } else {
        log("  Geolocation ........................ Not enabled         (Requires Qt Positioning module)$${EOL}")
    }
    unix:!darwin {
        use?(nss) {
            log("  Certificate handling ............... Using system NSS$${EOL}")
        } else {
            log("  Certificate handling ............... Using bundled BoringSSL$${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}")
        }
    }
}