Skip to content

Commit

Permalink
build, qt: Add RISC-V detection
Browse files Browse the repository at this point in the history
  • Loading branch information
hebasto committed Aug 30, 2021
1 parent d67f6f7 commit f17a32a
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 1 deletion.
3 changes: 2 additions & 1 deletion depends/packages/qt.mk
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ $(package)_patches += support_new_android_ndks.patch fix_android_jni_static.patc
$(package)_patches+= no_sdk_version_check.patch
$(package)_patches+= fix_lib_paths.patch fix_android_pch.patch
$(package)_patches+= qtbase-moc-ignore-gcc-macro.patch fix_limits_header.patch
$(package)_patches += fix_qml_python.patch
$(package)_patches += fix_qml_python.patch riscv_detection.patch

$(package)_qtdeclarative_file_name = qtdeclarative-$($(package)_suffix)
$(package)_qtdeclarative_sha256_hash = 1267e029abc8424424c419bc1681db069ec76e51270cc220994e0f442c9f78d3
Expand Down Expand Up @@ -267,6 +267,7 @@ define $(package)_preprocess_cmds
patch -p1 -i $($(package)_patch_dir)/qtbase-moc-ignore-gcc-macro.patch && \
patch -p1 -i $($(package)_patch_dir)/fix_limits_header.patch && \
patch -p1 -i $($(package)_patch_dir)/fix_qml_python.patch && \
patch -p1 -i $($(package)_patch_dir)/riscv_detection.patch && \
mkdir -p qtbase/mkspecs/macx-clang-linux &&\
cp -f qtbase/mkspecs/macx-clang/qplatformdefs.h qtbase/mkspecs/macx-clang-linux/ &&\
cp -f $($(package)_patch_dir)/mac-qmake.conf qtbase/mkspecs/macx-clang-linux/qmake.conf && \
Expand Down
41 changes: 41 additions & 0 deletions depends/patches/qt/riscv_detection.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
Add RISC-V detection

Upstream commit:
- Qt 5.14: 9a6a84731131b205f74b10f866ae212e0895bd4a

--- old/qtbase/src/corelib/global/archdetect.cpp
+++ new/qtbase/src/corelib/global/archdetect.cpp
@@ -67,6 +67,10 @@
# define ARCH_PROCESSOR "power"
#elif defined(Q_PROCESSOR_POWER_64)
# define ARCH_PROCESSOR "power64"
+#elif defined(Q_PROCESSOR_RISCV_32)
+# define ARCH_PROCESSOR "riscv32"
+#elif defined(Q_PROCESSOR_RISCV_64)
+# define ARCH_PROCESSOR "riscv64"
#elif defined(Q_PROCESSOR_S390_X)
# define ARCH_PROCESSOR "s390x"
#elif defined(Q_PROCESSOR_S390)

--- old/qtbase/src/corelib/global/qprocessordetection.h
+++ old/qtbase/src/corelib/global/qprocessordetection.h
@@ -282,6 +282,19 @@
// Q_BYTE_ORDER not defined, use endianness auto-detection

+ /*
+ RISC-V family, known variants: 32- and 64-bit
+ RISC-V is little-endian.
+*/
+#elif defined(__riscv)
+# define Q_PROCESSOR_RISCV
+# if __riscv_xlen == 64
+# define Q_PROCESSOR_RISCV_64
+# else
+# define Q_PROCESSOR_RISCV_32
+# endif
+# define Q_BYTE_ORDER Q_LITTLE_ENDIAN
+
/*
S390 family, known variant: S390X (64-bit)

S390 is big-endian.

0 comments on commit f17a32a

Please sign in to comment.