First steps of meson support

Basic configuration of qlite, xmpp-vala, the Dino library and the Dino
application are supported. There's no support for the plugins.

This e.g. enables using the Vala language server.
This commit is contained in:
hrxi 2023-03-20 02:01:22 +01:00 committed by fiaxh
parent b617bf7cc4
commit 5a90e793dd
11 changed files with 486 additions and 1 deletions

View file

@ -9,6 +9,7 @@ find_packages(LIBDINO_PACKAGES REQUIRED
vala_precompile(LIBDINO_VALA_C vala_precompile(LIBDINO_VALA_C
SOURCES SOURCES
src/application.vala src/application.vala
src/version.vala
src/dbus/login1.vala src/dbus/login1.vala
src/dbus/notifications.vala src/dbus/notifications.vala

86
libdino/meson.build Normal file
View file

@ -0,0 +1,86 @@
# version_vala
dot_git = meson.current_source_dir() / '../.git'
version_file = meson.current_source_dir() / '../VERSION'
command = [prog_python, files('version.py'), version_file, '@OUTPUT@', '--git-repo', meson.current_source_dir()]
if prog_git.found()
command += ['--git', prog_git]
endif
depend_files = []
if fs.exists(dot_git)
depend_files += [dot_git]
endif
if fs.exists(version_file)
depend_files += [version_file]
endif
version_vala = custom_target('libdino_version_vala', command: command, output: 'version.vala', depend_files: depend_files)
# libdino
dependencies = [
dep_gdk_pixbuf,
dep_gee,
dep_gio,
dep_glib,
dep_gmodule,
dep_qlite,
dep_xmpp_vala
]
sources = files(
'src/application.vala',
'src/dbus/login1.vala',
'src/dbus/notifications.vala',
'src/dbus/upower.vala',
'src/entity/account.vala',
'src/entity/call.vala',
'src/entity/conversation.vala',
'src/entity/encryption.vala',
'src/entity/file_transfer.vala',
'src/entity/message.vala',
'src/entity/settings.vala',
'src/plugin/interfaces.vala',
'src/plugin/loader.vala',
'src/plugin/registry.vala',
'src/service/avatar_manager.vala',
'src/service/blocking_manager.vala',
'src/service/call_store.vala',
'src/service/call_state.vala',
'src/service/call_peer_state.vala',
'src/service/calls.vala',
'src/service/chat_interaction.vala',
'src/service/connection_manager.vala',
'src/service/content_item_store.vala',
'src/service/conversation_manager.vala',
'src/service/counterpart_interaction_manager.vala',
'src/service/database.vala',
'src/service/entity_capabilities_storage.vala',
'src/service/entity_info.vala',
'src/service/fallback_body.vala',
'src/service/file_manager.vala',
'src/service/file_transfer_storage.vala',
'src/service/history_sync.vala',
'src/service/jingle_file_transfers.vala',
'src/service/message_correction.vala',
'src/service/message_processor.vala',
'src/service/message_storage.vala',
'src/service/module_manager.vala',
'src/service/muc_manager.vala',
'src/service/notification_events.vala',
'src/service/presence_manager.vala',
'src/service/replies.vala',
'src/service/reactions.vala',
'src/service/registration.vala',
'src/service/roster_manager.vala',
'src/service/search_processor.vala',
'src/service/stream_interactor.vala',
'src/service/util.vala',
'src/util/display_name.vala',
'src/util/util.vala',
'src/util/weak_map.vala',
)
sources += [version_vala]
c_args = [
'-DDINO_SYSTEM_LIBDIR_NAME="@0@"'.format(get_option('prefix') / get_option('libdir')),
'-DDINO_SYSTEM_PLUGIN_DIR="@0@"'.format(get_option('prefix') / get_option('plugindir')),
'-DG_LOG_DOMAIN="libdino"',
]
lib_dino = library('dino', sources, c_args: c_args, include_directories: include_directories('src'), dependencies: dependencies)
dep_dino = declare_dependency(link_with: lib_dino, include_directories: include_directories('.', 'src'))

View file

@ -2,7 +2,6 @@ using Dino.Entities;
namespace Dino { namespace Dino {
extern const string VERSION;
public string get_version() { return VERSION; } public string get_version() { return VERSION; }
public string get_short_version() { public string get_short_version() {
if (!VERSION.contains("~")) return VERSION; if (!VERSION.contains("~")) return VERSION;

6
libdino/src/version.vala Normal file
View file

@ -0,0 +1,6 @@
// Not used in Meson.
namespace Dino {
extern const string VERSION;
}

36
libdino/version.py Normal file
View file

@ -0,0 +1,36 @@
import argparse
import subprocess
VERSION_VALA = """\
namespace Dino {{
public const string VERSION = "{}";
}}
"""
def compute_version(file, git_repo, git):
try:
with open(file) as f:
return f.read().strip()
except FileNotFoundError:
pass
return subprocess.check_output([git, "describe", "--tags"], cwd=git_repo, text=True).strip()
def generate_version_vala(version):
if "\\" in version or "\"" in version:
raise ValueError(f"invalid version {version!r}")
return VERSION_VALA.format(version)
def main():
p = argparse.ArgumentParser(description="Compute the Dino version")
p.add_argument("--git-repo", help="Path to checked out git repository")
p.add_argument("--git", help="Path to git executable", default="git")
p.add_argument("version_file", metavar="VERSION_FILE", help="Use this file's contents as version if the file exists")
p.add_argument("output", metavar="OUTPUT", help="Vala file to output to")
args = p.parse_args()
out = generate_version_vala(compute_version(args.version_file, args.git_repo, args.git))
with open(args.output, "w") as f:
f.write(out)
if __name__ == "__main__":
main()

74
main/data/gresource.xml Normal file
View file

@ -0,0 +1,74 @@
<?xml version="1.0" encoding="UTF-8"?>
<gresources>
<gresource prefix="/im/dino/Dino">
<file>add_conversation/add_contact_dialog.ui</file>
<file>add_conversation/add_groupchat_dialog.ui</file>
<file>add_conversation/conference_details_fragment.ui</file>
<file>add_conversation/list_row.ui</file>
<file>add_conversation/select_jid_fragment.ui</file>
<file>call_widget.ui</file>
<file>chat_input.ui</file>
<file>contact_details_dialog.ui</file>
<file>conversation_content_view/item_metadata_header.ui</file>
<file>conversation_content_view/view.ui</file>
<file>conversation_item_widget.ui</file>
<file>conversation_list_titlebar.ui</file>
<file>conversation_list_titlebar_csd.ui</file>
<file>conversation_row.ui</file>
<file>conversation_view.ui</file>
<file>dino-conversation-list-placeholder-arrow.svg</file>
<file>file_default_widget.ui</file>
<file>file_send_overlay.ui</file>
<file>global_search.ui</file>
<file>icons/scalable/actions/dino-account-plus-symbolic.svg</file>
<file>icons/scalable/actions/dino-emoticon-add-symbolic.svg</file>
<file>icons/scalable/actions/dino-emoticon-symbolic.svg</file>
<file>icons/scalable/actions/dino-qr-code-symbolic.svg</file>
<file>icons/scalable/apps/im.dino.Dino-symbolic.svg</file>
<file>icons/scalable/apps/im.dino.Dino.svg</file>
<file>icons/scalable/devices/dino-device-desktop-symbolic.svg</file>
<file>icons/scalable/devices/dino-device-phone-symbolic.svg</file>
<file>icons/scalable/devices/dino-phone-hangup-symbolic.svg</file>
<file>icons/scalable/devices/dino-phone-in-talk-symbolic.svg</file>
<file>icons/scalable/devices/dino-phone-missed-symbolic.svg</file>
<file>icons/scalable/devices/dino-phone-ring-symbolic.svg</file>
<file>icons/scalable/devices/dino-phone-symbolic.svg</file>
<file>icons/scalable/mimetypes/dino-file-document-symbolic.svg</file>
<file>icons/scalable/mimetypes/dino-file-download-symbolic.svg</file>
<file>icons/scalable/mimetypes/dino-file-image-symbolic.svg</file>
<file>icons/scalable/mimetypes/dino-file-music-symbolic.svg</file>
<file>icons/scalable/mimetypes/dino-file-symbolic.svg</file>
<file>icons/scalable/mimetypes/dino-file-table-symbolic.svg</file>
<file>icons/scalable/mimetypes/dino-file-video-symbolic.svg</file>
<file>icons/scalable/status/dino-double-tick-symbolic.svg</file>
<file>icons/scalable/status/dino-microphone-off-symbolic.svg</file>
<file>icons/scalable/status/dino-microphone-symbolic.svg</file>
<file>icons/scalable/status/dino-party-popper-symbolic.svg</file>
<file>icons/scalable/status/dino-security-high-symbolic.svg</file>
<file>icons/scalable/status/dino-status-away.svg</file>
<file>icons/scalable/status/dino-status-chat.svg</file>
<file>icons/scalable/status/dino-status-dnd.svg</file>
<file>icons/scalable/status/dino-status-online.svg</file>
<file>icons/scalable/status/dino-tick-symbolic.svg</file>
<file>icons/scalable/status/dino-video-off-symbolic.svg</file>
<file>icons/scalable/status/dino-video-symbolic.svg</file>
<file>manage_accounts/account_row.ui</file>
<file>manage_accounts/add_account_dialog.ui</file>
<file>manage_accounts/dialog.ui</file>
<file>menu_add.ui</file>
<file>menu_app.ui</file>
<file>menu_conversation.ui</file>
<file>menu_encryption.ui</file>
<file>message_item_widget_edit_mode.ui</file>
<file>occupant_list.ui</file>
<file>occupant_list_item.ui</file>
<file>quote.ui</file>
<file>search_autocomplete.ui</file>
<file>settings_dialog.ui</file>
<file>shortcuts.ui</file>
<file>style-dark.css</file>
<file>style.css</file>
<file>unified_main_content.ui</file>
<file>unified_window_placeholder.ui</file>
</gresource>
</gresources>

104
main/meson.build Normal file
View file

@ -0,0 +1,104 @@
dependencies = [
dep_dino,
dep_gee,
dep_glib,
dep_gmodule,
dep_gtk4,
dep_icu_uc,
dep_libadwaita,
dep_m,
dep_qlite,
dep_xmpp_vala,
]
sources = files(
'src/main.vala',
'src/ui/add_conversation/add_conference_dialog.vala',
'src/ui/add_conversation/add_contact_dialog.vala',
'src/ui/add_conversation/add_groupchat_dialog.vala',
'src/ui/add_conversation/conference_details_fragment.vala',
'src/ui/add_conversation/conference_list.vala',
'src/ui/add_conversation/list_row.vala',
'src/ui/add_conversation/roster_list.vala',
'src/ui/add_conversation/select_contact_dialog.vala',
'src/ui/add_conversation/select_jid_fragment.vala',
'src/ui/application.vala',
'src/ui/call_window/audio_settings_popover.vala',
'src/ui/call_window/call_bottom_bar.vala',
'src/ui/call_window/call_connection_details_window.vala',
'src/ui/call_window/call_encryption_button.vala',
'src/ui/call_window/call_window.vala',
'src/ui/call_window/call_window_controller.vala',
'src/ui/call_window/participant_widget.vala',
'src/ui/call_window/video_settings_popover.vala',
'src/ui/chat_input/chat_input_controller.vala',
'src/ui/chat_input/chat_text_view.vala',
'src/ui/chat_input/encryption_button.vala',
'src/ui/chat_input/occupants_tab_completer.vala',
'src/ui/chat_input/smiley_converter.vala',
'src/ui/chat_input/view.vala',
'src/ui/contact_details/blocking_provider.vala',
'src/ui/contact_details/dialog.vala',
'src/ui/contact_details/muc_config_form_provider.vala',
'src/ui/contact_details/permissions_provider.vala',
'src/ui/contact_details/settings_provider.vala',
'src/ui/conversation_content_view/call_widget.vala',
'src/ui/conversation_content_view/chat_state_populator.vala',
'src/ui/conversation_content_view/content_populator.vala',
'src/ui/conversation_content_view/conversation_item_skeleton.vala',
'src/ui/conversation_content_view/conversation_view.vala',
'src/ui/conversation_content_view/date_separator_populator.vala',
'src/ui/conversation_content_view/file_default_widget.vala',
'src/ui/conversation_content_view/file_image_widget.vala',
'src/ui/conversation_content_view/file_widget.vala',
'src/ui/conversation_content_view/item_actions.vala',
'src/ui/conversation_content_view/message_widget.vala',
'src/ui/conversation_content_view/quote_widget.vala',
'src/ui/conversation_content_view/reactions_widget.vala',
'src/ui/conversation_content_view/subscription_notification.vala',
'src/ui/conversation_list_titlebar.vala',
'src/ui/conversation_selector/conversation_selector.vala',
'src/ui/conversation_selector/conversation_selector_row.vala',
'src/ui/conversation_titlebar/call_entry.vala',
'src/ui/conversation_titlebar/conversation_titlebar.vala',
'src/ui/conversation_titlebar/menu_entry.vala',
'src/ui/conversation_titlebar/occupants_entry.vala',
'src/ui/conversation_titlebar/search_entry.vala',
'src/ui/conversation_view.vala',
'src/ui/conversation_view_controller.vala',
'src/ui/file_send_overlay.vala',
'src/ui/global_search.vala',
'src/ui/main_window.vala',
'src/ui/main_window_controller.vala',
'src/ui/manage_accounts/account_row.vala',
'src/ui/manage_accounts/add_account_dialog.vala',
'src/ui/manage_accounts/dialog.vala',
'src/ui/notifier_freedesktop.vala',
'src/ui/notifier_gnotifications.vala',
'src/ui/occupant_menu/list.vala',
'src/ui/occupant_menu/list_row.vala',
'src/ui/occupant_menu/view.vala',
'src/ui/settings_dialog.vala',
'src/ui/util/accounts_combo_box.vala',
'src/ui/util/config.vala',
'src/ui/util/data_forms.vala',
'src/ui/util/helper.vala',
'src/ui/util/label_hybrid.vala',
'src/ui/util/size_request_box.vala',
'src/ui/util/sizing_bin.vala',
'src/ui/widgets/avatar_picture.vala',
'src/ui/widgets/date_separator.vala',
'src/ui/widgets/fixed_ratio_picture.vala',
'src/ui/widgets/natural_size_increase.vala',
)
sources += import('gnome').compile_resources(
'dino-resources',
'data/gresource.xml',
source_dir: 'data',
)
c_args = [
'-DG_LOG_DOMAIN="dino"',
'-DGETTEXT_PACKAGE="dino"',
'-DLOCALE_INSTALL_DIR="@0@"'.format(get_option('prefix') / get_option('localedir')),
]
exe_dino = executable('dino', sources, c_args: c_args, vala_args: ['--vapidir', meson.current_source_dir() / 'vapi'], dependencies: dependencies)

23
meson.build Normal file
View file

@ -0,0 +1,23 @@
project('xmpp-vala', 'vala')
fs = import('fs')
python = import('python')
dep_gdk_pixbuf = dependency('gdk-pixbuf-2.0')
dep_gee = dependency('gee-0.8')
dep_gio = dependency('gio-2.0')
dep_glib = dependency('glib-2.0')
dep_gmodule = dependency('gmodule-2.0')
dep_gtk4 = dependency('gtk4')
dep_icu_uc = dependency('icu-uc')
dep_libadwaita = dependency('libadwaita-1')
dep_m = meson.get_compiler('c').find_library('m', required: false)
dep_sqlite3 = dependency('sqlite3', version: '>=3.24')
prog_git = find_program('git', required: false)
prog_python = python.find_installation()
subdir('qlite')
subdir('xmpp-vala')
subdir('libdino')
subdir('main')

1
meson_options.txt Normal file
View file

@ -0,0 +1 @@
option('plugindir', type: 'string', value: 'lib/dino/plugins', description: 'Plugin directory for Dino plugins')

22
qlite/meson.build Normal file
View file

@ -0,0 +1,22 @@
dependencies = [
dep_gee,
dep_glib,
dep_sqlite3,
]
sources = files(
'src/column.vala',
'src/database.vala',
'src/delete_builder.vala',
'src/insert_builder.vala',
'src/query_builder.vala',
'src/row.vala',
'src/statement_builder.vala',
'src/table.vala',
'src/update_builder.vala',
'src/upsert_builder.vala',
)
c_args = [
'-DG_LOG_DOMAIN="qlite"',
]
lib_qlite = library('qlite', sources, c_args: c_args, vala_args: ['--vapidir', meson.current_source_dir() / 'vapi'], dependencies: dependencies)
dep_qlite = declare_dependency(link_with: lib_qlite, include_directories: include_directories('.'))

133
xmpp-vala/meson.build Normal file
View file

@ -0,0 +1,133 @@
dependencies = [
dep_gdk_pixbuf,
dep_gee,
dep_gio,
dep_glib,
dep_icu_uc,
dep_m,
]
sources = files(
'src/core/direct_tls_xmpp_stream.vala',
'src/core/io_xmpp_stream.vala',
'src/core/module_flag.vala',
'src/core/namespace_state.vala',
'src/core/stanza_attribute.vala',
'src/core/stanza_node.vala',
'src/core/stanza_reader.vala',
'src/core/stanza_writer.vala',
'src/core/starttls_xmpp_stream.vala',
'src/core/stream_connect.vala',
'src/core/tls_xmpp_stream.vala',
'src/core/xmpp_log.vala',
'src/core/xmpp_stream.vala',
'src/glib_fixes.vapi',
'src/module/bind.vala',
'src/module/bookmarks_provider.vala',
'src/module/conference.vala',
'src/module/iq/module.vala',
'src/module/iq/stanza.vala',
'src/module/jid.vala',
'src/module/message/module.vala',
'src/module/message/stanza.vala',
'src/module/presence/flag.vala',
'src/module/presence/module.vala',
'src/module/presence/stanza.vala',
'src/module/roster/flag.vala',
'src/module/roster/item.vala',
'src/module/roster/module.vala',
'src/module/roster/versioning_module.vala',
'src/module/sasl.vala',
'src/module/session.vala',
'src/module/stanza.vala',
'src/module/stanza_error.vala',
'src/module/stream_error.vala',
'src/module/util.vala',
'src/module/xep/0004_data_forms.vala',
'src/module/xep/0030_service_discovery/flag.vala',
'src/module/xep/0030_service_discovery/identity.vala',
'src/module/xep/0030_service_discovery/info_result.vala',
'src/module/xep/0030_service_discovery/item.vala',
'src/module/xep/0030_service_discovery/items_result.vala',
'src/module/xep/0030_service_discovery/module.vala',
'src/module/xep/0045_muc/flag.vala',
'src/module/xep/0045_muc/module.vala',
'src/module/xep/0045_muc/status_code.vala',
'src/module/xep/0047_in_band_bytestreams.vala',
'src/module/xep/0048_bookmarks.vala',
'src/module/xep/0048_conference.vala',
'src/module/xep/0049_private_xml_storage.vala',
'src/module/xep/0054_vcard/module.vala',
'src/module/xep/0059_result_set_management.vala',
'src/module/xep/0060_pubsub.vala',
'src/module/xep/0065_socks5_bytestreams.vala',
'src/module/xep/0066_out_of_band_data.vala',
'src/module/xep/0077_in_band_registration.vala',
'src/module/xep/0082_date_time_profiles.vala',
'src/module/xep/0084_user_avatars.vala',
'src/module/xep/0085_chat_state_notifications.vala',
'src/module/xep/0115_entity_capabilities.vala',
'src/module/xep/0166_jingle/component.vala',
'src/module/xep/0166_jingle/content.vala',
'src/module/xep/0166_jingle/content_description.vala',
'src/module/xep/0166_jingle/content_node.vala',
'src/module/xep/0166_jingle/content_security.vala',
'src/module/xep/0166_jingle/content_transport.vala',
'src/module/xep/0166_jingle/jingle_flag.vala',
'src/module/xep/0166_jingle/jingle_module.vala',
'src/module/xep/0166_jingle/jingle_structs.vala',
'src/module/xep/0166_jingle/reason_element.vala',
'src/module/xep/0166_jingle/session.vala',
'src/module/xep/0166_jingle/session_info.vala',
'src/module/xep/0167_jingle_rtp/content_parameters.vala',
'src/module/xep/0167_jingle_rtp/content_type.vala',
'src/module/xep/0167_jingle_rtp/jingle_rtp_module.vala',
'src/module/xep/0167_jingle_rtp/payload_type.vala',
'src/module/xep/0167_jingle_rtp/session_info_type.vala',
'src/module/xep/0167_jingle_rtp/stream.vala',
'src/module/xep/0176_jingle_ice_udp/candidate.vala',
'src/module/xep/0176_jingle_ice_udp/jingle_ice_udp_module.vala',
'src/module/xep/0176_jingle_ice_udp/transport_parameters.vala',
'src/module/xep/0177_jingle_raw_udp.vala',
'src/module/xep/0184_message_delivery_receipts.vala',
'src/module/xep/0191_blocking_command.vala',
'src/module/xep/0198_stream_management.vala',
'src/module/xep/0199_ping.vala',
'src/module/xep/0203_delayed_delivery.vala',
'src/module/xep/0215_external_service_discovery.vala',
'src/module/xep/0234_jingle_file_transfer.vala',
'src/module/xep/0249_direct_muc_invitations.vala',
'src/module/xep/0260_jingle_socks5_bytestreams.vala',
'src/module/xep/0261_jingle_in_band_bytestreams.vala',
'src/module/xep/0272_muji.vala',
'src/module/xep/0280_message_carbons.vala',
'src/module/xep/0297_stanza_forwarding.vala',
'src/module/xep/0298_coin.vala',
'src/module/xep/0308_last_message_correction.vala',
'src/module/xep/0313_2_message_archive_management.vala',
'src/module/xep/0313_message_archive_management.vala',
'src/module/xep/0333_chat_markers.vala',
'src/module/xep/0334_message_processing_hints.vala',
'src/module/xep/0353_call_invite_message.vala',
'src/module/xep/0353_jingle_message_initiation.vala',
'src/module/xep/0359_unique_stable_stanza_ids.vala',
'src/module/xep/0363_http_file_upload.vala',
'src/module/xep/0380_explicit_encryption.vala',
'src/module/xep/0384_omemo/omemo_decryptor.vala',
'src/module/xep/0384_omemo/omemo_encryptor.vala',
'src/module/xep/0391_jingle_encrypted_transports.vala',
'src/module/xep/0392_consistent_color/consistent_color.vala',
'src/module/xep/0392_consistent_color/hsluv.vala',
'src/module/xep/0402_bookmarks2.vala',
'src/module/xep/0410_muc_self_ping.vala',
'src/module/xep/0421_occupant_ids.vala',
'src/module/xep/0428_fallback_indication.vala',
'src/module/xep/0444_reactions.vala',
'src/module/xep/0461_replies.vala',
'src/module/xep/pixbuf_storage.vala',
'src/util.vala',
)
c_args = [
'-DG_LOG_DOMAIN="xmpp-vala"',
]
lib_xmpp_vala = library('xmpp-vala', sources, c_args: c_args, vala_args: ['--vapidir', meson.current_source_dir() / 'vapi'], dependencies: dependencies)
dep_xmpp_vala = declare_dependency(link_with: lib_xmpp_vala, include_directories: include_directories('.'))