0002-Add-python3-build-support.patch 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  1. From 1e299a6c9eeb08555208b76623e453d8ab96b6e3 Mon Sep 17 00:00:00 2001
  2. From: James Hilliard <james.hilliard1@gmail.com>
  3. Date: Fri, 4 Feb 2022 16:16:35 -0700
  4. Subject: [PATCH] Add python3 build support
  5. Adapted from:
  6. https://github.com/archlinux/svntogit-packages/blob/6edf5f1aaea952d046aff89a2e0175258fe77361/trunk/qt5-webengine-python3.patch
  7. Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
  8. ---
  9. configure.pri | 13 ++++++-------
  10. mkspecs/features/functions.prf | 6 +++---
  11. src/buildtools/config/support.pri | 10 +++++-----
  12. src/buildtools/configure.json | 18 +++++++++---------
  13. 4 files changed, 23 insertions(+), 24 deletions(-)
  14. diff --git a/configure.pri b/configure.pri
  15. index e072961f..6fec7b20 100644
  16. --- a/configure.pri
  17. +++ b/configure.pri
  18. @@ -13,8 +13,7 @@ defineTest(isPythonVersionSupported) {
  19. python_version = $$split(python_version, ',')
  20. python_major_version = $$first(python_version)
  21. greaterThan(python_major_version, 2) {
  22. - qtLog("Python version 3 is not supported by Chromium.")
  23. - return(false)
  24. + return(true)
  25. }
  26. python_minor_version = $$member(python_version, 1)
  27. python_patch_version = $$member(python_version, 2)
  28. @@ -52,10 +51,10 @@ defineTest(qtConfReport_jumboBuild) {
  29. qtConfReportPadded($${1}, $$mergeLimit)
  30. }
  31. -defineTest(qtConfTest_detectPython2) {
  32. - python = $$qtConfFindInPath("python2$$EXE_SUFFIX")
  33. +defineTest(qtConfTest_detectPython) {
  34. + python = $$qtConfFindInPath("python$$EXE_SUFFIX")
  35. isEmpty(python) {
  36. - qtLog("'python2$$EXE_SUFFIX' not found in PATH. Checking for 'python$$EXE_SUFFIX'.")
  37. + qtLog("'python$$EXE_SUFFIX' not found in PATH. Checking for 'python$$EXE_SUFFIX'.")
  38. python = $$qtConfFindInPath("python$$EXE_SUFFIX")
  39. }
  40. isEmpty(python) {
  41. @@ -63,11 +62,11 @@ defineTest(qtConfTest_detectPython2) {
  42. return(false)
  43. }
  44. !isPythonVersionSupported($$python) {
  45. - qtLog("A suitable Python 2 executable could not be located.")
  46. + qtLog("A suitable Python executable could not be located.")
  47. return(false)
  48. }
  49. - # Make tests.python2.location available in configure.json.
  50. + # Make tests.python.location available in configure.json.
  51. $${1}.location = $$clean_path($$python)
  52. export($${1}.location)
  53. $${1}.cache += location
  54. diff --git a/mkspecs/features/functions.prf b/mkspecs/features/functions.prf
  55. index 2750d707..9fda13d0 100644
  56. --- a/mkspecs/features/functions.prf
  57. +++ b/mkspecs/features/functions.prf
  58. @@ -39,11 +39,11 @@ defineReplace(which) {
  59. # Returns the unquoted path to the python executable.
  60. defineReplace(pythonPath) {
  61. - isEmpty(QMAKE_PYTHON2) {
  62. + isEmpty(QMAKE_PYTHON) {
  63. # Fallback for building QtWebEngine with Qt < 5.8
  64. - QMAKE_PYTHON2 = python
  65. + QMAKE_PYTHON = python
  66. }
  67. - return($$QMAKE_PYTHON2)
  68. + return($$QMAKE_PYTHON)
  69. }
  70. # Returns the python executable for use with shell / make targets.
  71. diff --git a/src/buildtools/config/support.pri b/src/buildtools/config/support.pri
  72. index e7f869a1..1bf2c5d7 100644
  73. --- a/src/buildtools/config/support.pri
  74. +++ b/src/buildtools/config/support.pri
  75. @@ -21,7 +21,7 @@ defineReplace(qtwebengine_checkWebEngineCoreError) {
  76. !qtwebengine_checkForGperf(QtWebEngine):return(false)
  77. !qtwebengine_checkForBison(QtWebEngine):return(false)
  78. !qtwebengine_checkForFlex(QtWebEngine):return(false)
  79. - !qtwebengine_checkForPython2(QtWebEngine):return(false)
  80. + !qtwebengine_checkForPython(QtWebEngine):return(false)
  81. !qtwebengine_checkForNodejs(QtWebEngine):return(false)
  82. !qtwebengine_checkForSanitizer(QtWebEngine):return(false)
  83. linux:!qtwebengine_checkForPkgCfg(QtWebEngine):return(false)
  84. @@ -51,7 +51,7 @@ defineReplace(qtwebengine_checkPdfError) {
  85. !qtwebengine_checkForGperf(QtPdf):return(false)
  86. !qtwebengine_checkForBison(QtPdf):return(false)
  87. !qtwebengine_checkForFlex(QtPdf):return(false)
  88. - !qtwebengine_checkForPython2(QtPdf):return(false)
  89. + !qtwebengine_checkForPython(QtPdf):return(false)
  90. !qtwebengine_checkForSanitizer(QtPdf):return(false)
  91. linux:!qtwebengine_checkForPkgCfg(QtPdf):return(false)
  92. linux:!qtwebengine_checkForHostPkgCfg(QtPdf):return(false)
  93. @@ -143,10 +143,10 @@ defineTest(qtwebengine_checkForFlex) {
  94. return(true)
  95. }
  96. -defineTest(qtwebengine_checkForPython2) {
  97. +defineTest(qtwebengine_checkForPython) {
  98. module = $$1
  99. - !qtConfig(webengine-python2) {
  100. - qtwebengine_skipBuild("Python version 2 (2.7.5 or later) is required to build $${module}.")
  101. + !qtConfig(webengine-python) {
  102. + qtwebengine_skipBuild("Python is required to build $${module}.")
  103. return(false)
  104. }
  105. return(true)
  106. diff --git a/src/buildtools/configure.json b/src/buildtools/configure.json
  107. index 88d1790c..032aa665 100644
  108. --- a/src/buildtools/configure.json
  109. +++ b/src/buildtools/configure.json
  110. @@ -295,9 +295,9 @@
  111. "label": "system ninja",
  112. "type": "detectNinja"
  113. },
  114. - "webengine-python2": {
  115. - "label": "python2",
  116. - "type": "detectPython2",
  117. + "webengine-python": {
  118. + "label": "python",
  119. + "type": "detectPython",
  120. "log": "location"
  121. },
  122. "webengine-winversion": {
  123. @@ -374,7 +374,7 @@
  124. && features.webengine-gperf
  125. && features.webengine-bison
  126. && features.webengine-flex
  127. - && features.webengine-python2
  128. + && features.webengine-python
  129. && features.webengine-nodejs
  130. && (!config.sanitizer || features.webengine-sanitizer)
  131. && (!config.linux || features.pkg-config)
  132. @@ -400,7 +400,7 @@
  133. && features.webengine-gperf
  134. && features.webengine-bison
  135. && features.webengine-flex
  136. - && features.webengine-python2
  137. + && features.webengine-python
  138. && (!config.sanitizer || features.webengine-sanitizer)
  139. && (!config.linux || features.pkg-config)
  140. && (!config.linux || features.webengine-host-pkg-config)
  141. @@ -423,12 +423,12 @@
  142. "autoDetect": "features.private_tests",
  143. "output": [ "privateFeature" ]
  144. },
  145. - "webengine-python2": {
  146. - "label": "python2",
  147. - "condition": "tests.webengine-python2",
  148. + "webengine-python": {
  149. + "label": "python",
  150. + "condition": "tests.webengine-python",
  151. "output": [
  152. "privateFeature",
  153. - { "type": "varAssign", "name": "QMAKE_PYTHON2", "value": "tests.webengine-python2.location" }
  154. + { "type": "varAssign", "name": "QMAKE_PYTHON", "value": "tests.webengine-python.location" }
  155. ]
  156. },
  157. "webengine-gperf": {
  158. --
  159. 2.25.1