summaryrefslogtreecommitdiffstats
path: root/recipes-qt/qt5/qtbase-git/0003-Add-external-hostbindir-option.patch
blob: 44d17ca6d44419e7f1b5eaa3e4799e1973d076da (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
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
From b45d963702c139ea4f5b5ce572d046511a878d81 Mon Sep 17 00:00:00 2001
From: Martin Jansa <Martin.Jansa@gmail.com>
Date: Sat, 6 Apr 2013 13:15:07 +0200
Subject: [PATCH 03/12] Add -external-hostbindir option

* when cross-compiling it's sometimes useful to use existing tools from machine
  (or in OpenEmbedded built with separate native recipe) when building for target

* this way we can skip bootstraping tools we already have

* qt_functions: temporary remove isEmpty check
* now we assume that every build will provide QT_EXTERNAL_HOST_BINS value
* isEmpty works correctly only with qmake variables (e.g. $$FOO -
  isEmpty(FOO)), but doesn't work with system properties like $$[FOO].

* cmake: Use OE_QMAKE_PATH_EXTERNAL_HOST_BINS to determine path to host binaries

Upstream-Status: Pending
  is a lot better for upstreaming (and it was already sort of approved by
  Oswald) but in 5.2.0 I've noticed that he added something similar for
  android builds

Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
Signed-off-by: Simon Busch <morphis@gravedo.de>
---
 configure                                   | 15 +++++++++++++++
 mkspecs/features/qt_functions.prf           |  2 +-
 mkspecs/features/qt_tool.prf                |  3 +--
 qmake/property.cpp                          |  1 +
 qtbase.pro                                  | 12 +++++++++---
 src/corelib/Qt5CoreConfigExtras.cmake.in    |  6 +++---
 src/corelib/global/qlibraryinfo.cpp         |  3 ++-
 src/corelib/global/qlibraryinfo.h           |  1 +
 src/dbus/Qt5DBusConfigExtras.cmake.in       |  4 ++--
 src/widgets/Qt5WidgetsConfigExtras.cmake.in |  2 +-
 tools/configure/configureapp.cpp            |  8 ++++++++
 11 files changed, 44 insertions(+), 13 deletions(-)

diff --git a/configure b/configure
index 4eae0d3..48d5119 100755
--- a/configure
+++ b/configure
@@ -777,6 +777,7 @@ QT_HOST_BINS=
 QT_HOST_LIBS=
 QT_HOST_DATA=
 QT_EXT_PREFIX=
+QT_EXTERNAL_HOST_BINS=
 
 #flags for SQL drivers
 QT_CFLAGS_PSQL=
@@ -896,6 +897,7 @@ while [ "$#" -gt 0 ]; do
     -testsdir| \
     -hostdatadir| \
     -hostbindir| \
+    -external-hostbindir| \
     -hostlibdir| \
     -extprefix| \
     -sysroot| \
@@ -1110,6 +1112,9 @@ while [ "$#" -gt 0 ]; do
     extprefix)
         QT_EXT_PREFIX="$VAL"
         ;;
+    external-hostbindir)
+        QT_EXTERNAL_HOST_BINS="$VAL"
+        ;;
     pkg-config)
         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
             CFG_PKGCONFIG="$VAL"
@@ -2248,6 +2253,10 @@ Installation options:
     -hostdatadir <dir> . Data used by qmake will be installed to <dir>
                          (default HOSTPREFIX)
 
+    -external-hostbindir <dir> Use external host executables instead of building them
+                         (not used by defaut)
+
+
 Configure options:
 
  The defaults (*) are usually acceptable. A plus (+) denotes a default value
@@ -2915,6 +2924,11 @@ fi
 # command line and environment validation
 #-------------------------------------------------------------------------------
 
+# default is empty, don't call makeabs if it is empty
+if [ ! -z "$QT_EXTERNAL_HOST_BINS" ]; then
+    QT_EXTERNAL_HOST_BINS=`"$relpath/config.tests/unix/makeabs" "$QT_EXTERNAL_HOST_BINS"`
+fi
+
 # update QT_CONFIG to show our current predefined configuration
 CFG_QCONFIG_PATH=$relpath/src/corelib/global/qconfig-${CFG_QCONFIG}.h
 case "$CFG_QCONFIG" in
@@ -3595,6 +3609,7 @@ static const char qt_configure_prefix_path_strs[][256 + 12] = {
     "qt_hbinpath=$QT_HOST_BINS",
     "qt_hlibpath=$QT_HOST_LIBS",
     "qt_hdatpath=$QT_HOST_DATA",
+    "qt_ebinpath=$QT_EXTERNAL_HOST_BINS",
     "qt_targspec=$shortxspec",
     "qt_hostspec=$shortspec",
 #endif
diff --git a/mkspecs/features/qt_functions.prf b/mkspecs/features/qt_functions.prf
index d41fe3b..050a4a7 100644
--- a/mkspecs/features/qt_functions.prf
+++ b/mkspecs/features/qt_functions.prf
@@ -193,7 +193,7 @@ defineTest(qtAddRpathLink) {
 defineTest(qtPrepareTool) {
     cmd = $$eval(QT_TOOL.$${2}.binary)
     isEmpty(cmd) {
-        cmd = $$[QT_HOST_BINS]/$$2
+        cmd = $$[QT_EXTERNAL_HOST_BINS]/$$2
         exists($${cmd}.pl) {
             cmd = perl -w $$system_path($${cmd}.pl)
         } else: contains(QMAKE_HOST.os, Windows) {
diff --git a/mkspecs/features/qt_tool.prf b/mkspecs/features/qt_tool.prf
index 1d3e88c..bd44754 100644
--- a/mkspecs/features/qt_tool.prf
+++ b/mkspecs/features/qt_tool.prf
@@ -15,8 +15,7 @@ CONFIG += console
 
 # If we are doing a prefix build, create a "module" pri which enables
 # qtPrepareTool() to work with the non-installed build.
-# Non-bootstrapped tools always need this because of the environment setup.
-!build_pass:if(!host_build|!force_bootstrap|force_independent) {
+!build_pass:if(!host_build|!force_bootstrap|force_independent):!exists($$[QT_EXTERNAL_HOST_BINS]) {
     isEmpty(MODULE):MODULE = $$TARGET
 
     !host_build|!force_bootstrap: MODULE_DEPENDS = $$replace(QT, -private$, _private)
diff --git a/qmake/property.cpp b/qmake/property.cpp
index e50485c..71291ad 100644
--- a/qmake/property.cpp
+++ b/qmake/property.cpp
@@ -75,6 +75,7 @@ static const struct {
     { "QT_HOST_DATA", QLibraryInfo::HostDataPath, true },
     { "QT_HOST_BINS", QLibraryInfo::HostBinariesPath, true },
     { "QT_HOST_LIBS", QLibraryInfo::HostLibrariesPath, true },
+    { "QT_EXTERNAL_HOST_BINS", QLibraryInfo::ExternalHostBinariesPath, true },
     { "QMAKE_SPEC", QLibraryInfo::HostSpecPath, true },
     { "QMAKE_XSPEC", QLibraryInfo::TargetSpecPath, true },
 };
diff --git a/qtbase.pro b/qtbase.pro
index d6861cf..92e6a83 100644
--- a/qtbase.pro
+++ b/qtbase.pro
@@ -71,16 +71,22 @@ CONFIG -= qt
 
 #qmake
 qmake.path = $$[QT_HOST_BINS]
+qmake.files = $$OUT_PWD/bin/qmake
+!isEmpty($$[QT_EXTERNAL_HOST_BINS]) {
+   qmake.files = $$[QT_EXTERNAL_HOST_BINS]/bin/qmake
+}
 equals(QMAKE_HOST.os, Windows) {
-   qmake.files = $$OUT_PWD/bin/qmake.exe
-} else {
-   qmake.files = $$OUT_PWD/bin/qmake
+   qmake.files = $${qmake.files}.exe
 }
 INSTALLS += qmake
 
 #syncqt
 syncqt.path = $$[QT_HOST_BINS]
 syncqt.files = $$PWD/bin/syncqt.pl
+syncqt.files = $$PWD/bin/syncqt.pl
+!isEmpty($$[QT_EXTERNAL_HOST_BINS]) {
+   syncqt.files = $$[QT_EXTERNAL_HOST_BINS]/bin/syncqt.pl
+}
 INSTALLS += syncqt
 
 # If we are doing a prefix build, create a "module" pri which enables
diff --git a/src/corelib/Qt5CoreConfigExtras.cmake.in b/src/corelib/Qt5CoreConfigExtras.cmake.in
index 9bda70e..6e3605a 100644
--- a/src/corelib/Qt5CoreConfigExtras.cmake.in
+++ b/src/corelib/Qt5CoreConfigExtras.cmake.in
@@ -5,7 +5,7 @@ if (NOT TARGET Qt5::qmake)
 !!IF isEmpty(CMAKE_BIN_DIR_IS_ABSOLUTE)
     set(imported_location \"${_qt5Core_install_prefix}/$${CMAKE_BIN_DIR}qmake$$CMAKE_BIN_SUFFIX\")
 !!ELSE
-    set(imported_location \"$${CMAKE_BIN_DIR}qmake$$CMAKE_BIN_SUFFIX\")
+    set(imported_location \"${OE_QMAKE_PATH_EXTERNAL_HOST_BINS}/qmake$$CMAKE_BIN_SUFFIX\")
 !!ENDIF
     _qt5_Core_check_file_exists(${imported_location})
 
@@ -20,7 +20,7 @@ if (NOT TARGET Qt5::moc)
 !!IF isEmpty(CMAKE_BIN_DIR_IS_ABSOLUTE)
     set(imported_location \"${_qt5Core_install_prefix}/$${CMAKE_BIN_DIR}moc$$CMAKE_BIN_SUFFIX\")
 !!ELSE
-    set(imported_location \"$${CMAKE_BIN_DIR}moc$$CMAKE_BIN_SUFFIX\")
+    set(imported_location \"${OE_QMAKE_PATH_EXTERNAL_HOST_BINS}/moc$$CMAKE_BIN_SUFFIX\")
 !!ENDIF
     _qt5_Core_check_file_exists(${imported_location})
 
@@ -37,7 +37,7 @@ if (NOT TARGET Qt5::rcc)
 !!IF isEmpty(CMAKE_BIN_DIR_IS_ABSOLUTE)
     set(imported_location \"${_qt5Core_install_prefix}/$${CMAKE_BIN_DIR}rcc$$CMAKE_BIN_SUFFIX\")
 !!ELSE
-    set(imported_location \"$${CMAKE_BIN_DIR}rcc$$CMAKE_BIN_SUFFIX\")
+    set(imported_location \"${OE_QMAKE_PATH_EXTERNAL_HOST_BINS}/rcc$$CMAKE_BIN_SUFFIX\")
 !!ENDIF
     _qt5_Core_check_file_exists(${imported_location})
 
diff --git a/src/corelib/global/qlibraryinfo.cpp b/src/corelib/global/qlibraryinfo.cpp
index 80e0f30..89e13cf 100644
--- a/src/corelib/global/qlibraryinfo.cpp
+++ b/src/corelib/global/qlibraryinfo.cpp
@@ -336,7 +336,7 @@ QLibraryInfo::isDebugBuild()
  */
 
 static const struct {
-    char key[19], value[13];
+    char key[21], value[13];
 } qtConfEntries[] = {
     { "Prefix", "." },
     { "Documentation", "doc" }, // should be ${Data}/doc
@@ -362,6 +362,7 @@ static const struct {
     { "HostBinaries", "bin" },
     { "HostLibraries", "lib" },
     { "HostData", "." },
+    { "ExternalHostBinaries", "" },
     { "TargetSpec", "" },
     { "HostSpec", "" },
 #endif
diff --git a/src/corelib/global/qlibraryinfo.h b/src/corelib/global/qlibraryinfo.h
index 0b573c2..b5535ee 100644
--- a/src/corelib/global/qlibraryinfo.h
+++ b/src/corelib/global/qlibraryinfo.h
@@ -88,6 +88,7 @@ public:
         HostBinariesPath,
         HostLibrariesPath,
         HostDataPath,
+        ExternalHostBinariesPath,
         TargetSpecPath,
         HostSpecPath,
         LastHostPath = HostSpecPath,
diff --git a/src/dbus/Qt5DBusConfigExtras.cmake.in b/src/dbus/Qt5DBusConfigExtras.cmake.in
index 1d94715..301af8f 100644
--- a/src/dbus/Qt5DBusConfigExtras.cmake.in
+++ b/src/dbus/Qt5DBusConfigExtras.cmake.in
@@ -5,7 +5,7 @@ if (NOT TARGET Qt5::qdbuscpp2xml)
 !!IF isEmpty(CMAKE_BIN_DIR_IS_ABSOLUTE)
     set(imported_location \"${_qt5DBus_install_prefix}/$${CMAKE_BIN_DIR}qdbuscpp2xml$$CMAKE_BIN_SUFFIX\")
 !!ELSE
-    set(imported_location \"$${CMAKE_BIN_DIR}qdbuscpp2xml$$CMAKE_BIN_SUFFIX\")
+    set(imported_location \"${OE_QMAKE_PATH_EXTERNAL_HOST_BINS}/qdbuscpp2xml$$CMAKE_BIN_SUFFIX\")
 !!ENDIF
     _qt5_DBus_check_file_exists(${imported_location})
 
@@ -20,7 +20,7 @@ if (NOT TARGET Qt5::qdbusxml2cpp)
 !!IF isEmpty(CMAKE_BIN_DIR_IS_ABSOLUTE)
     set(imported_location \"${_qt5DBus_install_prefix}/$${CMAKE_BIN_DIR}qdbusxml2cpp$$CMAKE_BIN_SUFFIX\")
 !!ELSE
-    set(imported_location \"$${CMAKE_BIN_DIR}qdbusxml2cpp$$CMAKE_BIN_SUFFIX\")
+    set(imported_location \"${OE_QMAKE_PATH_EXTERNAL_HOST_BINS}/qdbusxml2cpp$$CMAKE_BIN_SUFFIX\")
 !!ENDIF
     _qt5_DBus_check_file_exists(${imported_location})
 
diff --git a/src/widgets/Qt5WidgetsConfigExtras.cmake.in b/src/widgets/Qt5WidgetsConfigExtras.cmake.in
index 99d87e2..5621dc0 100644
--- a/src/widgets/Qt5WidgetsConfigExtras.cmake.in
+++ b/src/widgets/Qt5WidgetsConfigExtras.cmake.in
@@ -5,7 +5,7 @@ if (NOT TARGET Qt5::uic)
 !!IF isEmpty(CMAKE_BIN_DIR_IS_ABSOLUTE)
     set(imported_location \"${_qt5Widgets_install_prefix}/$${CMAKE_BIN_DIR}uic$$CMAKE_BIN_SUFFIX\")
 !!ELSE
-    set(imported_location \"$${CMAKE_BIN_DIR}uic$$CMAKE_BIN_SUFFIX\")
+    set(imported_location \"${OE_QMAKE_PATH_EXTERNAL_HOST_BINS}/uic$$CMAKE_BIN_SUFFIX\")
 !!ENDIF
     _qt5_Widgets_check_file_exists(${imported_location})
 
diff --git a/tools/configure/configureapp.cpp b/tools/configure/configureapp.cpp
index b756509..7e61845 100644
--- a/tools/configure/configureapp.cpp
+++ b/tools/configure/configureapp.cpp
@@ -1213,6 +1213,13 @@ void Configure::parseCmdLine()
             dictionary[ "QT_EXT_PREFIX" ] = configCmdLine.at(i);
         }
 
+        else if (configCmdLine.at(i) == "-external-hostbindir") {
+            ++i;
+            if (i == argCount)
+                break;
+            dictionary[ "QT_EXTERNAL_HOST_BINS" ] = configCmdLine.at(i);
+        }
+
         else if (configCmdLine.at(i) == "-make-tool") {
             ++i;
             if (i == argCount)
@@ -3983,6 +3990,7 @@ void Configure::generateQConfigCpp()
                   << "    \"qt_hbinpath=" << formatPath(dictionary["QT_HOST_BINS"]) << "\"," << endl
                   << "    \"qt_hlibpath=" << formatPath(dictionary["QT_HOST_LIBS"]) << "\"," << endl
                   << "    \"qt_hdatpath=" << formatPath(dictionary["QT_HOST_DATA"]) << "\"," << endl
+                  << "    \"qt_ebinpath=" << formatPath(dictionary["QT_EXTERNAL_HOST_BINS"]) << "\"," << endl
                   << "    \"qt_targspec=" << targSpec << "\"," << endl
                   << "    \"qt_hostspec=" << hostSpec << "\"," << endl
                   << "#endif" << endl
-- 
2.0.0