Skip to content

Commit e61d42d

Browse files
committed
build, qml: Add qtdeclarative module
1 parent b1b6304 commit e61d42d

File tree

5 files changed

+166
-2
lines changed

5 files changed

+166
-2
lines changed

build-aux/m4/bitcoin_qt.m4

+10
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,12 @@ AC_DEFUN([BITCOIN_QT_CONFIGURE],[
140140
if test -d "$qt_plugin_path/platforms/android"; then
141141
QT_LIBS="$QT_LIBS -L$qt_plugin_path/platforms/android -lqtfreetype -lEGL"
142142
fi
143+
if test -d "$qt_plugin_path/../qml/QtQuick/Window.2"; then
144+
QT_LIBS="$QT_LIBS -L$qt_plugin_path/../qml/QtQuick/Window.2"
145+
fi
146+
if test -d "$qt_plugin_path/../qml/QtQuick.2"; then
147+
QT_LIBS="$QT_LIBS -L$qt_plugin_path/../qml/QtQuick.2"
148+
fi
143149
fi
144150
145151
AC_DEFINE(QT_STATICPLUGIN, 1, [Define this symbol if qt plugins are static])
@@ -171,6 +177,10 @@ AC_DEFUN([BITCOIN_QT_CONFIGURE],[
171177
QT_LIBS="-Wl,--export-dynamic,--undefined=JNI_OnLoad -lqtforandroid -ljnigraphics -landroid -lqtfreetype $QT_LIBS"
172178
AC_DEFINE(QT_QPA_PLATFORM_ANDROID, 1, [Define this symbol if the qt platform is android])
173179
fi
180+
if test "x$use_qml" != xno; then
181+
_BITCOIN_QT_CHECK_STATIC_PLUGIN([QtQuick2Plugin], [-lqtquick2plugin])
182+
_BITCOIN_QT_CHECK_STATIC_PLUGIN([QtQuick2WindowPlugin], [-lwindowplugin])
183+
fi
174184
fi
175185
CPPFLAGS=$TEMP_CPPFLAGS
176186
CXXFLAGS=$TEMP_CXXFLAGS

depends/packages/qt.mk

+13-1
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,19 @@ $(package)_patches += support_new_android_ndks.patch fix_android_jni_static.patc
1313
$(package)_patches+= no_sdk_version_check.patch
1414
$(package)_patches+= fix_lib_paths.patch fix_android_pch.patch
1515
$(package)_patches+= qtbase-moc-ignore-gcc-macro.patch fix_limits_header.patch
16+
$(package)_patches += fix_qml_python.patch
17+
18+
$(package)_qtdeclarative_file_name = qtdeclarative-$($(package)_suffix)
19+
$(package)_qtdeclarative_sha256_hash = 1267e029abc8424424c419bc1681db069ec76e51270cc220994e0f442c9f78d3
1620

1721
$(package)_qttranslations_file_name=qttranslations-$($(package)_suffix)
1822
$(package)_qttranslations_sha256_hash=577b0668a777eb2b451c61e8d026d79285371597ce9df06b6dee6c814164b7c3
1923

2024
$(package)_qttools_file_name=qttools-$($(package)_suffix)
2125
$(package)_qttools_sha256_hash=98b2aaca230458f65996f3534fd471d2ffd038dd58ac997c0589c06dc2385b4f
2226

23-
$(package)_extra_sources = $($(package)_qttranslations_file_name)
27+
$(package)_extra_sources += $($(package)_qtdeclarative_file_name)
28+
$(package)_extra_sources += $($(package)_qttranslations_file_name)
2429
$(package)_extra_sources += $($(package)_qttools_file_name)
2530

2631
define $(package)_set_vars
@@ -181,18 +186,22 @@ endef
181186

182187
define $(package)_fetch_cmds
183188
$(call fetch_file,$(package),$($(package)_download_path),$($(package)_download_file),$($(package)_file_name),$($(package)_sha256_hash)) && \
189+
$(call fetch_file,$(package),$($(package)_download_path),$($(package)_qtdeclarative_file_name),$($(package)_qtdeclarative_file_name),$($(package)_qtdeclarative_sha256_hash)) && \
184190
$(call fetch_file,$(package),$($(package)_download_path),$($(package)_qttranslations_file_name),$($(package)_qttranslations_file_name),$($(package)_qttranslations_sha256_hash)) && \
185191
$(call fetch_file,$(package),$($(package)_download_path),$($(package)_qttools_file_name),$($(package)_qttools_file_name),$($(package)_qttools_sha256_hash))
186192
endef
187193

188194
define $(package)_extract_cmds
189195
mkdir -p $($(package)_extract_dir) && \
190196
echo "$($(package)_sha256_hash) $($(package)_source)" > $($(package)_extract_dir)/.$($(package)_file_name).hash && \
197+
echo "$($(package)_qtdeclarative_sha256_hash) $($(package)_source_dir)/$($(package)_qtdeclarative_file_name)" >> $($(package)_extract_dir)/.$($(package)_file_name).hash && \
191198
echo "$($(package)_qttranslations_sha256_hash) $($(package)_source_dir)/$($(package)_qttranslations_file_name)" >> $($(package)_extract_dir)/.$($(package)_file_name).hash && \
192199
echo "$($(package)_qttools_sha256_hash) $($(package)_source_dir)/$($(package)_qttools_file_name)" >> $($(package)_extract_dir)/.$($(package)_file_name).hash && \
193200
$(build_SHA256SUM) -c $($(package)_extract_dir)/.$($(package)_file_name).hash && \
194201
mkdir qtbase && \
195202
tar --no-same-owner --strip-components=1 -xf $($(package)_source) -C qtbase && \
203+
mkdir qtdeclarative && \
204+
tar --no-same-owner --strip-components=1 -xf $($(package)_source_dir)/$($(package)_qtdeclarative_file_name) -C qtdeclarative && \
196205
mkdir qttranslations && \
197206
tar --no-same-owner --strip-components=1 -xf $($(package)_source_dir)/$($(package)_qttranslations_file_name) -C qttranslations && \
198207
mkdir qttools && \
@@ -232,6 +241,7 @@ define $(package)_preprocess_cmds
232241
patch -p1 -i $($(package)_patch_dir)/fix_lib_paths.patch && \
233242
patch -p1 -i $($(package)_patch_dir)/qtbase-moc-ignore-gcc-macro.patch && \
234243
patch -p1 -i $($(package)_patch_dir)/fix_limits_header.patch && \
244+
patch -p1 -i $($(package)_patch_dir)/fix_qml_python.patch && \
235245
mkdir -p qtbase/mkspecs/macx-clang-linux &&\
236246
cp -f qtbase/mkspecs/macx-clang/qplatformdefs.h qtbase/mkspecs/macx-clang-linux/ &&\
237247
cp -f $($(package)_patch_dir)/mac-qmake.conf qtbase/mkspecs/macx-clang-linux/qmake.conf && \
@@ -258,7 +268,9 @@ define $(package)_build_cmds
258268
endef
259269

260270
define $(package)_stage_cmds
271+
export PATH && \
261272
$(MAKE) -C qtbase/src INSTALL_ROOT=$($(package)_staging_dir) $(addsuffix -install_subtargets,$(addprefix sub-,$($(package)_qt_libs))) && \
273+
$(MAKE) -C qtdeclarative INSTALL_ROOT=$($(package)_staging_dir) sub-src-install_subtargets && \
262274
$(MAKE) -C qttools/src/linguist INSTALL_ROOT=$($(package)_staging_dir) $(addsuffix -install_subtargets,$(addprefix sub-,$($(package)_linguist_tools))) && \
263275
$(MAKE) -C qttranslations INSTALL_ROOT=$($(package)_staging_dir) install_subtargets
264276
endef
+135
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
Fix python check
2+
3+
Upsream bugreports:
4+
- https://bugreports.qt.io/browse/QTBUG-72926
5+
- https://bugreports.qt.io/browse/QTBUG-84038
6+
7+
Upstream commits:
8+
- Qt 5.15: 1c6a70e1880a8fe0f3d8da4932c4f3533693219c
9+
- Qt 6.0: 2b41025fc967b37c8bff77c4b75bab333ae13f46
10+
11+
--- old/qtdeclarative/qtdeclarative.pro
12+
+++ new/qtdeclarative/qtdeclarative.pro
13+
@@ -1,10 +1,2 @@
14+
CONFIG += tests_need_tools examples_need_tools
15+
load(qt_parts)
16+
-
17+
-!python_available {
18+
- py_out = $$system('python -c "print(1)"')
19+
- !equals(py_out, 1): error("Building QtQml requires Python.")
20+
- tmp = python_available
21+
- CONFIG += $$tmp
22+
- cache(CONFIG, add, tmp)
23+
-}
24+
25+
--- old/qtdeclarative/src/3rdparty/masm/masm.pri
26+
+++ new/qtdeclarative/src/3rdparty/masm/masm.pri
27+
@@ -58,7 +58,7 @@
28+
udis86.output = udis86_itab.h
29+
udis86.input = ITAB
30+
udis86.CONFIG += no_link
31+
- udis86.commands = python $$PWD/disassembler/udis86/itab.py ${QMAKE_FILE_IN}
32+
+ udis86.commands = $QMAKE_PYTHON $$PWD/disassembler/udis86/itab.py ${QMAKE_FILE_IN}
33+
QMAKE_EXTRA_COMPILERS += udis86
34+
35+
udis86_tab_cfile.target = $$OUT_PWD/udis86_itab.c
36+
@@ -113,7 +113,7 @@
37+
retgen.script = $$PWD/yarr/create_regex_tables
38+
retgen.input = retgen.script
39+
retgen.CONFIG += no_link
40+
-retgen.commands = python $$retgen.script > ${QMAKE_FILE_OUT}
41+
+retgen.commands = $$QMAKE_PYTHON $$retgen.script > ${QMAKE_FILE_OUT}
42+
QMAKE_EXTRA_COMPILERS += retgen
43+
44+
# Taken from WebKit/Tools/qmake/mkspecs/features/unix/default_post.prf
45+
46+
--- old/qtdeclarative/src/qml/configure.json
47+
+++ new/qtdeclarative/src/qml/configure.json
48+
@@ -23,6 +23,11 @@
49+
],
50+
"qmake": "CONFIG += c++11"
51+
}
52+
+ },
53+
+ "qml-python": {
54+
+ "label": "python",
55+
+ "type": "detectPython",
56+
+ "log": "location"
57+
}
58+
},
59+
60+
@@ -123,9 +128,25 @@
61+
"section": "QML",
62+
"condition": "features.thread",
63+
"output": [ "privateFeature" ]
64+
+ },
65+
+ "qml-python": {
66+
+ "label": "python",
67+
+ "condition": "tests.qml-python",
68+
+ "output": [
69+
+ "privateFeature",
70+
+ { "type": "varAssign", "name": "QMAKE_PYTHON", "value": "tests.qml-python.location" }
71+
+ ]
72+
}
73+
},
74+
75+
+ "report": [
76+
+ {
77+
+ "type": "error",
78+
+ "condition": "!features.qml-python",
79+
+ "message": "Python is required to build QtQml."
80+
+ }
81+
+ ],
82+
+
83+
"summary": [
84+
{
85+
"section": "Qt QML",
86+
87+
--- old/qtdeclarative/src/qml/configure.pri
88+
+++ new/qtdeclarative/src/qml/configure.pri
89+
@@ -0,0 +1,22 @@
90+
+equals(QMAKE_HOST.os, Windows): EXE_SUFFIX = .exe
91+
+
92+
+defineTest(qtConfTest_detectPython) {
93+
+ PYTHON_NAMES = python$$EXE_SUFFIX python2$${EXE_SUFFIX} python3$${EXE_SUFFIX} py$${EXE_SUFFIX}
94+
+ for (name, PYTHON_NAMES) {
95+
+ python_path = $$qtConfFindInPath("$$name")
96+
+ !isEmpty(python_path): \
97+
+ break()
98+
+ }
99+
+ isEmpty(python_path) {
100+
+ qtLog("No $$PYTHON_NAMES are found in PATH. Giving up.")
101+
+ return(false)
102+
+ }
103+
+
104+
+ # Make tests.python.location available in configure.json.
105+
+ $${1}.location = $$clean_path($$python_path)
106+
+ export($${1}.location)
107+
+ $${1}.cache += location
108+
+ export($${1}.cache)
109+
+
110+
+ return(true)
111+
+}
112+
113+
--- old/qtdeclarative/src/qml/qml.pro
114+
+++ new/qtdeclarative/src/qml/qml.pro
115+
@@ -7,6 +7,9 @@
116+
TRACEPOINT_PROVIDER = $$PWD/qtqml.tracepoints
117+
CONFIG += qt_tracepoints
118+
119+
+!qtConfig(qml-python): \
120+
+ error(Python is required to build QtQml.)
121+
+
122+
DEFINES += QT_NO_URL_CAST_FROM_STRING QT_NO_INTEGER_EVENT_COORDINATES
123+
124+
msvc:equals(QT_ARCH, i386): QMAKE_LFLAGS += /BASE:0x66000000
125+
@@ -81,8 +84,9 @@
126+
}
127+
include(types/types.pri)
128+
include(../3rdparty/masm/masm-defs.pri)
129+
-include(../3rdparty/masm/masm.pri)
130+
131+
MODULE_PLUGIN_TYPES = \
132+
qmltooling
133+
load(qt_module)
134+
+
135+
+include(../3rdparty/masm/masm.pri)

depends/patches/qt/qt.pro

+2-1
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,9 @@ CONFIG += $$prl
88
cache(CONFIG, add stash, prl)
99

1010
TEMPLATE = subdirs
11-
SUBDIRS = qtbase qttools qttranslations
11+
SUBDIRS = qtbase qtdeclarative qttools qttranslations
1212

13+
qtdeclarative.depends = qtbase
1314
qttools.depends = qtbase
1415
qttranslations.depends = qttools
1516

src/qml/bitcoin.cpp

+6
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,12 @@
2424
#include <QStringLiteral>
2525
#include <QUrl>
2626

27+
#if defined(QT_STATICPLUGIN)
28+
#include <QtPlugin>
29+
Q_IMPORT_PLUGIN(QtQuick2Plugin);
30+
Q_IMPORT_PLUGIN(QtQuick2WindowPlugin);
31+
#endif
32+
2733
namespace {
2834
void SetupUIArgs(ArgsManager& argsman)
2935
{

0 commit comments

Comments
 (0)