From f0ed11ec49b6c5b3a52bc666e31ff9791dee77cf Mon Sep 17 00:00:00 2001 From: Marvin W Date: Wed, 16 Mar 2022 08:33:13 -0600 Subject: [PATCH] Fix build on Vala < 0.50 and pre-release Vala versions --- CMakeLists.txt | 5 ++++- plugins/omemo/src/ui/contact_details_dialog.vala | 3 +-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c9525870..b5734c45 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -199,7 +199,10 @@ include(MultiFind) include(GlibCompileResourcesSupport) find_package(GLib ${GLib_GLOBAL_VERSION} REQUIRED) -set(CMAKE_VALA_FLAGS "${CMAKE_VALA_FLAGS} --target-glib=${GLib_VERSION}") +string(REGEX REPLACE "^([0-9]+)\\.[0-9]+(\\.[0-9]+)?" "\\1" GLib_MAJOR_VERSION "${GLib_VERSION}") +string(REGEX REPLACE "^[0-9]+\\.([0-9]+)(\\.[0-9]+)?" "\\1" GLib_MINOR_VERSION "${GLib_VERSION}") +math(EXPR GLib_LAST_RELEASE_MINOR_VERSION "${GLib_MINOR_VERSION} / 2 * 2") +set(CMAKE_VALA_FLAGS "${CMAKE_VALA_FLAGS} --target-glib=${GLib_MAJOR_VERSION}.${GLib_LAST_RELEASE_MINOR_VERSION}") add_subdirectory(qlite) add_subdirectory(xmpp-vala) diff --git a/plugins/omemo/src/ui/contact_details_dialog.vala b/plugins/omemo/src/ui/contact_details_dialog.vala index a40970d0..b4d6d8f0 100644 --- a/plugins/omemo/src/ui/contact_details_dialog.vala +++ b/plugins/omemo/src/ui/contact_details_dialog.vala @@ -93,8 +93,7 @@ public class ContactDetailsDialog : Gtk.Dialog { int sid = plugin.db.identity.row_with(plugin.db.identity.account_id, account.id)[plugin.db.identity.device_id]; var iri_query = @"omemo-sid-$(sid)=$(fingerprint)"; -#if GLIB_2_66 - // glib >=2.66 only; never compiled +#if GLIB_2_66 && VALA_0_50 string iri = GLib.Uri.join(UriFlags.NONE, "xmpp", null, null, 0, jid.to_string(), iri_query, null); #else var iri_path_seg = escape_for_iri_path_segment(jid.to_string());