0015-configure-fix-build-on-non-x86-platforms.patch 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. From 02e9698c96ca78342b82fa7239e93bab4aa45db2 Mon Sep 17 00:00:00 2001
  2. From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
  3. Date: Fri, 17 Nov 2017 22:20:06 +0100
  4. Subject: [PATCH] configure: fix build on non-x86 platforms
  5. When building for an uncommon platform on a ppc64le machine, Qt build
  6. fails because it builds qmake with the target compiler instead of
  7. using the host compiler. This is due to the fact that Qt configure
  8. script believes that both the host and target platforms are "powerpc",
  9. even though the target really is Xtensa or ARC for example.
  10. Qt's configure script defines a variable called PLATFORM that points to
  11. the mkspecs describing the host machine. For x86, its value is
  12. qws/linux-x86-g++ and for x86-64, its value is
  13. qws/linux-x86_64-g++. For any other host architecture, its value is
  14. qws/linux-generic-g++.
  15. In parallel to this, Qt's configure script defines a variable called
  16. XPLATFORM that points to the mkspecs describing the target machine. It
  17. points to qws/linux-${CFG_EMBEDDED}-g++, where CFG_EMBEDDED is
  18. simply "generic" for most uncommon architectures.
  19. Therefore, when we're building for an uncommon architecture, on a
  20. ppc64le machine, we have:
  21. PLATFORM = qws/linux-generic-g++
  22. XPLATFORM = qws/linux-generic-g++
  23. i.e, both values are equal. Due to this, the following condition is
  24. false:
  25. if [ "$PLATFORM" != "$XPLATFORM" -a "$CFG_EMBEDDED" != "no" ]; then
  26. which causes Qt's configure script to fallback to:
  27. elif [ "$PLATFORM_MAC" = "yes" ] || [ -z "$CFG_ARCH" ]; then
  28. CFG_ARCH=$CFG_HOST_ARCH
  29. fi
  30. because CFG_ARCH is not defined, and therefore gets defined to
  31. CFG_HOST_ARCH. So we have CFG_ARCH == CFG_HOST_ARCH, and Qt believes
  32. we're doing a native build.
  33. Therefore, we need to ensure that PLATFORM and XPLATFORM always have a
  34. different value. To achieve this, we create a
  35. qws/linux-host-generic-g++ mkspecs, which is always used as
  36. PLATFORM. It is identical to qws/linux-x86-g++. Compared to
  37. qws/linux-x86_64-g++, the only difference is that we're not passing
  38. the -m64 flag, but that isn't needed when building host tools.
  39. Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
  40. ---
  41. configure | 8 +----
  42. mkspecs/qws/linux-host-generic-g++/qmake.conf | 10 ++++++
  43. mkspecs/qws/linux-host-generic-g++/qplatformdefs.h | 42 ++++++++++++++++++++++
  44. 3 files changed, 53 insertions(+), 7 deletions(-)
  45. create mode 100644 mkspecs/qws/linux-host-generic-g++/qmake.conf
  46. create mode 100644 mkspecs/qws/linux-host-generic-g++/qplatformdefs.h
  47. diff --git a/configure b/configure
  48. index 10ad7ca0b0..d25f90be1e 100755
  49. --- a/configure
  50. +++ b/configure
  51. @@ -2806,14 +2806,8 @@ if [ "$CFG_EMBEDDED" != "no" ]; then
  52. Linux:*)
  53. if [ -z "$PLATFORM" ]; then
  54. case "$UNAME_MACHINE" in
  55. - *86)
  56. - PLATFORM=qws/linux-x86-g++
  57. - ;;
  58. - *86_64)
  59. - PLATFORM=qws/linux-x86_64-g++
  60. - ;;
  61. *)
  62. - PLATFORM=qws/linux-generic-g++
  63. + PLATFORM=qws/linux-host-generic-g++
  64. ;;
  65. esac
  66. fi
  67. diff --git a/mkspecs/qws/linux-host-generic-g++/qmake.conf b/mkspecs/qws/linux-host-generic-g++/qmake.conf
  68. new file mode 100644
  69. index 0000000000..55011ec52b
  70. --- /dev/null
  71. +++ b/mkspecs/qws/linux-host-generic-g++/qmake.conf
  72. @@ -0,0 +1,10 @@
  73. +#
  74. +# qmake configuration for building with linux-g++
  75. +#
  76. +
  77. +include(../../common/linux.conf)
  78. +include(../../common/gcc-base-unix.conf)
  79. +include(../../common/g++-unix.conf)
  80. +include(../../common/qws.conf)
  81. +
  82. +load(qt_config)
  83. diff --git a/mkspecs/qws/linux-host-generic-g++/qplatformdefs.h b/mkspecs/qws/linux-host-generic-g++/qplatformdefs.h
  84. new file mode 100644
  85. index 0000000000..a654aa78a2
  86. --- /dev/null
  87. +++ b/mkspecs/qws/linux-host-generic-g++/qplatformdefs.h
  88. @@ -0,0 +1,42 @@
  89. +/****************************************************************************
  90. +**
  91. +** Copyright (C) 2015 The Qt Company Ltd.
  92. +** Contact: http://www.qt.io/licensing/
  93. +**
  94. +** This file is part of the qmake spec of the Qt Toolkit.
  95. +**
  96. +** $QT_BEGIN_LICENSE:LGPL$
  97. +** Commercial License Usage
  98. +** Licensees holding valid commercial Qt licenses may use this file in
  99. +** accordance with the commercial license agreement provided with the
  100. +** Software or, alternatively, in accordance with the terms contained in
  101. +** a written agreement between you and The Qt Company. For licensing terms
  102. +** and conditions see http://www.qt.io/terms-conditions. For further
  103. +** information use the contact form at http://www.qt.io/contact-us.
  104. +**
  105. +** GNU Lesser General Public License Usage
  106. +** Alternatively, this file may be used under the terms of the GNU Lesser
  107. +** General Public License version 2.1 or version 3 as published by the Free
  108. +** Software Foundation and appearing in the file LICENSE.LGPLv21 and
  109. +** LICENSE.LGPLv3 included in the packaging of this file. Please review the
  110. +** following information to ensure the GNU Lesser General Public License
  111. +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
  112. +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
  113. +**
  114. +** As a special exception, The Qt Company gives you certain additional
  115. +** rights. These rights are described in The Qt Company LGPL Exception
  116. +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
  117. +**
  118. +** GNU General Public License Usage
  119. +** Alternatively, this file may be used under the terms of the GNU
  120. +** General Public License version 3.0 as published by the Free Software
  121. +** Foundation and appearing in the file LICENSE.GPL included in the
  122. +** packaging of this file. Please review the following information to
  123. +** ensure the GNU General Public License version 3.0 requirements will be
  124. +** met: http://www.gnu.org/copyleft/gpl.html.
  125. +**
  126. +** $QT_END_LICENSE$
  127. +**
  128. +****************************************************************************/
  129. +
  130. +#include "../../linux-g++/qplatformdefs.h"
  131. --
  132. 2.13.6