qtbase: fix path to external hostbindir binaries
[scm/bb/tizen-distro.git] / meta-qt5 / recipes-qt / qt5 / qtbase / 0003-Add-external-hostbindir-option.patch
1 From e263260c50051327e3f7f2ca8c46e014228e0078 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/13] Add -external-hostbindir option
5
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
8
9 * this way we can skip bootstraping tools we already have
10
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].
15
16 * cmake: Use OE_QMAKE_PATH_EXTERNAL_HOST_BINS to determine path to host binaries
17
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
21   android builds
22
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>
26 ---
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(-)
39
40 diff --git a/configure b/configure
41 index 3f7b41b..18d1a0b 100755
42 --- a/configure
43 +++ b/configure
44 @@ -777,6 +777,7 @@ QT_HOST_BINS=
45  QT_HOST_LIBS=
46  QT_HOST_DATA=
47  QT_EXT_PREFIX=
48 +QT_EXTERNAL_HOST_BINS=
49  
50  #flags for SQL drivers
51  QT_CFLAGS_PSQL=
52 @@ -896,6 +897,7 @@ while [ "$#" -gt 0 ]; do
53      -testsdir| \
54      -hostdatadir| \
55      -hostbindir| \
56 +    -external-hostbindir| \
57      -hostlibdir| \
58      -extprefix| \
59      -sysroot| \
60 @@ -1110,6 +1112,9 @@ while [ "$#" -gt 0 ]; do
61      extprefix)
62          QT_EXT_PREFIX="$VAL"
63          ;;
64 +    external-hostbindir)
65 +        QT_EXTERNAL_HOST_BINS="$VAL"
66 +        ;;
67      pkg-config)
68          if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
69              CFG_PKGCONFIG="$VAL"
70 @@ -2248,6 +2253,10 @@ Installation options:
71      -hostdatadir <dir> . Data used by qmake will be installed to <dir>
72                           (default HOSTPREFIX)
73  
74 +    -external-hostbindir <dir> Use external host executables instead of building them
75 +                         (not used by defaut)
76 +
77 +
78  Configure options:
79  
80   The defaults (*) are usually acceptable. A plus (+) denotes a default value
81 @@ -2915,6 +2924,11 @@ fi
82  # command line and environment validation
83  #-------------------------------------------------------------------------------
84  
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"`
88 +fi
89 +
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 @@ -3595,6 +3609,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",
100  #endif
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)
108      isEmpty(cmd) {
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
113 +        else: \
114 +            cmd = $$[QT_EXTERNAL_HOST_BINS]/$$2
115          exists($${cmd}.pl) {
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
122 @@ -12,11 +12,11 @@
123  load(qt_app)
124  
125  CONFIG += console
126 +QT_EXTERNAL_HOST_BINS = $$[QT_EXTERNAL_HOST_BINS]
127  
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
134  
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 },
147  };
148 diff --git a/qtbase.pro b/qtbase.pro
149 index d6861cf..7fb58a3 100644
150 --- a/qtbase.pro
151 +++ b/qtbase.pro
152 @@ -69,18 +69,25 @@ CONFIG -= qt
153  
154  ### installations ####
155  
156 +QT_EXTERNAL_HOST_BINS = $$[QT_EXTERNAL_HOST_BINS]
157 +
158  #qmake
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]/qmake
163 +}
164  equals(QMAKE_HOST.os, Windows) {
165 -   qmake.files = $$OUT_PWD/bin/qmake.exe
166 -} else {
167 -   qmake.files = $$OUT_PWD/bin/qmake
168 +   qmake.files = $${qmake.files}.exe
169  }
170  INSTALLS += qmake
171  
172  #syncqt
173  syncqt.path = $$[QT_HOST_BINS]
174  syncqt.files = $$PWD/bin/syncqt.pl
175 +!isEmpty(QT_EXTERNAL_HOST_BINS) {
176 +   syncqt.files = $$[QT_EXTERNAL_HOST_BINS]/syncqt.pl
177 +}
178  INSTALLS += syncqt
179  
180  # If we are doing a prefix build, create a "module" pri which enables
181 diff --git a/src/corelib/Qt5CoreConfigExtras.cmake.in b/src/corelib/Qt5CoreConfigExtras.cmake.in
182 index 9bda70e..6e3605a 100644
183 --- a/src/corelib/Qt5CoreConfigExtras.cmake.in
184 +++ b/src/corelib/Qt5CoreConfigExtras.cmake.in
185 @@ -5,7 +5,7 @@ if (NOT TARGET Qt5::qmake)
186  !!IF isEmpty(CMAKE_BIN_DIR_IS_ABSOLUTE)
187      set(imported_location \"${_qt5Core_install_prefix}/$${CMAKE_BIN_DIR}qmake$$CMAKE_BIN_SUFFIX\")
188  !!ELSE
189 -    set(imported_location \"$${CMAKE_BIN_DIR}qmake$$CMAKE_BIN_SUFFIX\")
190 +    set(imported_location \"${OE_QMAKE_PATH_EXTERNAL_HOST_BINS}/qmake$$CMAKE_BIN_SUFFIX\")
191  !!ENDIF
192      _qt5_Core_check_file_exists(${imported_location})
193  
194 @@ -20,7 +20,7 @@ if (NOT TARGET Qt5::moc)
195  !!IF isEmpty(CMAKE_BIN_DIR_IS_ABSOLUTE)
196      set(imported_location \"${_qt5Core_install_prefix}/$${CMAKE_BIN_DIR}moc$$CMAKE_BIN_SUFFIX\")
197  !!ELSE
198 -    set(imported_location \"$${CMAKE_BIN_DIR}moc$$CMAKE_BIN_SUFFIX\")
199 +    set(imported_location \"${OE_QMAKE_PATH_EXTERNAL_HOST_BINS}/moc$$CMAKE_BIN_SUFFIX\")
200  !!ENDIF
201      _qt5_Core_check_file_exists(${imported_location})
202  
203 @@ -37,7 +37,7 @@ if (NOT TARGET Qt5::rcc)
204  !!IF isEmpty(CMAKE_BIN_DIR_IS_ABSOLUTE)
205      set(imported_location \"${_qt5Core_install_prefix}/$${CMAKE_BIN_DIR}rcc$$CMAKE_BIN_SUFFIX\")
206  !!ELSE
207 -    set(imported_location \"$${CMAKE_BIN_DIR}rcc$$CMAKE_BIN_SUFFIX\")
208 +    set(imported_location \"${OE_QMAKE_PATH_EXTERNAL_HOST_BINS}/rcc$$CMAKE_BIN_SUFFIX\")
209  !!ENDIF
210      _qt5_Core_check_file_exists(${imported_location})
211  
212 diff --git a/src/corelib/global/qlibraryinfo.cpp b/src/corelib/global/qlibraryinfo.cpp
213 index 69e614f..a95ca35 100644
214 --- a/src/corelib/global/qlibraryinfo.cpp
215 +++ b/src/corelib/global/qlibraryinfo.cpp
216 @@ -336,7 +336,7 @@ QLibraryInfo::isDebugBuild()
217   */
218  
219  static const struct {
220 -    char key[19], value[13];
221 +    char key[21], value[13];
222  } qtConfEntries[] = {
223      { "Prefix", "." },
224      { "Documentation", "doc" }, // should be ${Data}/doc
225 @@ -362,6 +362,7 @@ static const struct {
226      { "HostBinaries", "bin" },
227      { "HostLibraries", "lib" },
228      { "HostData", "." },
229 +    { "ExternalHostBinaries", "" },
230      { "TargetSpec", "" },
231      { "HostSpec", "" },
232  #endif
233 diff --git a/src/corelib/global/qlibraryinfo.h b/src/corelib/global/qlibraryinfo.h
234 index 0b573c2..b5535ee 100644
235 --- a/src/corelib/global/qlibraryinfo.h
236 +++ b/src/corelib/global/qlibraryinfo.h
237 @@ -88,6 +88,7 @@ public:
238          HostBinariesPath,
239          HostLibrariesPath,
240          HostDataPath,
241 +        ExternalHostBinariesPath,
242          TargetSpecPath,
243          HostSpecPath,
244          LastHostPath = HostSpecPath,
245 diff --git a/src/dbus/Qt5DBusConfigExtras.cmake.in b/src/dbus/Qt5DBusConfigExtras.cmake.in
246 index 1d94715..301af8f 100644
247 --- a/src/dbus/Qt5DBusConfigExtras.cmake.in
248 +++ b/src/dbus/Qt5DBusConfigExtras.cmake.in
249 @@ -5,7 +5,7 @@ if (NOT TARGET Qt5::qdbuscpp2xml)
250  !!IF isEmpty(CMAKE_BIN_DIR_IS_ABSOLUTE)
251      set(imported_location \"${_qt5DBus_install_prefix}/$${CMAKE_BIN_DIR}qdbuscpp2xml$$CMAKE_BIN_SUFFIX\")
252  !!ELSE
253 -    set(imported_location \"$${CMAKE_BIN_DIR}qdbuscpp2xml$$CMAKE_BIN_SUFFIX\")
254 +    set(imported_location \"${OE_QMAKE_PATH_EXTERNAL_HOST_BINS}/qdbuscpp2xml$$CMAKE_BIN_SUFFIX\")
255  !!ENDIF
256      _qt5_DBus_check_file_exists(${imported_location})
257  
258 @@ -20,7 +20,7 @@ if (NOT TARGET Qt5::qdbusxml2cpp)
259  !!IF isEmpty(CMAKE_BIN_DIR_IS_ABSOLUTE)
260      set(imported_location \"${_qt5DBus_install_prefix}/$${CMAKE_BIN_DIR}qdbusxml2cpp$$CMAKE_BIN_SUFFIX\")
261  !!ELSE
262 -    set(imported_location \"$${CMAKE_BIN_DIR}qdbusxml2cpp$$CMAKE_BIN_SUFFIX\")
263 +    set(imported_location \"${OE_QMAKE_PATH_EXTERNAL_HOST_BINS}/qdbusxml2cpp$$CMAKE_BIN_SUFFIX\")
264  !!ENDIF
265      _qt5_DBus_check_file_exists(${imported_location})
266  
267 diff --git a/src/widgets/Qt5WidgetsConfigExtras.cmake.in b/src/widgets/Qt5WidgetsConfigExtras.cmake.in
268 index 99d87e2..5621dc0 100644
269 --- a/src/widgets/Qt5WidgetsConfigExtras.cmake.in
270 +++ b/src/widgets/Qt5WidgetsConfigExtras.cmake.in
271 @@ -5,7 +5,7 @@ if (NOT TARGET Qt5::uic)
272  !!IF isEmpty(CMAKE_BIN_DIR_IS_ABSOLUTE)
273      set(imported_location \"${_qt5Widgets_install_prefix}/$${CMAKE_BIN_DIR}uic$$CMAKE_BIN_SUFFIX\")
274  !!ELSE
275 -    set(imported_location \"$${CMAKE_BIN_DIR}uic$$CMAKE_BIN_SUFFIX\")
276 +    set(imported_location \"${OE_QMAKE_PATH_EXTERNAL_HOST_BINS}/uic$$CMAKE_BIN_SUFFIX\")
277  !!ENDIF
278      _qt5_Widgets_check_file_exists(${imported_location})
279  
280 diff --git a/tools/configure/configureapp.cpp b/tools/configure/configureapp.cpp
281 index 90981f6..7d73882 100644
282 --- a/tools/configure/configureapp.cpp
283 +++ b/tools/configure/configureapp.cpp
284 @@ -1215,6 +1215,13 @@ void Configure::parseCmdLine()
285              dictionary[ "QT_EXT_PREFIX" ] = configCmdLine.at(i);
286          }
287  
288 +        else if (configCmdLine.at(i) == "-external-hostbindir") {
289 +            ++i;
290 +            if (i == argCount)
291 +                break;
292 +            dictionary[ "QT_EXTERNAL_HOST_BINS" ] = configCmdLine.at(i);
293 +        }
294 +
295          else if (configCmdLine.at(i) == "-make-tool") {
296              ++i;
297              if (i == argCount)
298 @@ -4006,6 +4013,7 @@ void Configure::generateQConfigCpp()
299                    << "    \"qt_hbinpath=" << formatPath(dictionary["QT_HOST_BINS"]) << "\"," << endl
300                    << "    \"qt_hlibpath=" << formatPath(dictionary["QT_HOST_LIBS"]) << "\"," << endl
301                    << "    \"qt_hdatpath=" << formatPath(dictionary["QT_HOST_DATA"]) << "\"," << endl
302 +                  << "    \"qt_ebinpath=" << formatPath(dictionary["QT_EXTERNAL_HOST_BINS"]) << "\"," << endl
303                    << "    \"qt_targspec=" << targSpec << "\"," << endl
304                    << "    \"qt_hostspec=" << hostSpec << "\"," << endl
305                    << "#endif" << endl
306 -- 
307 2.1.1
308