aboutsummaryrefslogtreecommitdiff
path: root/xmpp-vala
diff options
context:
space:
mode:
authorMarvin W <git@larma.de>2023-08-24 20:18:26 +0200
committerfiaxh <git@lightrise.org>2023-09-24 19:51:33 +0200
commit9eafe4139d6b2c0cabe3c77a903d6ae931a26975 (patch)
tree7a1fa0a2a5fc25b9b8dfe2688a9f622fbd742d70 /xmpp-vala
parent2fba24ccae13e832bd38ff9c7fea71c1a802603d (diff)
downloaddino-9eafe4139d6b2c0cabe3c77a903d6ae931a26975.tar.gz
dino-9eafe4139d6b2c0cabe3c77a903d6ae931a26975.zip
Fix build on some Vala compiler versions
See https://gitlab.gnome.org/GNOME/vala/-/issues/1474 and https://gitlab.gnome.org/GNOME/vala/-/issues/1478
Diffstat (limited to 'xmpp-vala')
-rw-r--r--xmpp-vala/CMakeLists.txt7
-rw-r--r--xmpp-vala/src/core/module_flag.vala10
2 files changed, 17 insertions, 0 deletions
diff --git a/xmpp-vala/CMakeLists.txt b/xmpp-vala/CMakeLists.txt
index 39c090fe..cfbc0aaf 100644
--- a/xmpp-vala/CMakeLists.txt
+++ b/xmpp-vala/CMakeLists.txt
@@ -9,6 +9,11 @@ find_packages(ENGINE_PACKAGES REQUIRED
set(ENGINE_EXTRA_OPTIONS ${MAIN_EXTRA_OPTIONS} --vapidir=${CMAKE_CURRENT_SOURCE_DIR}/vapi)
+set(ENGINE_DEFINITIONS)
+if(VALA_VERSION VERSION_EQUAL "0.56.11")
+ set(ENGINE_DEFINITIONS ${ENGINE_DEFINITIONS} VALA_0_56_11)
+endif()
+
vala_precompile(ENGINE_VALA_C
SOURCES
"src/core/direct_tls_xmpp_stream.vala"
@@ -152,6 +157,8 @@ CUSTOM_VAPIS
"${CMAKE_CURRENT_SOURCE_DIR}/src/glib_fixes.vapi"
OPTIONS
${ENGINE_EXTRA_OPTIONS}
+DEFINITIONS
+ ${ENGINE_DEFINITIONS}
)
add_custom_target(xmpp-vala-vapi
diff --git a/xmpp-vala/src/core/module_flag.vala b/xmpp-vala/src/core/module_flag.vala
index 95547852..76ae4dc1 100644
--- a/xmpp-vala/src/core/module_flag.vala
+++ b/xmpp-vala/src/core/module_flag.vala
@@ -10,7 +10,12 @@ namespace Xmpp {
}
public T? cast(XmppStreamFlag flag) {
+#if VALA_0_56_11
+ // We can't typecheck due to compiler bug
+ return (T) module;
+#else
return flag.get_type().is_a(typeof(T)) ? (T?) flag : null;
+#endif
}
public bool matches(XmppStreamFlag module) {
@@ -34,7 +39,12 @@ namespace Xmpp {
}
public T? cast(XmppStreamModule module) {
+#if VALA_0_56_11
+ // We can't typecheck due to compiler bug
+ return (T) module;
+#else
return module.get_type().is_a(typeof(T)) ? (T?) module : null;
+#endif
}
public bool matches(XmppStreamModule module) {