1 From b544f5f3462e2981ada045a32038b7f116f8590c Mon Sep 17 00:00:00 2001
2 From: Martin Jansa <Martin.Jansa@gmail.com>
3 Date: Sat, 6 Apr 2013 13:15:07 +0200
4 Subject: [PATCH 03/12] Add -external-hostbindir option
6 * when cross-compiling it's sometimes useful to use existing tools from machine
7 (or in OpenEmbedded built with separate native recipe) when building for target
9 * this way we can skip bootstraping tools we already have
11 * qt_functions: temporary remove isEmpty check
12 * now we assume that every build will provide QT_EXTERNAL_HOST_BINS value
13 * isEmpty works correctly only with qmake variables (e.g. $$FOO -
14 isEmpty(FOO)), but doesn't work with system properties like $$[FOO].
16 * cmake: Use OE_QMAKE_PATH_EXTERNAL_HOST_BINS to determine path to host binaries
18 Upstream-Status: Pending
19 is a lot better for upstreaming (and it was already sort of approved by
20 Oswald) but in 5.2.0 I've noticed that he added something similar for
23 Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
24 Signed-off-by: Simon Busch <morphis@gravedo.de>
25 Signed-off-by: Jonathan Liu <net147@gmail.com>
27 configure | 15 +++++++++++++++
28 mkspecs/features/qt_functions.prf | 6 +++++-
29 mkspecs/features/qt_tool.prf | 4 ++--
30 qmake/property.cpp | 1 +
31 qtbase.pro | 14 +++++++++++---
32 src/corelib/Qt5CoreConfigExtras.cmake.in | 6 +++---
33 src/corelib/global/qlibraryinfo.cpp | 3 ++-
34 src/corelib/global/qlibraryinfo.h | 1 +
35 src/dbus/Qt5DBusConfigExtras.cmake.in | 4 ++--
36 src/widgets/Qt5WidgetsConfigExtras.cmake.in | 2 +-
37 tools/configure/configureapp.cpp | 8 ++++++++
38 11 files changed, 51 insertions(+), 13 deletions(-)
40 diff --git a/configure b/configure
41 index d5c2b08..dcd066c 100755
44 @@ -759,6 +759,7 @@ QT_HOST_BINS=
48 +QT_EXTERNAL_HOST_BINS=
50 #flags for SQL drivers
52 @@ -878,6 +879,7 @@ while [ "$#" -gt 0 ]; do
56 + -external-hostbindir| \
60 @@ -1092,6 +1094,9 @@ while [ "$#" -gt 0 ]; do
64 + external-hostbindir)
65 + QT_EXTERNAL_HOST_BINS="$VAL"
68 if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
70 @@ -2230,6 +2235,10 @@ Installation options:
71 -hostdatadir <dir> . Data used by qmake will be installed to <dir>
74 + -external-hostbindir <dir> Use external host executables instead of building them
75 + (not used by defaut)
80 The defaults (*) are usually acceptable. A plus (+) denotes a default value
81 @@ -2897,6 +2906,11 @@ fi
82 # command line and environment validation
83 #-------------------------------------------------------------------------------
85 +# default is empty, don't call makeabs if it is empty
86 +if [ ! -z "$QT_EXTERNAL_HOST_BINS" ]; then
87 + QT_EXTERNAL_HOST_BINS=`"$relpath/config.tests/unix/makeabs" "$QT_EXTERNAL_HOST_BINS"`
90 # update QT_CONFIG to show our current predefined configuration
91 CFG_QCONFIG_PATH=$relpath/src/corelib/global/qconfig-${CFG_QCONFIG}.h
92 case "$CFG_QCONFIG" in
93 @@ -3577,6 +3591,7 @@ static const char qt_configure_prefix_path_strs[][256 + 12] = {
94 "qt_hbinpath=$QT_HOST_BINS",
95 "qt_hlibpath=$QT_HOST_LIBS",
96 "qt_hdatpath=$QT_HOST_DATA",
97 + "qt_ebinpath=$QT_EXTERNAL_HOST_BINS",
98 "qt_targspec=$shortxspec",
99 "qt_hostspec=$shortspec",
101 diff --git a/mkspecs/features/qt_functions.prf b/mkspecs/features/qt_functions.prf
102 index 9a4d80e..dfc1cff 100644
103 --- a/mkspecs/features/qt_functions.prf
104 +++ b/mkspecs/features/qt_functions.prf
105 @@ -193,7 +193,11 @@ defineTest(qtAddRpathLink) {
106 defineTest(qtPrepareTool) {
107 cmd = $$eval(QT_TOOL.$${2}.binary)
109 - cmd = $$[QT_HOST_BINS]/$$2
110 + QT_EXTERNAL_HOST_BINS = $$[QT_EXTERNAL_HOST_BINS]
111 + isEmpty(QT_EXTERNAL_HOST_BINS): \
112 + cmd = $$[QT_HOST_BINS]/$$2
114 + cmd = $$[QT_EXTERNAL_HOST_BINS]/$$2
116 cmd = perl -w $$system_path($${cmd}.pl)
117 } else: contains(QMAKE_HOST.os, Windows) {
118 diff --git a/mkspecs/features/qt_tool.prf b/mkspecs/features/qt_tool.prf
119 index 1d3e88c..9b26adf 100644
120 --- a/mkspecs/features/qt_tool.prf
121 +++ b/mkspecs/features/qt_tool.prf
126 +QT_EXTERNAL_HOST_BINS = $$[QT_EXTERNAL_HOST_BINS]
128 # If we are doing a prefix build, create a "module" pri which enables
129 # qtPrepareTool() to work with the non-installed build.
130 -# Non-bootstrapped tools always need this because of the environment setup.
131 -!build_pass:if(!host_build|!force_bootstrap|force_independent) {
132 +!build_pass:if(!host_build|!force_bootstrap|force_independent):isEmpty(QT_EXTERNAL_HOST_BINS) {
133 isEmpty(MODULE):MODULE = $$TARGET
135 !host_build|!force_bootstrap: MODULE_DEPENDS = $$replace(QT, -private$, _private)
136 diff --git a/qmake/property.cpp b/qmake/property.cpp
137 index e50485c..71291ad 100644
138 --- a/qmake/property.cpp
139 +++ b/qmake/property.cpp
140 @@ -75,6 +75,7 @@ static const struct {
141 { "QT_HOST_DATA", QLibraryInfo::HostDataPath, true },
142 { "QT_HOST_BINS", QLibraryInfo::HostBinariesPath, true },
143 { "QT_HOST_LIBS", QLibraryInfo::HostLibrariesPath, true },
144 + { "QT_EXTERNAL_HOST_BINS", QLibraryInfo::ExternalHostBinariesPath, true },
145 { "QMAKE_SPEC", QLibraryInfo::HostSpecPath, true },
146 { "QMAKE_XSPEC", QLibraryInfo::TargetSpecPath, true },
148 diff --git a/qtbase.pro b/qtbase.pro
149 index d6861cf..7fb58a3 100644
152 @@ -69,18 +69,26 @@ CONFIG -= qt
154 ### installations ####
156 +QT_EXTERNAL_HOST_BINS = $$[QT_EXTERNAL_HOST_BINS]
159 qmake.path = $$[QT_HOST_BINS]
160 +qmake.files = $$OUT_PWD/bin/qmake
161 +!isEmpty(QT_EXTERNAL_HOST_BINS) {
162 + qmake.files = $$[QT_EXTERNAL_HOST_BINS]/bin/qmake
164 equals(QMAKE_HOST.os, Windows) {
165 - qmake.files = $$OUT_PWD/bin/qmake.exe
167 - qmake.files = $$OUT_PWD/bin/qmake
168 + qmake.files = $${qmake.files}.exe
173 syncqt.path = $$[QT_HOST_BINS]
174 syncqt.files = $$PWD/bin/syncqt.pl
175 +syncqt.files = $$PWD/bin/syncqt.pl
176 +!isEmpty(QT_EXTERNAL_HOST_BINS) {
177 + syncqt.files = $$[QT_EXTERNAL_HOST_BINS]/bin/syncqt.pl
181 # If we are doing a prefix build, create a "module" pri which enables
182 diff --git a/src/corelib/Qt5CoreConfigExtras.cmake.in b/src/corelib/Qt5CoreConfigExtras.cmake.in
183 index 9bda70e..6e3605a 100644
184 --- a/src/corelib/Qt5CoreConfigExtras.cmake.in
185 +++ b/src/corelib/Qt5CoreConfigExtras.cmake.in
186 @@ -5,7 +5,7 @@ if (NOT TARGET Qt5::qmake)
187 !!IF isEmpty(CMAKE_BIN_DIR_IS_ABSOLUTE)
188 set(imported_location \"${_qt5Core_install_prefix}/$${CMAKE_BIN_DIR}qmake$$CMAKE_BIN_SUFFIX\")
190 - set(imported_location \"$${CMAKE_BIN_DIR}qmake$$CMAKE_BIN_SUFFIX\")
191 + set(imported_location \"${OE_QMAKE_PATH_EXTERNAL_HOST_BINS}/qmake$$CMAKE_BIN_SUFFIX\")
193 _qt5_Core_check_file_exists(${imported_location})
195 @@ -20,7 +20,7 @@ if (NOT TARGET Qt5::moc)
196 !!IF isEmpty(CMAKE_BIN_DIR_IS_ABSOLUTE)
197 set(imported_location \"${_qt5Core_install_prefix}/$${CMAKE_BIN_DIR}moc$$CMAKE_BIN_SUFFIX\")
199 - set(imported_location \"$${CMAKE_BIN_DIR}moc$$CMAKE_BIN_SUFFIX\")
200 + set(imported_location \"${OE_QMAKE_PATH_EXTERNAL_HOST_BINS}/moc$$CMAKE_BIN_SUFFIX\")
202 _qt5_Core_check_file_exists(${imported_location})
204 @@ -37,7 +37,7 @@ if (NOT TARGET Qt5::rcc)
205 !!IF isEmpty(CMAKE_BIN_DIR_IS_ABSOLUTE)
206 set(imported_location \"${_qt5Core_install_prefix}/$${CMAKE_BIN_DIR}rcc$$CMAKE_BIN_SUFFIX\")
208 - set(imported_location \"$${CMAKE_BIN_DIR}rcc$$CMAKE_BIN_SUFFIX\")
209 + set(imported_location \"${OE_QMAKE_PATH_EXTERNAL_HOST_BINS}/rcc$$CMAKE_BIN_SUFFIX\")
211 _qt5_Core_check_file_exists(${imported_location})
213 diff --git a/src/corelib/global/qlibraryinfo.cpp b/src/corelib/global/qlibraryinfo.cpp
214 index 174c1d0..1fe03cb 100644
215 --- a/src/corelib/global/qlibraryinfo.cpp
216 +++ b/src/corelib/global/qlibraryinfo.cpp
217 @@ -333,7 +333,7 @@ QLibraryInfo::isDebugBuild()
220 static const struct {
221 - char key[19], value[13];
222 + char key[21], value[13];
223 } qtConfEntries[] = {
225 { "Documentation", "doc" }, // should be ${Data}/doc
226 @@ -359,6 +359,7 @@ static const struct {
227 { "HostBinaries", "bin" },
228 { "HostLibraries", "lib" },
230 + { "ExternalHostBinaries", "" },
231 { "TargetSpec", "" },
234 diff --git a/src/corelib/global/qlibraryinfo.h b/src/corelib/global/qlibraryinfo.h
235 index 0b573c2..b5535ee 100644
236 --- a/src/corelib/global/qlibraryinfo.h
237 +++ b/src/corelib/global/qlibraryinfo.h
238 @@ -88,6 +88,7 @@ public:
242 + ExternalHostBinariesPath,
245 LastHostPath = HostSpecPath,
246 diff --git a/src/dbus/Qt5DBusConfigExtras.cmake.in b/src/dbus/Qt5DBusConfigExtras.cmake.in
247 index 1d94715..301af8f 100644
248 --- a/src/dbus/Qt5DBusConfigExtras.cmake.in
249 +++ b/src/dbus/Qt5DBusConfigExtras.cmake.in
250 @@ -5,7 +5,7 @@ if (NOT TARGET Qt5::qdbuscpp2xml)
251 !!IF isEmpty(CMAKE_BIN_DIR_IS_ABSOLUTE)
252 set(imported_location \"${_qt5DBus_install_prefix}/$${CMAKE_BIN_DIR}qdbuscpp2xml$$CMAKE_BIN_SUFFIX\")
254 - set(imported_location \"$${CMAKE_BIN_DIR}qdbuscpp2xml$$CMAKE_BIN_SUFFIX\")
255 + set(imported_location \"${OE_QMAKE_PATH_EXTERNAL_HOST_BINS}/qdbuscpp2xml$$CMAKE_BIN_SUFFIX\")
257 _qt5_DBus_check_file_exists(${imported_location})
259 @@ -20,7 +20,7 @@ if (NOT TARGET Qt5::qdbusxml2cpp)
260 !!IF isEmpty(CMAKE_BIN_DIR_IS_ABSOLUTE)
261 set(imported_location \"${_qt5DBus_install_prefix}/$${CMAKE_BIN_DIR}qdbusxml2cpp$$CMAKE_BIN_SUFFIX\")
263 - set(imported_location \"$${CMAKE_BIN_DIR}qdbusxml2cpp$$CMAKE_BIN_SUFFIX\")
264 + set(imported_location \"${OE_QMAKE_PATH_EXTERNAL_HOST_BINS}/qdbusxml2cpp$$CMAKE_BIN_SUFFIX\")
266 _qt5_DBus_check_file_exists(${imported_location})
268 diff --git a/src/widgets/Qt5WidgetsConfigExtras.cmake.in b/src/widgets/Qt5WidgetsConfigExtras.cmake.in
269 index 99d87e2..5621dc0 100644
270 --- a/src/widgets/Qt5WidgetsConfigExtras.cmake.in
271 +++ b/src/widgets/Qt5WidgetsConfigExtras.cmake.in
272 @@ -5,7 +5,7 @@ if (NOT TARGET Qt5::uic)
273 !!IF isEmpty(CMAKE_BIN_DIR_IS_ABSOLUTE)
274 set(imported_location \"${_qt5Widgets_install_prefix}/$${CMAKE_BIN_DIR}uic$$CMAKE_BIN_SUFFIX\")
276 - set(imported_location \"$${CMAKE_BIN_DIR}uic$$CMAKE_BIN_SUFFIX\")
277 + set(imported_location \"${OE_QMAKE_PATH_EXTERNAL_HOST_BINS}/uic$$CMAKE_BIN_SUFFIX\")
279 _qt5_Widgets_check_file_exists(${imported_location})
281 diff --git a/tools/configure/configureapp.cpp b/tools/configure/configureapp.cpp
282 index b756509..7e61845 100644
283 --- a/tools/configure/configureapp.cpp
284 +++ b/tools/configure/configureapp.cpp
285 @@ -1213,6 +1213,13 @@ void Configure::parseCmdLine()
286 dictionary[ "QT_EXT_PREFIX" ] = configCmdLine.at(i);
289 + else if (configCmdLine.at(i) == "-external-hostbindir") {
293 + dictionary[ "QT_EXTERNAL_HOST_BINS" ] = configCmdLine.at(i);
296 else if (configCmdLine.at(i) == "-make-tool") {
299 @@ -3983,6 +3990,7 @@ void Configure::generateQConfigCpp()
300 << " \"qt_hbinpath=" << formatPath(dictionary["QT_HOST_BINS"]) << "\"," << endl
301 << " \"qt_hlibpath=" << formatPath(dictionary["QT_HOST_LIBS"]) << "\"," << endl
302 << " \"qt_hdatpath=" << formatPath(dictionary["QT_HOST_DATA"]) << "\"," << endl
303 + << " \"qt_ebinpath=" << formatPath(dictionary["QT_EXTERNAL_HOST_BINS"]) << "\"," << endl
304 << " \"qt_targspec=" << targSpec << "\"," << endl
305 << " \"qt_hostspec=" << hostSpec << "\"," << endl