From 62ed82a49535a891acb85a2e7b9d861433db1670 Mon Sep 17 00:00:00 2001 From: hrxi Date: Thu, 22 Jun 2023 00:04:39 +0200 Subject: meson: Install more stuff Install .vapi, .deps, .h files for the Vala libraries. Also install the data files. .deps files have to be manually generated, there's a feature request for automated generation at https://github.com/mesonbuild/meson/issues/9756. Import the gnome module globally. Install dependencies on Meson CI. --- meson.build | 2 ++ 1 file changed, 2 insertions(+) (limited to 'meson.build') diff --git a/meson.build b/meson.build index aea22d57..c4b7fecf 100644 --- a/meson.build +++ b/meson.build @@ -1,6 +1,8 @@ project('xmpp-vala', 'vala') fs = import('fs') +gnome = import('gnome') +i18n = import('i18n') python = import('python') dep_gdk_pixbuf = dependency('gdk-pixbuf-2.0') -- cgit v1.2.3-54-g00ecf From 6d838c1c317164fb7e54442312f63d4cb4beaddd Mon Sep 17 00:00:00 2001 From: hrxi Date: Thu, 22 Jun 2023 00:04:59 +0200 Subject: meson: Add http-files plugin --- meson.build | 2 ++ plugins/http-files/meson.build | 22 ++++++++++++++++++++++ plugins/meson.build | 1 + 3 files changed, 25 insertions(+) create mode 100644 plugins/http-files/meson.build create mode 100644 plugins/meson.build (limited to 'meson.build') diff --git a/meson.build b/meson.build index c4b7fecf..02da2b35 100644 --- a/meson.build +++ b/meson.build @@ -13,6 +13,7 @@ dep_gmodule = dependency('gmodule-2.0') dep_gtk4 = dependency('gtk4') dep_icu_uc = dependency('icu-uc') dep_libadwaita = dependency('libadwaita-1') +dep_libsoup = dependency('libsoup-3.0') dep_m = meson.get_compiler('c').find_library('m', required: false) dep_sqlite3 = dependency('sqlite3', version: '>=3.24') @@ -23,3 +24,4 @@ subdir('qlite') subdir('xmpp-vala') subdir('libdino') subdir('main') +subdir('plugins') diff --git a/plugins/http-files/meson.build b/plugins/http-files/meson.build new file mode 100644 index 00000000..6b0f3820 --- /dev/null +++ b/plugins/http-files/meson.build @@ -0,0 +1,22 @@ +dependencies = [ + dep_dino, + dep_gee, + dep_glib, + dep_gmodule, + dep_gtk4, + dep_libsoup, + dep_qlite, + dep_xmpp_vala, +] +sources = files( + 'src/file_provider.vala', + 'src/file_sender.vala', + 'src/plugin.vala', + 'src/register_plugin.vala', +) + +vala_args = [ + '--define=SOUP_3_0', +] +lib_http_files = shared_library('http-files', sources, name_prefix: '', vala_args: vala_args, dependencies: dependencies, install: true, install_dir: get_option('libdir') / 'dino/plugins') +dep_http_files = declare_dependency(link_with: lib_http_files, include_directories: include_directories('.')) diff --git a/plugins/meson.build b/plugins/meson.build new file mode 100644 index 00000000..88fbb335 --- /dev/null +++ b/plugins/meson.build @@ -0,0 +1 @@ +subdir('http-files') -- cgit v1.2.3-54-g00ecf From 7326ca4d1b61f775666dc53adc23aae51f5b643d Mon Sep 17 00:00:00 2001 From: hrxi Date: Sun, 4 Jun 2023 09:40:29 +0200 Subject: meson: Add openpgp plugin --- meson.build | 1 + plugins/meson.build | 1 + plugins/openpgp/data/gresource.xml | 6 ++++++ plugins/openpgp/meson.build | 43 ++++++++++++++++++++++++++++++++++++++ plugins/openpgp/po/meson.build | 1 + 5 files changed, 52 insertions(+) create mode 100644 plugins/openpgp/data/gresource.xml create mode 100644 plugins/openpgp/meson.build create mode 100644 plugins/openpgp/po/meson.build (limited to 'meson.build') diff --git a/meson.build b/meson.build index 02da2b35..ef14dbec 100644 --- a/meson.build +++ b/meson.build @@ -10,6 +10,7 @@ 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_gpgme = dependency('gpgme') dep_gtk4 = dependency('gtk4') dep_icu_uc = dependency('icu-uc') dep_libadwaita = dependency('libadwaita-1') diff --git a/plugins/meson.build b/plugins/meson.build index 88fbb335..bacf9678 100644 --- a/plugins/meson.build +++ b/plugins/meson.build @@ -1 +1,2 @@ subdir('http-files') +subdir('openpgp') diff --git a/plugins/openpgp/data/gresource.xml b/plugins/openpgp/data/gresource.xml new file mode 100644 index 00000000..fbe2e8e9 --- /dev/null +++ b/plugins/openpgp/data/gresource.xml @@ -0,0 +1,6 @@ + + + + account_settings_item.ui + + diff --git a/plugins/openpgp/meson.build b/plugins/openpgp/meson.build new file mode 100644 index 00000000..806494f2 --- /dev/null +++ b/plugins/openpgp/meson.build @@ -0,0 +1,43 @@ +subdir('po') +dependencies = [ + dep_dino, + dep_gee, + dep_glib, + dep_gmodule, + dep_gpgme, + dep_gtk4, + dep_qlite, + dep_xmpp_vala, +] +sources = files( + 'src/account_settings_entry.vala', + 'src/contact_details_provider.vala', + 'src/database.vala', + 'src/encryption_list_entry.vala', + 'src/file_transfer/file_decryptor.vala', + 'src/file_transfer/file_encryptor.vala', + 'src/gpgme_fix.c', + 'src/gpgme_helper.vala', + 'src/manager.vala', + 'src/plugin.vala', + 'src/register_plugin.vala', + 'src/stream_flag.vala', + 'src/stream_module.vala', + 'src/util.vala', + 'vapi/gpg-error.vapi', +) +sources += gnome.compile_resources( + 'resources', + 'data/gresource.xml', + source_dir: 'data', +) +c_args = [ + '-DG_LOG_DOMAIN="OpenPGP"', + '-DGETTEXT_PACKAGE="dino-openpgp"', + '-DLOCALE_INSTALL_DIR="@0@"'.format(get_option('prefix') / get_option('localedir')), +] +vala_args = [ + '--vapidir', meson.current_source_dir() / 'vapi', +] +lib_openpgp = shared_library('openpgp', sources, name_prefix: '', c_args: c_args, vala_args: vala_args, include_directories: include_directories('src'), dependencies: dependencies, install: true, install_dir: get_option('libdir') / 'dino/plugins') +dep_openpgp = declare_dependency(link_with: lib_openpgp, include_directories: include_directories('.')) diff --git a/plugins/openpgp/po/meson.build b/plugins/openpgp/po/meson.build new file mode 100644 index 00000000..ac755b55 --- /dev/null +++ b/plugins/openpgp/po/meson.build @@ -0,0 +1 @@ +i18n.gettext('dino-openpgp') -- cgit v1.2.3-54-g00ecf From 7dd12e7dec0706b0d78f99e7014ee3a12079f1c6 Mon Sep 17 00:00:00 2001 From: hrxi Date: Mon, 12 Jun 2023 23:11:50 +0200 Subject: meson: Add notification-sound plugin --- meson.build | 1 + plugins/meson.build | 1 + plugins/notification-sound/meson.build | 19 +++++++++++++++++++ 3 files changed, 21 insertions(+) create mode 100644 plugins/notification-sound/meson.build (limited to 'meson.build') diff --git a/meson.build b/meson.build index ef14dbec..e08255e1 100644 --- a/meson.build +++ b/meson.build @@ -14,6 +14,7 @@ dep_gpgme = dependency('gpgme') dep_gtk4 = dependency('gtk4') dep_icu_uc = dependency('icu-uc') dep_libadwaita = dependency('libadwaita-1') +dep_libcanberra = dependency('libcanberra') dep_libsoup = dependency('libsoup-3.0') dep_m = meson.get_compiler('c').find_library('m', required: false) dep_sqlite3 = dependency('sqlite3', version: '>=3.24') diff --git a/plugins/meson.build b/plugins/meson.build index bacf9678..5b0284f6 100644 --- a/plugins/meson.build +++ b/plugins/meson.build @@ -1,2 +1,3 @@ subdir('http-files') +subdir('notification-sound') subdir('openpgp') diff --git a/plugins/notification-sound/meson.build b/plugins/notification-sound/meson.build new file mode 100644 index 00000000..5a114d86 --- /dev/null +++ b/plugins/notification-sound/meson.build @@ -0,0 +1,19 @@ +dependencies = [ + dep_dino, + dep_gdk_pixbuf, + dep_gee, + dep_glib, + dep_gmodule, + dep_libcanberra, + dep_qlite, + dep_xmpp_vala, +] +sources = files( + 'src/plugin.vala', + 'src/register_plugin.vala', +) +vala_args = [ + '--vapidir', meson.current_source_dir() / 'vapi', +] +lib_notification_sound = shared_library('notification-sound', sources, name_prefix: '', vala_args: vala_args, dependencies: dependencies, install: true, install_dir: get_option('libdir') / 'dino/plugins') +dep_notification_sound = declare_dependency(link_with: lib_notification_sound, include_directories: include_directories('.')) -- cgit v1.2.3-54-g00ecf From 7dd0e0aa4a4dffa9efa0fdf7c8929ac0e1611530 Mon Sep 17 00:00:00 2001 From: hrxi Date: Mon, 12 Jun 2023 23:43:23 +0200 Subject: meson: Add crypto-vala library --- crypto-vala/CMakeLists.txt | 2 +- crypto-vala/crypto-vala.deps | 2 + crypto-vala/meson.build | 23 ++ crypto-vala/vapi/gcrypt.vapi | 872 ---------------------------------------- crypto-vala/vapi/libgcrypt.vapi | 872 ++++++++++++++++++++++++++++++++++++++++ meson.build | 3 + 6 files changed, 901 insertions(+), 873 deletions(-) create mode 100644 crypto-vala/crypto-vala.deps create mode 100644 crypto-vala/meson.build delete mode 100644 crypto-vala/vapi/gcrypt.vapi create mode 100644 crypto-vala/vapi/libgcrypt.vapi (limited to 'meson.build') diff --git a/crypto-vala/CMakeLists.txt b/crypto-vala/CMakeLists.txt index f1f3f9d7..6dec5292 100644 --- a/crypto-vala/CMakeLists.txt +++ b/crypto-vala/CMakeLists.txt @@ -14,7 +14,7 @@ SOURCES "src/random.vala" "src/srtp.vala" CUSTOM_VAPIS - "${CMAKE_CURRENT_SOURCE_DIR}/vapi/gcrypt.vapi" + "${CMAKE_CURRENT_SOURCE_DIR}/vapi/libgcrypt.vapi" "${CMAKE_CURRENT_SOURCE_DIR}/vapi/libsrtp2.vapi" PACKAGES ${CRYPTO_VALA_PACKAGES} diff --git a/crypto-vala/crypto-vala.deps b/crypto-vala/crypto-vala.deps new file mode 100644 index 00000000..c029e7af --- /dev/null +++ b/crypto-vala/crypto-vala.deps @@ -0,0 +1,2 @@ +gio-2.0 +glib-2.0 diff --git a/crypto-vala/meson.build b/crypto-vala/meson.build new file mode 100644 index 00000000..c3feb4d1 --- /dev/null +++ b/crypto-vala/meson.build @@ -0,0 +1,23 @@ +dependencies = [ + dep_gio, + dep_glib, + dep_libgcrypt, + dep_libsrtp2, +] +sources = files( + 'src/cipher.vala', + 'src/cipher_converter.vala', + 'src/error.vala', + 'src/random.vala', + 'src/srtp.vala', +) +c_args = [ + '-DG_LOG_DOMAIN="crypto-vala"', +] +vala_args = [ + '--vapidir', meson.current_source_dir() / 'vapi', +] +lib_crypto_vala = library('crypto-vala', sources, c_args: c_args, vala_args: vala_args, dependencies: dependencies, version: '0.0', install: true, install_dir: [true, true, true]) +dep_crypto_vala = declare_dependency(link_with: lib_crypto_vala, include_directories: include_directories('.')) + +install_data('crypto-vala.deps', install_dir: get_option('datadir') / 'vala/vapi') # TODO: workaround for https://github.com/mesonbuild/meson/issues/9756 diff --git a/crypto-vala/vapi/gcrypt.vapi b/crypto-vala/vapi/gcrypt.vapi deleted file mode 100644 index 0fa69a02..00000000 --- a/crypto-vala/vapi/gcrypt.vapi +++ /dev/null @@ -1,872 +0,0 @@ -/* gcrypt.vapi - * - * Copyright: - * 2008 Jiqing Qiang - * 2008, 2010, 2012-2013 Evan Nemerson - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Author: - * Jiqing Qiang - * Evan Nemerson - */ - - -[CCode (cheader_filename = "gcrypt.h", lower_case_cprefix = "gcry_")] -namespace GCrypt { - [CCode (cname = "gpg_err_source_t", cprefix = "GPG_ERR_SOURCE_")] - public enum ErrorSource { - UNKNOWN, - GCRYPT, - GPG, - GPGSM, - GPGAGENT, - PINENTRY, - SCD, - GPGME, - KEYBOX, - KSBA, - DIRMNGR, - GSTI, - ANY, - USER_1, - USER_2, - USER_3, - USER_4, - - /* This is one more than the largest allowed entry. */ - DIM - } - - [CCode (cname = "gpg_err_code_t", cprefix = "GPG_ERR_")] - public enum ErrorCode { - NO_ERROR, - GENERAL, - UNKNOWN_PACKET, - UNKNOWN_VERSION, - PUBKEY_ALGO, - DIGEST_ALGO, - BAD_PUBKEY, - BAD_SECKEY, - BAD_SIGNATURE, - NO_PUBKEY, - CHECKSUM, - BAD_PASSPHRASE, - CIPHER_ALGO, - KEYRING_OPEN, - INV_PACKET, - INV_ARMOR, - NO_USER_ID, - NO_SECKEY, - WRONG_SECKEY, - BAD_KEY, - COMPR_ALGO, - NO_PRIME, - NO_ENCODING_METHOD, - NO_ENCRYPTION_SCHEME, - NO_SIGNATURE_SCHEME, - INV_ATTR, - NO_VALUE, - NOT_FOUND, - VALUE_NOT_FOUND, - SYNTAX, - BAD_MPI, - INV_PASSPHRASE, - SIG_CLASS, - RESOURCE_LIMIT, - INV_KEYRING, - TRUSTDB, - BAD_CERT, - INV_USER_ID, - UNEXPECTED, - TIME_CONFLICT, - KEYSERVER, - WRONG_PUBKEY_ALGO, - TRIBUTE_TO_D_A, - WEAK_KEY, - INV_KEYLEN, - INV_ARG, - BAD_URI, - INV_URI, - NETWORK, - UNKNOWN_HOST, - SELFTEST_FAILED, - NOT_ENCRYPTED, - NOT_PROCESSED, - UNUSABLE_PUBKEY, - UNUSABLE_SECKEY, - INV_VALUE, - BAD_CERT_CHAIN, - MISSING_CERT, - NO_DATA, - BUG, - NOT_SUPPORTED, - INV_OP, - TIMEOUT, - INTERNAL, - EOF_GCRYPT, - INV_OBJ, - TOO_SHORT, - TOO_LARGE, - NO_OBJ, - NOT_IMPLEMENTED, - CONFLICT, - INV_CIPHER_MODE, - INV_FLAG, - INV_HANDLE, - TRUNCATED, - INCOMPLETE_LINE, - INV_RESPONSE, - NO_AGENT, - AGENT, - INV_DATA, - ASSUAN_SERVER_FAULT, - ASSUAN, - INV_SESSION_KEY, - INV_SEXP, - UNSUPPORTED_ALGORITHM, - NO_PIN_ENTRY, - PIN_ENTRY, - BAD_PIN, - INV_NAME, - BAD_DATA, - INV_PARAMETER, - WRONG_CARD, - NO_DIRMNGR, - DIRMNGR, - CERT_REVOKED, - NO_CRL_KNOWN, - CRL_TOO_OLD, - LINE_TOO_LONG, - NOT_TRUSTED, - CANCELED, - BAD_CA_CERT, - CERT_EXPIRED, - CERT_TOO_YOUNG, - UNSUPPORTED_CERT, - UNKNOWN_SEXP, - UNSUPPORTED_PROTECTION, - CORRUPTED_PROTECTION, - AMBIGUOUS_NAME, - CARD, - CARD_RESET, - CARD_REMOVED, - INV_CARD, - CARD_NOT_PRESENT, - NO_PKCS15_APP, - NOT_CONFIRMED, - CONFIGURATION, - NO_POLICY_MATCH, - INV_INDEX, - INV_ID, - NO_SCDAEMON, - SCDAEMON, - UNSUPPORTED_PROTOCOL, - BAD_PIN_METHOD, - CARD_NOT_INITIALIZED, - UNSUPPORTED_OPERATION, - WRONG_KEY_USAGE, - NOTHING_FOUND, - WRONG_BLOB_TYPE, - MISSING_VALUE, - HARDWARE, - PIN_BLOCKED, - USE_CONDITIONS, - PIN_NOT_SYNCED, - INV_CRL, - BAD_BER, - INV_BER, - ELEMENT_NOT_FOUND, - IDENTIFIER_NOT_FOUND, - INV_TAG, - INV_LENGTH, - INV_KEYINFO, - UNEXPECTED_TAG, - NOT_DER_ENCODED, - NO_CMS_OBJ, - INV_CMS_OBJ, - UNKNOWN_CMS_OBJ, - UNSUPPORTED_CMS_OBJ, - UNSUPPORTED_ENCODING, - UNSUPPORTED_CMS_VERSION, - UNKNOWN_ALGORITHM, - INV_ENGINE, - PUBKEY_NOT_TRUSTED, - DECRYPT_FAILED, - KEY_EXPIRED, - SIG_EXPIRED, - ENCODING_PROBLEM, - INV_STATE, - DUP_VALUE, - MISSING_ACTION, - MODULE_NOT_FOUND, - INV_OID_STRING, - INV_TIME, - INV_CRL_OBJ, - UNSUPPORTED_CRL_VERSION, - INV_CERT_OBJ, - UNKNOWN_NAME, - LOCALE_PROBLEM, - NOT_LOCKED, - PROTOCOL_VIOLATION, - INV_MAC, - INV_REQUEST, - UNKNOWN_EXTN, - UNKNOWN_CRIT_EXTN, - LOCKED, - UNKNOWN_OPTION, - UNKNOWN_COMMAND, - BUFFER_TOO_SHORT, - SEXP_INV_LEN_SPEC, - SEXP_STRING_TOO_LONG, - SEXP_UNMATCHED_PAREN, - SEXP_NOT_CANONICAL, - SEXP_BAD_CHARACTER, - SEXP_BAD_QUOTATION, - SEXP_ZERO_PREFIX, - SEXP_NESTED_DH, - SEXP_UNMATCHED_DH, - SEXP_UNEXPECTED_PUNC, - SEXP_BAD_HEX_CHAR, - SEXP_ODD_HEX_NUMBERS, - SEXP_BAD_OCT_CHAR, - ASS_GENERAL, - ASS_ACCEPT_FAILED, - ASS_CONNECT_FAILED, - ASS_INV_RESPONSE, - ASS_INV_VALUE, - ASS_INCOMPLETE_LINE, - ASS_LINE_TOO_LONG, - ASS_NESTED_COMMANDS, - ASS_NO_DATA_CB, - ASS_NO_INQUIRE_CB, - ASS_NOT_A_SERVER, - ASS_NOT_A_CLIENT, - ASS_SERVER_START, - ASS_READ_ERROR, - ASS_WRITE_ERROR, - ASS_TOO_MUCH_DATA, - ASS_UNEXPECTED_CMD, - ASS_UNKNOWN_CMD, - ASS_SYNTAX, - ASS_CANCELED, - ASS_NO_INPUT, - ASS_NO_OUTPUT, - ASS_PARAMETER, - ASS_UNKNOWN_INQUIRE, - USER_1, - USER_2, - USER_3, - USER_4, - USER_5, - USER_6, - USER_7, - USER_8, - USER_9, - USER_10, - USER_11, - USER_12, - USER_13, - USER_14, - USER_15, - USER_16, - MISSING_ERRNO, - UNKNOWN_ERRNO, - EOF, - - E2BIG, - EACCES, - EADDRINUSE, - EADDRNOTAVAIL, - EADV, - EAFNOSUPPORT, - EAGAIN, - EALREADY, - EAUTH, - EBACKGROUND, - EBADE, - EBADF, - EBADFD, - EBADMSG, - EBADR, - EBADRPC, - EBADRQC, - EBADSLT, - EBFONT, - EBUSY, - ECANCELED, - ECHILD, - ECHRNG, - ECOMM, - ECONNABORTED, - ECONNREFUSED, - ECONNRESET, - ED, - EDEADLK, - EDEADLOCK, - EDESTADDRREQ, - EDIED, - EDOM, - EDOTDOT, - EDQUOT, - EEXIST, - EFAULT, - EFBIG, - EFTYPE, - EGRATUITOUS, - EGREGIOUS, - EHOSTDOWN, - EHOSTUNREACH, - EIDRM, - EIEIO, - EILSEQ, - EINPROGRESS, - EINTR, - EINVAL, - EIO, - EISCONN, - EISDIR, - EISNAM, - EL2HLT, - EL2NSYNC, - EL3HLT, - EL3RST, - ELIBACC, - ELIBBAD, - ELIBEXEC, - ELIBMAX, - ELIBSCN, - ELNRNG, - ELOOP, - EMEDIUMTYPE, - EMFILE, - EMLINK, - EMSGSIZE, - EMULTIHOP, - ENAMETOOLONG, - ENAVAIL, - ENEEDAUTH, - ENETDOWN, - ENETRESET, - ENETUNREACH, - ENFILE, - ENOANO, - ENOBUFS, - ENOCSI, - ENODATA, - ENODEV, - ENOENT, - ENOEXEC, - ENOLCK, - ENOLINK, - ENOMEDIUM, - ENOMEM, - ENOMSG, - ENONET, - ENOPKG, - ENOPROTOOPT, - ENOSPC, - ENOSR, - ENOSTR, - ENOSYS, - ENOTBLK, - ENOTCONN, - ENOTDIR, - ENOTEMPTY, - ENOTNAM, - ENOTSOCK, - ENOTSUP, - ENOTTY, - ENOTUNIQ, - ENXIO, - EOPNOTSUPP, - EOVERFLOW, - EPERM, - EPFNOSUPPORT, - EPIPE, - EPROCLIM, - EPROCUNAVAIL, - EPROGMISMATCH, - EPROGUNAVAIL, - EPROTO, - EPROTONOSUPPORT, - EPROTOTYPE, - ERANGE, - EREMCHG, - EREMOTE, - EREMOTEIO, - ERESTART, - EROFS, - ERPCMISMATCH, - ESHUTDOWN, - ESOCKTNOSUPPORT, - ESPIPE, - ESRCH, - ESRMNT, - ESTALE, - ESTRPIPE, - ETIME, - ETIMEDOUT, - ETOOMANYREFS, - ETXTBSY, - EUCLEAN, - EUNATCH, - EUSERS, - EWOULDBLOCK, - EXDEV, - EXFULL, - - /* This is one more than the largest allowed entry. */ - CODE_DIM - } - - [CCode (cname = "gcry_error_t", cprefix = "gpg_err_")] - public struct Error : uint { - [CCode (cname = "gcry_err_make")] - public Error (ErrorSource source, ErrorCode code); - [CCode (cname = "gcry_err_make_from_errno")] - public Error.from_errno (ErrorSource source, int err); - public ErrorCode code (); - public ErrorSource source (); - - [CCode (cname = "gcry_strerror")] - public unowned string to_string (); - - [CCode (cname = "gcry_strsource")] - public unowned string source_to_string (); - } - - [CCode (cname = "enum gcry_ctl_cmds", cprefix = "GCRYCTL_")] - public enum ControlCommand { - SET_KEY, - SET_IV, - CFB_SYNC, - RESET, - FINALIZE, - GET_KEYLEN, - GET_BLKLEN, - TEST_ALGO, - IS_SECURE, - GET_ASNOID, - ENABLE_ALGO, - DISABLE_ALGO, - DUMP_RANDOM_STATS, - DUMP_SECMEM_STATS, - GET_ALGO_NPKEY, - GET_ALGO_NSKEY, - GET_ALGO_NSIGN, - GET_ALGO_NENCR, - SET_VERBOSITY, - SET_DEBUG_FLAGS, - CLEAR_DEBUG_FLAGS, - USE_SECURE_RNDPOOL, - DUMP_MEMORY_STATS, - INIT_SECMEM, - TERM_SECMEM, - DISABLE_SECMEM_WARN, - SUSPEND_SECMEM_WARN, - RESUME_SECMEM_WARN, - DROP_PRIVS, - ENABLE_M_GUARD, - START_DUMP, - STOP_DUMP, - GET_ALGO_USAGE, - IS_ALGO_ENABLED, - DISABLE_INTERNAL_LOCKING, - DISABLE_SECMEM, - INITIALIZATION_FINISHED, - INITIALIZATION_FINISHED_P, - ANY_INITIALIZATION_P, - SET_CBC_CTS, - SET_CBC_MAC, - SET_CTR, - ENABLE_QUICK_RANDOM, - SET_RANDOM_SEED_FILE, - UPDATE_RANDOM_SEED_FILE, - SET_THREAD_CBS, - FAST_POLL - } - public Error control (ControlCommand cmd, ...); - - [CCode (lower_case_cname = "cipher_")] - namespace Cipher { - [CCode (cname = "enum gcry_cipher_algos", cprefix = "GCRY_CIPHER_")] - public enum Algorithm { - NONE, - IDEA, - 3DES, - CAST5, - BLOWFISH, - SAFER_SK128, - DES_SK, - AES, - AES128, - RIJNDAEL, - RIJNDAEL128, - AES192, - RIJNDAEL192, - AES256, - RIJNDAEL256, - TWOFISH, - TWOFISH128, - ARCFOUR, - DES, - SERPENT128, - SERPENT192, - SERPENT256, - RFC2268_40, - RFC2268_128, - SEED, - CAMELLIA128, - CAMELLIA192, - CAMELLIA256, - SALSA20, - SALSA20R12, - GOST28147, - CHACHA20; - - [CCode (cname = "gcry_cipher_algo_info")] - public Error info (ControlCommand what, ref uchar[] buffer); - [CCode (cname = "gcry_cipher_algo_name")] - public unowned string to_string (); - [CCode (cname = "gcry_cipher_map_name")] - public static Algorithm from_string (string name); - [CCode (cname = "gcry_cipher_map_oid")] - public static Algorithm from_oid (string oid); - } - - [CCode (cname = "enum gcry_cipher_modes", cprefix = "GCRY_CIPHER_MODE_")] - public enum Mode { - NONE, /* No mode specified */ - ECB, /* Electronic Codebook */ - CFB, /* Cipher Feedback */ - CBC, /* Cipher Block Chaining */ - STREAM, /* Used with stream ciphers */ - OFB, /* Output Feedback */ - CTR, /* Counter */ - AESWRAP, /* AES-WRAP algorithm */ - CCM, /* Counter with CBC-MAC */ - GCM, /* Galois/Counter Mode */ - POLY1305, /* Poly1305 based AEAD mode */ - OCB, /* OCB3 mode */ - CFB8, /* Cipher Feedback /* Poly1305 based AEAD mode. */ - XTS; /* XTS mode */ - - public unowned string to_string () { - switch (this) { - case ECB: return "ECB"; - case CFB: return "CFB"; - case CBC: return "CBC"; - case STREAM: return "STREAM"; - case OFB: return "OFB"; - case CTR: return "CTR"; - case AESWRAP: return "AESWRAP"; - case GCM: return "GCM"; - case POLY1305: return "POLY1305"; - case OCB: return "OCB"; - case CFB8: return "CFB8"; - case XTS: return "XTS"; - } - return "NONE"; - } - - public static Mode from_string (string name) { - switch (name) { - case "ECB": return ECB; - case "CFB": return CFB; - case "CBC": return CBC; - case "STREAM": return STREAM; - case "OFB": return OFB; - case "CTR": return CTR; - case "AESWRAP": return AESWRAP; - case "GCM": return GCM; - case "POLY1305": return POLY1305; - case "OCB": return OCB; - case "CFB8": return CFB8; - case "XTS": return XTS; - } - return NONE; - } - } - - [CCode (cname = "enum gcry_cipher_flags", cprefix = "GCRY_CIPHER_")] - public enum Flag { - SECURE, /* Allocate in secure memory. */ - ENABLE_SYNC, /* Enable CFB sync mode. */ - CBC_CTS, /* Enable CBC cipher text stealing (CTS). */ - CBC_MAC /* Enable CBC message auth. code (MAC). */ - } - [CCode (cname = "gcry_cipher_hd_t", lower_case_cprefix = "gcry_cipher_", free_function = "gcry_cipher_close")] - [SimpleType] - public struct Cipher { - public static Error open (out Cipher cipher, Algorithm algo, Mode mode, Flag flags); - public void close (); - [CCode (cname = "gcry_cipher_ctl")] - public Error control (ControlCommand cmd, uchar[] buffer); - public Error info (ControlCommand what, ref uchar[] buffer); - - public Error encrypt (uchar[] out_buffer, uchar[] in_buffer); - public Error decrypt (uchar[] out_buffer, uchar[] in_buffer); - - [CCode (cname = "gcry_cipher_setkey")] - public Error set_key (uchar[] key_data); - [CCode (cname = "gcry_cipher_setiv")] - public Error set_iv (uchar[] iv_data); - [CCode (cname = "gcry_cipher_setctr")] - public Error set_counter_vector (uchar[] counter_vector); - - [CCode (cname = "gcry_cipher_gettag")] - public Error get_tag(uchar[] out_buffer); - [CCode (cname = "gcry_cipher_checktag")] - public Error check_tag(uchar[] in_buffer); - - public Error reset (); - public Error sync (); - } - } - - [Compact, CCode (cname = "struct gcry_md_handle", cprefix = "gcry_md_", free_function = "gcry_md_close")] - public class Hash { - [CCode (cname = "enum gcry_md_algos", cprefix = "GCRY_MD_")] - public enum Algorithm { - NONE, - SHA1, - RMD160, - MD5, - MD4, - MD2, - TIGER, - TIGER1, - TIGER2, - HAVAL, - SHA224, - SHA256, - SHA384, - SHA512, - SHA3_224, - SHA3_256, - SHA3_384, - SHA3_512, - SHAKE128, - SHAKE256, - CRC32, - CRC32_RFC1510, - CRC24_RFC2440, - WHIRLPOOL, - GOSTR3411_94, - STRIBOG256, - STRIBOG512; - - [CCode (cname = "gcry_md_get_algo_dlen")] - public size_t get_digest_length (); - [CCode (cname = "gcry_md_algo_info")] - public Error info (ControlCommand what, ref uchar[] buffer); - [CCode (cname = "gcry_md_algo_name")] - public unowned string to_string (); - [CCode (cname = "gcry_md_map_name")] - public static Algorithm from_string (string name); - [CCode (cname = "gcry_md_test_algo")] - public Error is_available (); - [CCode (cname = "gcry_md_get_asnoid")] - public Error get_oid (uchar[] buffer); - } - - [CCode (cname = "enum gcry_md_flags", cprefix = "GCRY_MD_FLAG_")] - public enum Flag { - SECURE, - HMAC, - BUGEMU1 - } - - public static Error open (out Hash hash, Algorithm algo, Flag flag); - public void close (); - public Error enable (Algorithm algo); - [CCode (instance_pos = -1)] - public Error copy (out Hash dst); - public void reset (); - [CCode (cname = "enum gcry_md_ctl")] - public Error control (ControlCommand cmd, uchar[] buffer); - public void write (uchar[] buffer); - [CCode (array_length = false)] - public unowned uchar[] read (Algorithm algo); - public static void hash_buffer (Algorithm algo, [CCode (array_length = false)] uchar[] digest, uchar[] buffer); - public Algorithm get_algo (); - public bool is_enabled (Algorithm algo); - public bool is_secure (); - public Error info (ControlCommand what, uchar[] buffer); - [CCode (cname = "gcry_md_setkey")] - public Error set_key (uchar[] key_data); - public void putc (char c); - public void final (); - public static Error list (ref Algorithm[] algos); - } - - namespace Random { - [CCode (cname = "gcry_random_level_t")] - public enum Level { - [CCode (cname = "GCRY_WEAK_RANDOM")] - WEAK, - [CCode (cname = "GCRY_STRONG_RANDOM")] - STRONG, - [CCode (cname = "GCRY_VERY_STRONG_RANDOM")] - VERY_STRONG - } - - [CCode (cname = "gcry_randomize")] - public static void randomize (uchar[] buffer, Level level = Level.VERY_STRONG); - [CCode (cname = "gcry_fast_random_poll")] - public static Error poll (); - [CCode (cname = "gcry_random_bytes", array_length = false)] - public static uchar[] random_bytes (size_t nbytes, Level level = Level.VERY_STRONG); - [CCode (cname = "gcry_random_bytes_secure")] - public static uchar[] random_bytes_secure (size_t nbytes, Level level = Level.VERY_STRONG); - [CCode (cname = "gcry_create_nonce")] - public static void nonce (uchar[] buffer); - } - - [Compact, CCode (cname = "struct gcry_mpi", cprefix = "gcry_mpi_", free_function = "gcry_mpi_release")] - public class MPI { - [CCode (cname = "enum gcry_mpi_format", cprefix = "GCRYMPI_FMT_")] - public enum Format { - NONE, - STD, - PGP, - SSH, - HEX, - USG - } - - [CCode (cname = "enum gcry_mpi_flag", cprefix = "GCRYMPI_FLAG_")] - public enum Flag { - SECURE, - OPAQUE - } - - public MPI (uint nbits); - [CCode (cname = "gcry_mpi_snew")] - public MPI.secure (uint nbits); - public MPI copy (); - public void set (MPI u); - public void set_ui (ulong u); - public void swap (); - public int cmp (MPI v); - public int cmp_ui (ulong v); - - public static Error scan (out MPI ret, MPI.Format format, [CCode (array_length = false)] uchar[] buffer, size_t buflen, out size_t nscanned); - [CCode (instance_pos = -1)] - public Error print (MPI.Format format, [CCode (array_length = false)] uchar[] buffer, size_t buflen, out size_t nwritter); - [CCode (instance_pos = -1)] - public Error aprint (MPI.Format format, out uchar[] buffer); - - public void add (MPI u, MPI v); - public void add_ui (MPI u, ulong v); - public void addm (MPI u, MPI v, MPI m); - public void sub (MPI u, MPI v); - public void sub_ui (MPI u, MPI v); - public void subm (MPI u, MPI v, MPI m); - public void mul (MPI u, MPI v); - public void mul_ui (MPI u, ulong v); - public void mulm (MPI u, MPI v, MPI m); - public void mul_2exp (MPI u, ulong cnt); - public void div (MPI q, MPI r, MPI dividend, MPI divisor, int round); - public void mod (MPI dividend, MPI divisor); - public void powm (MPI b, MPI e, MPI m); - public int gcd (MPI a, MPI b); - public int invm (MPI a, MPI m); - - public uint get_nbits (); - public int test_bit (uint n); - public void set_bit (uint n); - public void clear_bit (uint n); - public void set_highbit (uint n); - public void clear_highbit (uint n); - public void rshift (MPI a, uint n); - public void lshift (MPI a, uint n); - - public void set_flag (MPI.Flag flag); - public void clear_flag (MPI.Flag flag); - public int get_flag (MPI.Flag flag); - } - - [Compact, CCode (cname = "struct gcry_sexp", free_function = "gcry_sexp_release")] - public class SExp { - [CCode (cprefix = "GCRYSEXP_FMT_")] - public enum Format { - DEFAULT, - CANON, - BASE64, - ADVANCED - } - - public static Error @new (out SExp retsexp, void * buffer, size_t length, int autodetect); - public static Error create (out SExp retsexp, void * buffer, size_t length, int autodetect, GLib.DestroyNotify free_function); - public static Error sscan (out SExp retsexp, out size_t erroff, char[] buffer); - public static Error build (out SExp retsexp, out size_t erroff, string format, ...); - public size_t sprint (Format mode, char[] buffer); - public static size_t canon_len (uchar[] buffer, out size_t erroff, out int errcode); - public SExp find_token (string token, size_t token_length = 0); - public int length (); - public SExp? nth (int number); - public SExp? car (); - public SExp? cdr (); - public unowned char[] nth_data (int number); - public gcry_string nth_string (int number); - public MPI nth_mpi (int number, MPI.Format mpifmt); - } - - [CCode (cname = "char", free_function = "gcry_free")] - public class gcry_string : string { } - - [CCode (lower_case_cprefix = "gcry_pk_")] - namespace PublicKey { - [CCode (cname = "enum gcry_pk_algos")] - public enum Algorithm { - RSA, - ELG_E, - DSA, - ELG, - ECDSA; - - [CCode (cname = "gcry_pk_algo_name")] - public unowned string to_string (); - [CCode (cname = "gcry_pk_map_name")] - public static Algorithm map_name (string name); - } - - public static Error encrypt (out SExp ciphertext, SExp data, SExp pkey); - public static Error decrypt (out SExp plaintext, SExp data, SExp skey); - public static Error sign (out SExp signature, SExp data, SExp skey); - public static Error verify (SExp signature, SExp data, SExp pkey); - public static Error testkey (SExp key); - public static Error genkey (out SExp r_key, SExp s_params); - public static uint get_nbits (SExp key); - } - - [CCode (lower_case_cprefix = "gcry_kdf_")] - namespace KeyDerivation { - [CCode (cname = "gcry_kdf_algos", cprefix = "GCRY_KDF_", has_type_id = false)] - public enum Algorithm { - NONE, - SIMPLE_S2K, - SALTED_S2K, - ITERSALTED_S2K, - PBKDF1, - PBKDF2, - SCRYPT - } - - public GCrypt.Error derive ([CCode (type = "const void*", array_length_type = "size_t")] uint8[] passphrasse, GCrypt.KeyDerivation.Algorithm algo, GCrypt.Hash.Algorithm subalgo, [CCode (type = "const void*", array_length_type = "size_t")] uint8[] salt, ulong iterations, [CCode (type = "void*", array_length_type = "size_t", array_length_pos = 5.5)] uint8[] keybuffer); - } -} diff --git a/crypto-vala/vapi/libgcrypt.vapi b/crypto-vala/vapi/libgcrypt.vapi new file mode 100644 index 00000000..0fa69a02 --- /dev/null +++ b/crypto-vala/vapi/libgcrypt.vapi @@ -0,0 +1,872 @@ +/* gcrypt.vapi + * + * Copyright: + * 2008 Jiqing Qiang + * 2008, 2010, 2012-2013 Evan Nemerson + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Author: + * Jiqing Qiang + * Evan Nemerson + */ + + +[CCode (cheader_filename = "gcrypt.h", lower_case_cprefix = "gcry_")] +namespace GCrypt { + [CCode (cname = "gpg_err_source_t", cprefix = "GPG_ERR_SOURCE_")] + public enum ErrorSource { + UNKNOWN, + GCRYPT, + GPG, + GPGSM, + GPGAGENT, + PINENTRY, + SCD, + GPGME, + KEYBOX, + KSBA, + DIRMNGR, + GSTI, + ANY, + USER_1, + USER_2, + USER_3, + USER_4, + + /* This is one more than the largest allowed entry. */ + DIM + } + + [CCode (cname = "gpg_err_code_t", cprefix = "GPG_ERR_")] + public enum ErrorCode { + NO_ERROR, + GENERAL, + UNKNOWN_PACKET, + UNKNOWN_VERSION, + PUBKEY_ALGO, + DIGEST_ALGO, + BAD_PUBKEY, + BAD_SECKEY, + BAD_SIGNATURE, + NO_PUBKEY, + CHECKSUM, + BAD_PASSPHRASE, + CIPHER_ALGO, + KEYRING_OPEN, + INV_PACKET, + INV_ARMOR, + NO_USER_ID, + NO_SECKEY, + WRONG_SECKEY, + BAD_KEY, + COMPR_ALGO, + NO_PRIME, + NO_ENCODING_METHOD, + NO_ENCRYPTION_SCHEME, + NO_SIGNATURE_SCHEME, + INV_ATTR, + NO_VALUE, + NOT_FOUND, + VALUE_NOT_FOUND, + SYNTAX, + BAD_MPI, + INV_PASSPHRASE, + SIG_CLASS, + RESOURCE_LIMIT, + INV_KEYRING, + TRUSTDB, + BAD_CERT, + INV_USER_ID, + UNEXPECTED, + TIME_CONFLICT, + KEYSERVER, + WRONG_PUBKEY_ALGO, + TRIBUTE_TO_D_A, + WEAK_KEY, + INV_KEYLEN, + INV_ARG, + BAD_URI, + INV_URI, + NETWORK, + UNKNOWN_HOST, + SELFTEST_FAILED, + NOT_ENCRYPTED, + NOT_PROCESSED, + UNUSABLE_PUBKEY, + UNUSABLE_SECKEY, + INV_VALUE, + BAD_CERT_CHAIN, + MISSING_CERT, + NO_DATA, + BUG, + NOT_SUPPORTED, + INV_OP, + TIMEOUT, + INTERNAL, + EOF_GCRYPT, + INV_OBJ, + TOO_SHORT, + TOO_LARGE, + NO_OBJ, + NOT_IMPLEMENTED, + CONFLICT, + INV_CIPHER_MODE, + INV_FLAG, + INV_HANDLE, + TRUNCATED, + INCOMPLETE_LINE, + INV_RESPONSE, + NO_AGENT, + AGENT, + INV_DATA, + ASSUAN_SERVER_FAULT, + ASSUAN, + INV_SESSION_KEY, + INV_SEXP, + UNSUPPORTED_ALGORITHM, + NO_PIN_ENTRY, + PIN_ENTRY, + BAD_PIN, + INV_NAME, + BAD_DATA, + INV_PARAMETER, + WRONG_CARD, + NO_DIRMNGR, + DIRMNGR, + CERT_REVOKED, + NO_CRL_KNOWN, + CRL_TOO_OLD, + LINE_TOO_LONG, + NOT_TRUSTED, + CANCELED, + BAD_CA_CERT, + CERT_EXPIRED, + CERT_TOO_YOUNG, + UNSUPPORTED_CERT, + UNKNOWN_SEXP, + UNSUPPORTED_PROTECTION, + CORRUPTED_PROTECTION, + AMBIGUOUS_NAME, + CARD, + CARD_RESET, + CARD_REMOVED, + INV_CARD, + CARD_NOT_PRESENT, + NO_PKCS15_APP, + NOT_CONFIRMED, + CONFIGURATION, + NO_POLICY_MATCH, + INV_INDEX, + INV_ID, + NO_SCDAEMON, + SCDAEMON, + UNSUPPORTED_PROTOCOL, + BAD_PIN_METHOD, + CARD_NOT_INITIALIZED, + UNSUPPORTED_OPERATION, + WRONG_KEY_USAGE, + NOTHING_FOUND, + WRONG_BLOB_TYPE, + MISSING_VALUE, + HARDWARE, + PIN_BLOCKED, + USE_CONDITIONS, + PIN_NOT_SYNCED, + INV_CRL, + BAD_BER, + INV_BER, + ELEMENT_NOT_FOUND, + IDENTIFIER_NOT_FOUND, + INV_TAG, + INV_LENGTH, + INV_KEYINFO, + UNEXPECTED_TAG, + NOT_DER_ENCODED, + NO_CMS_OBJ, + INV_CMS_OBJ, + UNKNOWN_CMS_OBJ, + UNSUPPORTED_CMS_OBJ, + UNSUPPORTED_ENCODING, + UNSUPPORTED_CMS_VERSION, + UNKNOWN_ALGORITHM, + INV_ENGINE, + PUBKEY_NOT_TRUSTED, + DECRYPT_FAILED, + KEY_EXPIRED, + SIG_EXPIRED, + ENCODING_PROBLEM, + INV_STATE, + DUP_VALUE, + MISSING_ACTION, + MODULE_NOT_FOUND, + INV_OID_STRING, + INV_TIME, + INV_CRL_OBJ, + UNSUPPORTED_CRL_VERSION, + INV_CERT_OBJ, + UNKNOWN_NAME, + LOCALE_PROBLEM, + NOT_LOCKED, + PROTOCOL_VIOLATION, + INV_MAC, + INV_REQUEST, + UNKNOWN_EXTN, + UNKNOWN_CRIT_EXTN, + LOCKED, + UNKNOWN_OPTION, + UNKNOWN_COMMAND, + BUFFER_TOO_SHORT, + SEXP_INV_LEN_SPEC, + SEXP_STRING_TOO_LONG, + SEXP_UNMATCHED_PAREN, + SEXP_NOT_CANONICAL, + SEXP_BAD_CHARACTER, + SEXP_BAD_QUOTATION, + SEXP_ZERO_PREFIX, + SEXP_NESTED_DH, + SEXP_UNMATCHED_DH, + SEXP_UNEXPECTED_PUNC, + SEXP_BAD_HEX_CHAR, + SEXP_ODD_HEX_NUMBERS, + SEXP_BAD_OCT_CHAR, + ASS_GENERAL, + ASS_ACCEPT_FAILED, + ASS_CONNECT_FAILED, + ASS_INV_RESPONSE, + ASS_INV_VALUE, + ASS_INCOMPLETE_LINE, + ASS_LINE_TOO_LONG, + ASS_NESTED_COMMANDS, + ASS_NO_DATA_CB, + ASS_NO_INQUIRE_CB, + ASS_NOT_A_SERVER, + ASS_NOT_A_CLIENT, + ASS_SERVER_START, + ASS_READ_ERROR, + ASS_WRITE_ERROR, + ASS_TOO_MUCH_DATA, + ASS_UNEXPECTED_CMD, + ASS_UNKNOWN_CMD, + ASS_SYNTAX, + ASS_CANCELED, + ASS_NO_INPUT, + ASS_NO_OUTPUT, + ASS_PARAMETER, + ASS_UNKNOWN_INQUIRE, + USER_1, + USER_2, + USER_3, + USER_4, + USER_5, + USER_6, + USER_7, + USER_8, + USER_9, + USER_10, + USER_11, + USER_12, + USER_13, + USER_14, + USER_15, + USER_16, + MISSING_ERRNO, + UNKNOWN_ERRNO, + EOF, + + E2BIG, + EACCES, + EADDRINUSE, + EADDRNOTAVAIL, + EADV, + EAFNOSUPPORT, + EAGAIN, + EALREADY, + EAUTH, + EBACKGROUND, + EBADE, + EBADF, + EBADFD, + EBADMSG, + EBADR, + EBADRPC, + EBADRQC, + EBADSLT, + EBFONT, + EBUSY, + ECANCELED, + ECHILD, + ECHRNG, + ECOMM, + ECONNABORTED, + ECONNREFUSED, + ECONNRESET, + ED, + EDEADLK, + EDEADLOCK, + EDESTADDRREQ, + EDIED, + EDOM, + EDOTDOT, + EDQUOT, + EEXIST, + EFAULT, + EFBIG, + EFTYPE, + EGRATUITOUS, + EGREGIOUS, + EHOSTDOWN, + EHOSTUNREACH, + EIDRM, + EIEIO, + EILSEQ, + EINPROGRESS, + EINTR, + EINVAL, + EIO, + EISCONN, + EISDIR, + EISNAM, + EL2HLT, + EL2NSYNC, + EL3HLT, + EL3RST, + ELIBACC, + ELIBBAD, + ELIBEXEC, + ELIBMAX, + ELIBSCN, + ELNRNG, + ELOOP, + EMEDIUMTYPE, + EMFILE, + EMLINK, + EMSGSIZE, + EMULTIHOP, + ENAMETOOLONG, + ENAVAIL, + ENEEDAUTH, + ENETDOWN, + ENETRESET, + ENETUNREACH, + ENFILE, + ENOANO, + ENOBUFS, + ENOCSI, + ENODATA, + ENODEV, + ENOENT, + ENOEXEC, + ENOLCK, + ENOLINK, + ENOMEDIUM, + ENOMEM, + ENOMSG, + ENONET, + ENOPKG, + ENOPROTOOPT, + ENOSPC, + ENOSR, + ENOSTR, + ENOSYS, + ENOTBLK, + ENOTCONN, + ENOTDIR, + ENOTEMPTY, + ENOTNAM, + ENOTSOCK, + ENOTSUP, + ENOTTY, + ENOTUNIQ, + ENXIO, + EOPNOTSUPP, + EOVERFLOW, + EPERM, + EPFNOSUPPORT, + EPIPE, + EPROCLIM, + EPROCUNAVAIL, + EPROGMISMATCH, + EPROGUNAVAIL, + EPROTO, + EPROTONOSUPPORT, + EPROTOTYPE, + ERANGE, + EREMCHG, + EREMOTE, + EREMOTEIO, + ERESTART, + EROFS, + ERPCMISMATCH, + ESHUTDOWN, + ESOCKTNOSUPPORT, + ESPIPE, + ESRCH, + ESRMNT, + ESTALE, + ESTRPIPE, + ETIME, + ETIMEDOUT, + ETOOMANYREFS, + ETXTBSY, + EUCLEAN, + EUNATCH, + EUSERS, + EWOULDBLOCK, + EXDEV, + EXFULL, + + /* This is one more than the largest allowed entry. */ + CODE_DIM + } + + [CCode (cname = "gcry_error_t", cprefix = "gpg_err_")] + public struct Error : uint { + [CCode (cname = "gcry_err_make")] + public Error (ErrorSource source, ErrorCode code); + [CCode (cname = "gcry_err_make_from_errno")] + public Error.from_errno (ErrorSource source, int err); + public ErrorCode code (); + public ErrorSource source (); + + [CCode (cname = "gcry_strerror")] + public unowned string to_string (); + + [CCode (cname = "gcry_strsource")] + public unowned string source_to_string (); + } + + [CCode (cname = "enum gcry_ctl_cmds", cprefix = "GCRYCTL_")] + public enum ControlCommand { + SET_KEY, + SET_IV, + CFB_SYNC, + RESET, + FINALIZE, + GET_KEYLEN, + GET_BLKLEN, + TEST_ALGO, + IS_SECURE, + GET_ASNOID, + ENABLE_ALGO, + DISABLE_ALGO, + DUMP_RANDOM_STATS, + DUMP_SECMEM_STATS, + GET_ALGO_NPKEY, + GET_ALGO_NSKEY, + GET_ALGO_NSIGN, + GET_ALGO_NENCR, + SET_VERBOSITY, + SET_DEBUG_FLAGS, + CLEAR_DEBUG_FLAGS, + USE_SECURE_RNDPOOL, + DUMP_MEMORY_STATS, + INIT_SECMEM, + TERM_SECMEM, + DISABLE_SECMEM_WARN, + SUSPEND_SECMEM_WARN, + RESUME_SECMEM_WARN, + DROP_PRIVS, + ENABLE_M_GUARD, + START_DUMP, + STOP_DUMP, + GET_ALGO_USAGE, + IS_ALGO_ENABLED, + DISABLE_INTERNAL_LOCKING, + DISABLE_SECMEM, + INITIALIZATION_FINISHED, + INITIALIZATION_FINISHED_P, + ANY_INITIALIZATION_P, + SET_CBC_CTS, + SET_CBC_MAC, + SET_CTR, + ENABLE_QUICK_RANDOM, + SET_RANDOM_SEED_FILE, + UPDATE_RANDOM_SEED_FILE, + SET_THREAD_CBS, + FAST_POLL + } + public Error control (ControlCommand cmd, ...); + + [CCode (lower_case_cname = "cipher_")] + namespace Cipher { + [CCode (cname = "enum gcry_cipher_algos", cprefix = "GCRY_CIPHER_")] + public enum Algorithm { + NONE, + IDEA, + 3DES, + CAST5, + BLOWFISH, + SAFER_SK128, + DES_SK, + AES, + AES128, + RIJNDAEL, + RIJNDAEL128, + AES192, + RIJNDAEL192, + AES256, + RIJNDAEL256, + TWOFISH, + TWOFISH128, + ARCFOUR, + DES, + SERPENT128, + SERPENT192, + SERPENT256, + RFC2268_40, + RFC2268_128, + SEED, + CAMELLIA128, + CAMELLIA192, + CAMELLIA256, + SALSA20, + SALSA20R12, + GOST28147, + CHACHA20; + + [CCode (cname = "gcry_cipher_algo_info")] + public Error info (ControlCommand what, ref uchar[] buffer); + [CCode (cname = "gcry_cipher_algo_name")] + public unowned string to_string (); + [CCode (cname = "gcry_cipher_map_name")] + public static Algorithm from_string (string name); + [CCode (cname = "gcry_cipher_map_oid")] + public static Algorithm from_oid (string oid); + } + + [CCode (cname = "enum gcry_cipher_modes", cprefix = "GCRY_CIPHER_MODE_")] + public enum Mode { + NONE, /* No mode specified */ + ECB, /* Electronic Codebook */ + CFB, /* Cipher Feedback */ + CBC, /* Cipher Block Chaining */ + STREAM, /* Used with stream ciphers */ + OFB, /* Output Feedback */ + CTR, /* Counter */ + AESWRAP, /* AES-WRAP algorithm */ + CCM, /* Counter with CBC-MAC */ + GCM, /* Galois/Counter Mode */ + POLY1305, /* Poly1305 based AEAD mode */ + OCB, /* OCB3 mode */ + CFB8, /* Cipher Feedback /* Poly1305 based AEAD mode. */ + XTS; /* XTS mode */ + + public unowned string to_string () { + switch (this) { + case ECB: return "ECB"; + case CFB: return "CFB"; + case CBC: return "CBC"; + case STREAM: return "STREAM"; + case OFB: return "OFB"; + case CTR: return "CTR"; + case AESWRAP: return "AESWRAP"; + case GCM: return "GCM"; + case POLY1305: return "POLY1305"; + case OCB: return "OCB"; + case CFB8: return "CFB8"; + case XTS: return "XTS"; + } + return "NONE"; + } + + public static Mode from_string (string name) { + switch (name) { + case "ECB": return ECB; + case "CFB": return CFB; + case "CBC": return CBC; + case "STREAM": return STREAM; + case "OFB": return OFB; + case "CTR": return CTR; + case "AESWRAP": return AESWRAP; + case "GCM": return GCM; + case "POLY1305": return POLY1305; + case "OCB": return OCB; + case "CFB8": return CFB8; + case "XTS": return XTS; + } + return NONE; + } + } + + [CCode (cname = "enum gcry_cipher_flags", cprefix = "GCRY_CIPHER_")] + public enum Flag { + SECURE, /* Allocate in secure memory. */ + ENABLE_SYNC, /* Enable CFB sync mode. */ + CBC_CTS, /* Enable CBC cipher text stealing (CTS). */ + CBC_MAC /* Enable CBC message auth. code (MAC). */ + } + [CCode (cname = "gcry_cipher_hd_t", lower_case_cprefix = "gcry_cipher_", free_function = "gcry_cipher_close")] + [SimpleType] + public struct Cipher { + public static Error open (out Cipher cipher, Algorithm algo, Mode mode, Flag flags); + public void close (); + [CCode (cname = "gcry_cipher_ctl")] + public Error control (ControlCommand cmd, uchar[] buffer); + public Error info (ControlCommand what, ref uchar[] buffer); + + public Error encrypt (uchar[] out_buffer, uchar[] in_buffer); + public Error decrypt (uchar[] out_buffer, uchar[] in_buffer); + + [CCode (cname = "gcry_cipher_setkey")] + public Error set_key (uchar[] key_data); + [CCode (cname = "gcry_cipher_setiv")] + public Error set_iv (uchar[] iv_data); + [CCode (cname = "gcry_cipher_setctr")] + public Error set_counter_vector (uchar[] counter_vector); + + [CCode (cname = "gcry_cipher_gettag")] + public Error get_tag(uchar[] out_buffer); + [CCode (cname = "gcry_cipher_checktag")] + public Error check_tag(uchar[] in_buffer); + + public Error reset (); + public Error sync (); + } + } + + [Compact, CCode (cname = "struct gcry_md_handle", cprefix = "gcry_md_", free_function = "gcry_md_close")] + public class Hash { + [CCode (cname = "enum gcry_md_algos", cprefix = "GCRY_MD_")] + public enum Algorithm { + NONE, + SHA1, + RMD160, + MD5, + MD4, + MD2, + TIGER, + TIGER1, + TIGER2, + HAVAL, + SHA224, + SHA256, + SHA384, + SHA512, + SHA3_224, + SHA3_256, + SHA3_384, + SHA3_512, + SHAKE128, + SHAKE256, + CRC32, + CRC32_RFC1510, + CRC24_RFC2440, + WHIRLPOOL, + GOSTR3411_94, + STRIBOG256, + STRIBOG512; + + [CCode (cname = "gcry_md_get_algo_dlen")] + public size_t get_digest_length (); + [CCode (cname = "gcry_md_algo_info")] + public Error info (ControlCommand what, ref uchar[] buffer); + [CCode (cname = "gcry_md_algo_name")] + public unowned string to_string (); + [CCode (cname = "gcry_md_map_name")] + public static Algorithm from_string (string name); + [CCode (cname = "gcry_md_test_algo")] + public Error is_available (); + [CCode (cname = "gcry_md_get_asnoid")] + public Error get_oid (uchar[] buffer); + } + + [CCode (cname = "enum gcry_md_flags", cprefix = "GCRY_MD_FLAG_")] + public enum Flag { + SECURE, + HMAC, + BUGEMU1 + } + + public static Error open (out Hash hash, Algorithm algo, Flag flag); + public void close (); + public Error enable (Algorithm algo); + [CCode (instance_pos = -1)] + public Error copy (out Hash dst); + public void reset (); + [CCode (cname = "enum gcry_md_ctl")] + public Error control (ControlCommand cmd, uchar[] buffer); + public void write (uchar[] buffer); + [CCode (array_length = false)] + public unowned uchar[] read (Algorithm algo); + public static void hash_buffer (Algorithm algo, [CCode (array_length = false)] uchar[] digest, uchar[] buffer); + public Algorithm get_algo (); + public bool is_enabled (Algorithm algo); + public bool is_secure (); + public Error info (ControlCommand what, uchar[] buffer); + [CCode (cname = "gcry_md_setkey")] + public Error set_key (uchar[] key_data); + public void putc (char c); + public void final (); + public static Error list (ref Algorithm[] algos); + } + + namespace Random { + [CCode (cname = "gcry_random_level_t")] + public enum Level { + [CCode (cname = "GCRY_WEAK_RANDOM")] + WEAK, + [CCode (cname = "GCRY_STRONG_RANDOM")] + STRONG, + [CCode (cname = "GCRY_VERY_STRONG_RANDOM")] + VERY_STRONG + } + + [CCode (cname = "gcry_randomize")] + public static void randomize (uchar[] buffer, Level level = Level.VERY_STRONG); + [CCode (cname = "gcry_fast_random_poll")] + public static Error poll (); + [CCode (cname = "gcry_random_bytes", array_length = false)] + public static uchar[] random_bytes (size_t nbytes, Level level = Level.VERY_STRONG); + [CCode (cname = "gcry_random_bytes_secure")] + public static uchar[] random_bytes_secure (size_t nbytes, Level level = Level.VERY_STRONG); + [CCode (cname = "gcry_create_nonce")] + public static void nonce (uchar[] buffer); + } + + [Compact, CCode (cname = "struct gcry_mpi", cprefix = "gcry_mpi_", free_function = "gcry_mpi_release")] + public class MPI { + [CCode (cname = "enum gcry_mpi_format", cprefix = "GCRYMPI_FMT_")] + public enum Format { + NONE, + STD, + PGP, + SSH, + HEX, + USG + } + + [CCode (cname = "enum gcry_mpi_flag", cprefix = "GCRYMPI_FLAG_")] + public enum Flag { + SECURE, + OPAQUE + } + + public MPI (uint nbits); + [CCode (cname = "gcry_mpi_snew")] + public MPI.secure (uint nbits); + public MPI copy (); + public void set (MPI u); + public void set_ui (ulong u); + public void swap (); + public int cmp (MPI v); + public int cmp_ui (ulong v); + + public static Error scan (out MPI ret, MPI.Format format, [CCode (array_length = false)] uchar[] buffer, size_t buflen, out size_t nscanned); + [CCode (instance_pos = -1)] + public Error print (MPI.Format format, [CCode (array_length = false)] uchar[] buffer, size_t buflen, out size_t nwritter); + [CCode (instance_pos = -1)] + public Error aprint (MPI.Format format, out uchar[] buffer); + + public void add (MPI u, MPI v); + public void add_ui (MPI u, ulong v); + public void addm (MPI u, MPI v, MPI m); + public void sub (MPI u, MPI v); + public void sub_ui (MPI u, MPI v); + public void subm (MPI u, MPI v, MPI m); + public void mul (MPI u, MPI v); + public void mul_ui (MPI u, ulong v); + public void mulm (MPI u, MPI v, MPI m); + public void mul_2exp (MPI u, ulong cnt); + public void div (MPI q, MPI r, MPI dividend, MPI divisor, int round); + public void mod (MPI dividend, MPI divisor); + public void powm (MPI b, MPI e, MPI m); + public int gcd (MPI a, MPI b); + public int invm (MPI a, MPI m); + + public uint get_nbits (); + public int test_bit (uint n); + public void set_bit (uint n); + public void clear_bit (uint n); + public void set_highbit (uint n); + public void clear_highbit (uint n); + public void rshift (MPI a, uint n); + public void lshift (MPI a, uint n); + + public void set_flag (MPI.Flag flag); + public void clear_flag (MPI.Flag flag); + public int get_flag (MPI.Flag flag); + } + + [Compact, CCode (cname = "struct gcry_sexp", free_function = "gcry_sexp_release")] + public class SExp { + [CCode (cprefix = "GCRYSEXP_FMT_")] + public enum Format { + DEFAULT, + CANON, + BASE64, + ADVANCED + } + + public static Error @new (out SExp retsexp, void * buffer, size_t length, int autodetect); + public static Error create (out SExp retsexp, void * buffer, size_t length, int autodetect, GLib.DestroyNotify free_function); + public static Error sscan (out SExp retsexp, out size_t erroff, char[] buffer); + public static Error build (out SExp retsexp, out size_t erroff, string format, ...); + public size_t sprint (Format mode, char[] buffer); + public static size_t canon_len (uchar[] buffer, out size_t erroff, out int errcode); + public SExp find_token (string token, size_t token_length = 0); + public int length (); + public SExp? nth (int number); + public SExp? car (); + public SExp? cdr (); + public unowned char[] nth_data (int number); + public gcry_string nth_string (int number); + public MPI nth_mpi (int number, MPI.Format mpifmt); + } + + [CCode (cname = "char", free_function = "gcry_free")] + public class gcry_string : string { } + + [CCode (lower_case_cprefix = "gcry_pk_")] + namespace PublicKey { + [CCode (cname = "enum gcry_pk_algos")] + public enum Algorithm { + RSA, + ELG_E, + DSA, + ELG, + ECDSA; + + [CCode (cname = "gcry_pk_algo_name")] + public unowned string to_string (); + [CCode (cname = "gcry_pk_map_name")] + public static Algorithm map_name (string name); + } + + public static Error encrypt (out SExp ciphertext, SExp data, SExp pkey); + public static Error decrypt (out SExp plaintext, SExp data, SExp skey); + public static Error sign (out SExp signature, SExp data, SExp skey); + public static Error verify (SExp signature, SExp data, SExp pkey); + public static Error testkey (SExp key); + public static Error genkey (out SExp r_key, SExp s_params); + public static uint get_nbits (SExp key); + } + + [CCode (lower_case_cprefix = "gcry_kdf_")] + namespace KeyDerivation { + [CCode (cname = "gcry_kdf_algos", cprefix = "GCRY_KDF_", has_type_id = false)] + public enum Algorithm { + NONE, + SIMPLE_S2K, + SALTED_S2K, + ITERSALTED_S2K, + PBKDF1, + PBKDF2, + SCRYPT + } + + public GCrypt.Error derive ([CCode (type = "const void*", array_length_type = "size_t")] uint8[] passphrasse, GCrypt.KeyDerivation.Algorithm algo, GCrypt.Hash.Algorithm subalgo, [CCode (type = "const void*", array_length_type = "size_t")] uint8[] salt, ulong iterations, [CCode (type = "void*", array_length_type = "size_t", array_length_pos = 5.5)] uint8[] keybuffer); + } +} diff --git a/meson.build b/meson.build index e08255e1..d0888be3 100644 --- a/meson.build +++ b/meson.build @@ -15,6 +15,8 @@ dep_gtk4 = dependency('gtk4') dep_icu_uc = dependency('icu-uc') dep_libadwaita = dependency('libadwaita-1') dep_libcanberra = dependency('libcanberra') +dep_libgcrypt = dependency('libgcrypt') +dep_libsrtp2 = dependency('libsrtp2') dep_libsoup = dependency('libsoup-3.0') dep_m = meson.get_compiler('c').find_library('m', required: false) dep_sqlite3 = dependency('sqlite3', version: '>=3.24') @@ -26,4 +28,5 @@ subdir('qlite') subdir('xmpp-vala') subdir('libdino') subdir('main') +subdir('crypto-vala') subdir('plugins') -- cgit v1.2.3-54-g00ecf From 3edda368f33c1ffbdcb76c41a32953f50b6ef6bc Mon Sep 17 00:00:00 2001 From: hrxi Date: Mon, 12 Jun 2023 23:50:16 +0200 Subject: meson: Add ice plugin --- meson.build | 2 ++ plugins/ice/meson.build | 28 ++++++++++++++++++++++++++++ plugins/meson.build | 1 + 3 files changed, 31 insertions(+) create mode 100644 plugins/ice/meson.build (limited to 'meson.build') diff --git a/meson.build b/meson.build index d0888be3..7f86f002 100644 --- a/meson.build +++ b/meson.build @@ -9,6 +9,7 @@ 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_gnutls = dependency('gnutls') dep_gmodule = dependency('gmodule-2.0') dep_gpgme = dependency('gpgme') dep_gtk4 = dependency('gtk4') @@ -18,6 +19,7 @@ dep_libcanberra = dependency('libcanberra') dep_libgcrypt = dependency('libgcrypt') dep_libsrtp2 = dependency('libsrtp2') dep_libsoup = dependency('libsoup-3.0') +dep_nice = dependency('nice', version: '>=0.1.15') dep_m = meson.get_compiler('c').find_library('m', required: false) dep_sqlite3 = dependency('sqlite3', version: '>=3.24') diff --git a/plugins/ice/meson.build b/plugins/ice/meson.build new file mode 100644 index 00000000..40e54ce3 --- /dev/null +++ b/plugins/ice/meson.build @@ -0,0 +1,28 @@ +dependencies = [ + dep_crypto_vala, + dep_dino, + dep_gdk_pixbuf, + dep_gee, + dep_glib, + dep_gmodule, + dep_gnutls, + dep_nice, + dep_qlite, + dep_xmpp_vala, +] +sources = files( + 'src/dtls_srtp.vala', + 'src/module.vala', + 'src/plugin.vala', + 'src/transport_parameters.vala', + 'src/util.vala', + 'src/register_plugin.vala', +) +c_args = [ + '-DG_LOG_DOMAIN="ice"', +] +vala_args = [ + '--vapidir', meson.current_source_dir() / 'vapi', +] +lib_ice = shared_library('ice', sources, name_prefix: '', c_args: c_args, vala_args: vala_args, dependencies: dependencies, install: true, install_dir: get_option('libdir') / 'dino/plugins') +dep_ice = declare_dependency(link_with: lib_ice, include_directories: include_directories('.')) diff --git a/plugins/meson.build b/plugins/meson.build index 5b0284f6..9a995f87 100644 --- a/plugins/meson.build +++ b/plugins/meson.build @@ -1,3 +1,4 @@ subdir('http-files') +subdir('ice') subdir('notification-sound') subdir('openpgp') -- cgit v1.2.3-54-g00ecf From 715fabb5bb793f35926180363bd6f9236d904f42 Mon Sep 17 00:00:00 2001 From: hrxi Date: Tue, 20 Jun 2023 18:54:28 +0200 Subject: meson: Add omemo plugin --- meson.build | 5 +++ plugins/meson.build | 1 + plugins/omemo/data/gresource.xml | 7 ++++ plugins/omemo/meson.build | 68 +++++++++++++++++++++++++++++++++++++++ plugins/omemo/po/meson.build | 1 + plugins/omemo/vapi/libgcrypt.vapi | 0 6 files changed, 82 insertions(+) create mode 100644 plugins/omemo/data/gresource.xml create mode 100644 plugins/omemo/meson.build create mode 100644 plugins/omemo/po/meson.build create mode 100644 plugins/omemo/vapi/libgcrypt.vapi (limited to 'meson.build') diff --git a/meson.build b/meson.build index 7f86f002..887397c2 100644 --- a/meson.build +++ b/meson.build @@ -17,7 +17,12 @@ dep_icu_uc = dependency('icu-uc') dep_libadwaita = dependency('libadwaita-1') dep_libcanberra = dependency('libcanberra') dep_libgcrypt = dependency('libgcrypt') +dep_libqrencode = dependency('libqrencode') dep_libsrtp2 = dependency('libsrtp2') +# libsignal-protocol-c has a history of breaking compatibility on the patch level +# we'll have to check compatibility for every new release +# distro maintainers may update this dependency after compatibility tests +dep_libsignal_protocol_c = dependency('libsignal-protocol-c', version: ['>=2.3.2', '<2.3.4']) dep_libsoup = dependency('libsoup-3.0') dep_nice = dependency('nice', version: '>=0.1.15') dep_m = meson.get_compiler('c').find_library('m', required: false) diff --git a/plugins/meson.build b/plugins/meson.build index 9a995f87..cf47aea8 100644 --- a/plugins/meson.build +++ b/plugins/meson.build @@ -1,4 +1,5 @@ subdir('http-files') subdir('ice') subdir('notification-sound') +subdir('omemo') subdir('openpgp') diff --git a/plugins/omemo/data/gresource.xml b/plugins/omemo/data/gresource.xml new file mode 100644 index 00000000..616dcdc1 --- /dev/null +++ b/plugins/omemo/data/gresource.xml @@ -0,0 +1,7 @@ + + + + contact_details_dialog.ui + manage_key_dialog.ui + + diff --git a/plugins/omemo/meson.build b/plugins/omemo/meson.build new file mode 100644 index 00000000..57eec2ce --- /dev/null +++ b/plugins/omemo/meson.build @@ -0,0 +1,68 @@ +subdir('po') +dependencies = [ + dep_crypto_vala, + dep_dino, + dep_gee, + dep_glib, + dep_gmodule, + dep_gtk4, + dep_libgcrypt, + dep_libqrencode, + dep_libsignal_protocol_c, + dep_qlite, + dep_xmpp_vala, +] +sources = files( + 'src/dtls_srtp_verification_draft.vala', + 'src/file_transfer/file_decryptor.vala', + 'src/file_transfer/file_encryptor.vala', + 'src/jingle/jet_omemo.vala', + 'src/jingle/jingle_helper.vala', + 'src/logic/database.vala', + 'src/logic/decrypt.vala', + 'src/logic/encrypt.vala', + 'src/logic/manager.vala', + 'src/logic/pre_key_store.vala', + 'src/logic/session_store.vala', + 'src/logic/signed_pre_key_store.vala', + 'src/logic/trust_manager.vala', + 'src/plugin.vala', + 'src/protocol/bundle.vala', + 'src/protocol/message_flag.vala', + 'src/protocol/stream_module.vala', + 'src/register_plugin.vala', + 'src/signal/context.vala', + 'src/signal/signal_helper.c', + 'src/signal/simple_iks.vala', + 'src/signal/simple_pks.vala', + 'src/signal/simple_spks.vala', + 'src/signal/simple_ss.vala', + 'src/signal/store.vala', + 'src/signal/util.vala', + 'src/trust_level.vala', + 'src/ui/account_settings_entry.vala', + 'src/ui/bad_messages_populator.vala', + 'src/ui/call_encryption_entry.vala', + 'src/ui/contact_details_dialog.vala', + 'src/ui/contact_details_provider.vala', + 'src/ui/device_notification_populator.vala', + 'src/ui/encryption_list_entry.vala', + 'src/ui/manage_key_dialog.vala', + 'src/ui/own_notifications.vala', + 'src/ui/util.vala', +) +sources += gnome.compile_resources( + 'resources', + 'data/gresource.xml', + source_dir: 'data', +) +c_args = [ + '-DG_LOG_DOMAIN="OMEMO"', + '-DGETTEXT_PACKAGE="dino-omemo"', + '-DLOCALE_INSTALL_DIR="@0@"'.format(get_option('prefix') / get_option('localedir')), +] +vala_args = [ + '--vapidir', meson.current_source_dir() / 'vapi', +] +lib_omemo = shared_library('omemo', sources, name_prefix: '', c_args: c_args, vala_args: vala_args, include_directories: include_directories('src'), dependencies: dependencies, install: true, install_dir: get_option('libdir') / 'dino/plugins') +dep_omemo = declare_dependency(link_with: lib_omemo, include_directories: include_directories('.')) diff --git a/plugins/omemo/po/meson.build b/plugins/omemo/po/meson.build new file mode 100644 index 00000000..fa22f211 --- /dev/null +++ b/plugins/omemo/po/meson.build @@ -0,0 +1 @@ +i18n.gettext('dino-omemo') diff --git a/plugins/omemo/vapi/libgcrypt.vapi b/plugins/omemo/vapi/libgcrypt.vapi new file mode 100644 index 00000000..e69de29b -- cgit v1.2.3-54-g00ecf From e6938c29653743974eb4f03d2a988cef50d0adbc Mon Sep 17 00:00:00 2001 From: hrxi Date: Tue, 20 Jun 2023 19:46:41 +0200 Subject: meson: Add rtp plugin --- meson.build | 8 +++++- plugins/meson.build | 1 + plugins/rtp/meson.build | 41 +++++++++++++++++++++++++++ plugins/rtp/vapi/webrtc-audio-processing.vapi | 0 4 files changed, 49 insertions(+), 1 deletion(-) create mode 100644 plugins/rtp/meson.build create mode 100644 plugins/rtp/vapi/webrtc-audio-processing.vapi (limited to 'meson.build') diff --git a/meson.build b/meson.build index 887397c2..e3c6b72e 100644 --- a/meson.build +++ b/meson.build @@ -1,4 +1,4 @@ -project('xmpp-vala', 'vala') +project('xmpp-vala', 'c', 'cpp', 'vala') fs = import('fs') gnome = import('gnome') @@ -12,6 +12,11 @@ dep_glib = dependency('glib-2.0') dep_gnutls = dependency('gnutls') dep_gmodule = dependency('gmodule-2.0') dep_gpgme = dependency('gpgme') +dep_gstreamer = dependency('gstreamer-1.0') +dep_gstreamer_app = dependency('gstreamer-app-1.0') +dep_gstreamer_audio = dependency('gstreamer-audio-1.0') +dep_gstreamer_rtp = dependency('gstreamer-rtp-1.0') +dep_gstreamer_video = dependency('gstreamer-video-1.0') dep_gtk4 = dependency('gtk4') dep_icu_uc = dependency('icu-uc') dep_libadwaita = dependency('libadwaita-1') @@ -27,6 +32,7 @@ dep_libsoup = dependency('libsoup-3.0') dep_nice = dependency('nice', version: '>=0.1.15') dep_m = meson.get_compiler('c').find_library('m', required: false) dep_sqlite3 = dependency('sqlite3', version: '>=3.24') +dep_webrtc_audio_processing = dependency('webrtc-audio-processing', version: ['>=0.2', '<0.4']) prog_git = find_program('git', required: false) prog_python = python.find_installation() diff --git a/plugins/meson.build b/plugins/meson.build index cf47aea8..196e3634 100644 --- a/plugins/meson.build +++ b/plugins/meson.build @@ -3,3 +3,4 @@ subdir('ice') subdir('notification-sound') subdir('omemo') subdir('openpgp') +subdir('rtp') diff --git a/plugins/rtp/meson.build b/plugins/rtp/meson.build new file mode 100644 index 00000000..d4d37e36 --- /dev/null +++ b/plugins/rtp/meson.build @@ -0,0 +1,41 @@ +dependencies = [ + dep_gee, + dep_glib, + dep_gmodule, + dep_gnutls, + dep_gtk4, + dep_gstreamer, + dep_gstreamer_app, + dep_gstreamer_audio, + dep_gstreamer_rtp, + dep_gstreamer_video, + dep_crypto_vala, + dep_dino, + dep_qlite, + dep_webrtc_audio_processing, + dep_xmpp_vala, +] +sources = files( + 'src/codec_util.vala', + 'src/device.vala', + 'src/gst_fixes.c', + 'src/module.vala', + 'src/plugin.vala', + 'src/register_plugin.vala', + 'src/stream.vala', + 'src/video_widget.vala', + 'src/voice_processor.vala', + 'src/voice_processor_native.cpp', +) +c_args = [ + '-DGST_1_16', + '-DGST_1_18', + '-DGST_1_20', + '-DWITH_VOICE_PROCESSOR', + '-DG_LOG_DOMAIN="rtp"', +] +vala_args = [ + '--vapidir', meson.current_source_dir() / 'vapi', +] +lib_rtp = shared_library('rtp', sources, name_prefix: '', c_args: c_args, vala_args: vala_args, include_directories: include_directories('src'), dependencies: dependencies, install: true, install_dir: get_option('libdir') / 'dino/plugins') +dep_rtp = declare_dependency(link_with: lib_rtp, include_directories: include_directories('.')) diff --git a/plugins/rtp/vapi/webrtc-audio-processing.vapi b/plugins/rtp/vapi/webrtc-audio-processing.vapi new file mode 100644 index 00000000..e69de29b -- cgit v1.2.3-54-g00ecf From bfc1962f70cebdd2933218052a172bed73d06fb9 Mon Sep 17 00:00:00 2001 From: hrxi Date: Sat, 30 Sep 2023 02:28:50 +0200 Subject: meson: Allow enabling/disabling plugins --- meson.build | 50 +++++++++++++++++++++++++++++++++++--------------- meson_options.txt | 7 +++++++ 2 files changed, 42 insertions(+), 15 deletions(-) (limited to 'meson.build') diff --git a/meson.build b/meson.build index e3c6b72e..3276158f 100644 --- a/meson.build +++ b/meson.build @@ -5,34 +5,54 @@ gnome = import('gnome') i18n = import('i18n') python = import('python') +# plugin_crypto is enabled if any of the crypto plugins is enabled, auto if +# none of them are explicitly enabled but at least one is set to auto, or +# disabled if all of them are disabled. +plugin_crypto = get_option('plugin-ice') +foreach plugin : ['plugin-ice', 'plugin-omemo', 'plugin-rtp'] + if get_option(plugin).enabled() and not plugin_crypto.enabled() + plugin_crypto = get_option(plugin) + elif get_option(plugin).allowed() and not plugin_crypto.allowed() + plugin_crypto = get_option(plugin) + endif +endforeach + +if get_option('plugin-ice').enabled() and not get_option('plugin-rtp').enabled() + dep_gnutls_required = get_option('plugin-ice') +elif get_option('plugin-ice').allowed() and not get_option('plugin-rtp').allowed() + dep_gnutls_required = get_option('plugin-ice') +else + dep_gnutls_required = get_option('plugin-rtp') +endif + 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_gnutls = dependency('gnutls') +dep_gnutls = dependency('gnutls', disabler: true, required: dep_gnutls_required) dep_gmodule = dependency('gmodule-2.0') -dep_gpgme = dependency('gpgme') -dep_gstreamer = dependency('gstreamer-1.0') -dep_gstreamer_app = dependency('gstreamer-app-1.0') -dep_gstreamer_audio = dependency('gstreamer-audio-1.0') -dep_gstreamer_rtp = dependency('gstreamer-rtp-1.0') -dep_gstreamer_video = dependency('gstreamer-video-1.0') +dep_gpgme = dependency('gpgme', disabler: true, required: get_option('plugin-openpgp')) +dep_gstreamer = dependency('gstreamer-1.0', disabler: true, required: get_option('plugin-rtp')) +dep_gstreamer_app = dependency('gstreamer-app-1.0', disabler: true, required: get_option('plugin-rtp')) +dep_gstreamer_audio = dependency('gstreamer-audio-1.0', disabler: true, required: get_option('plugin-rtp')) +dep_gstreamer_rtp = dependency('gstreamer-rtp-1.0', disabler: true, required: get_option('plugin-rtp')) +dep_gstreamer_video = dependency('gstreamer-video-1.0', disabler: true, required: get_option('plugin-rtp')) dep_gtk4 = dependency('gtk4') dep_icu_uc = dependency('icu-uc') dep_libadwaita = dependency('libadwaita-1') -dep_libcanberra = dependency('libcanberra') -dep_libgcrypt = dependency('libgcrypt') -dep_libqrencode = dependency('libqrencode') -dep_libsrtp2 = dependency('libsrtp2') +dep_libcanberra = dependency('libcanberra', disabler: true, required: get_option('plugin-notification-sound')) +dep_libgcrypt = dependency('libgcrypt', disabler: true, required: plugin_crypto) +dep_libqrencode = dependency('libqrencode', disabler: true, required: get_option('plugin-omemo')) +dep_libsrtp2 = dependency('libsrtp2', disabler: true, required: plugin_crypto) # libsignal-protocol-c has a history of breaking compatibility on the patch level # we'll have to check compatibility for every new release # distro maintainers may update this dependency after compatibility tests -dep_libsignal_protocol_c = dependency('libsignal-protocol-c', version: ['>=2.3.2', '<2.3.4']) -dep_libsoup = dependency('libsoup-3.0') -dep_nice = dependency('nice', version: '>=0.1.15') +dep_libsignal_protocol_c = dependency('libsignal-protocol-c', version: ['>=2.3.2', '<2.3.4'], disabler: true, required: get_option('plugin-omemo')) +dep_libsoup = dependency('libsoup-3.0', disabler: true, required: get_option('plugin-http-files')) +dep_nice = dependency('nice', version: '>=0.1.15', disabler: true, required: get_option('plugin-ice')) dep_m = meson.get_compiler('c').find_library('m', required: false) dep_sqlite3 = dependency('sqlite3', version: '>=3.24') -dep_webrtc_audio_processing = dependency('webrtc-audio-processing', version: ['>=0.2', '<0.4']) +dep_webrtc_audio_processing = dependency('webrtc-audio-processing', version: ['>=0.2', '<0.4'], disabler: true, required: get_option('plugin-rtp')) prog_git = find_program('git', required: false) prog_python = python.find_installation() diff --git a/meson_options.txt b/meson_options.txt index a1dcd3c2..ee0ac3c0 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -1 +1,8 @@ option('plugindir', type: 'string', value: 'lib/dino/plugins', description: 'Dino plugin directory') + +option('plugin-http-files', type: 'feature', description: 'HTTP file upload') +option('plugin-ice', type: 'feature', description: '') +option('plugin-notification-sound', type: 'feature', description: 'Sound for chat notifications') +option('plugin-omemo', type: 'feature', description: 'End-to-end encryption') +option('plugin-openpgp', type: 'feature', description: 'End-to-end encryption using PGP') +option('plugin-rtp', type: 'feature', description: 'Voice/video calls') -- cgit v1.2.3-54-g00ecf From a55a10e88f88a4650aa6a83927ea38960aa26935 Mon Sep 17 00:00:00 2001 From: hrxi Date: Sat, 30 Sep 2023 03:05:11 +0200 Subject: meson: Add RTP options that are also present in the CMakeLists.txt --- meson.build | 2 +- meson_options.txt | 6 ++++++ plugins/rtp/meson.build | 31 ++++++++++++++++++++++++------- 3 files changed, 31 insertions(+), 8 deletions(-) (limited to 'meson.build') diff --git a/meson.build b/meson.build index 3276158f..4ad18477 100644 --- a/meson.build +++ b/meson.build @@ -52,7 +52,7 @@ dep_libsoup = dependency('libsoup-3.0', disabler: true, required: get_option('pl dep_nice = dependency('nice', version: '>=0.1.15', disabler: true, required: get_option('plugin-ice')) dep_m = meson.get_compiler('c').find_library('m', required: false) dep_sqlite3 = dependency('sqlite3', version: '>=3.24') -dep_webrtc_audio_processing = dependency('webrtc-audio-processing', version: ['>=0.2', '<0.4'], disabler: true, required: get_option('plugin-rtp')) +dep_webrtc_audio_processing = dependency('webrtc-audio-processing', version: ['>=0.2', '<0.4'], required: get_option('plugin-rtp-webrtc-audio-processing')) prog_git = find_program('git', required: false) prog_python = python.find_installation() diff --git a/meson_options.txt b/meson_options.txt index ee0ac3c0..caee3093 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -6,3 +6,9 @@ option('plugin-notification-sound', type: 'feature', description: 'Sound for cha option('plugin-omemo', type: 'feature', description: 'End-to-end encryption') option('plugin-openpgp', type: 'feature', description: 'End-to-end encryption using PGP') option('plugin-rtp', type: 'feature', description: 'Voice/video calls') + +option('plugin-rtp-h264', type: 'feature', value: 'disabled', description: 'H264 codec') +option('plugin-rtp-msdk', type: 'feature', value: 'disabled', description: 'Intel MediaSDK') +option('plugin-rtp-vaapi', type: 'feature', value: 'disabled', description: 'Video Acceleration API') +option('plugin-rtp-vp9', type: 'feature', value: 'disabled', description: 'VP9 codec') +option('plugin-rtp-webrtc-audio-processing', type: 'feature', description: 'Voice preprocessing') diff --git a/plugins/rtp/meson.build b/plugins/rtp/meson.build index d4d37e36..8a72dc41 100644 --- a/plugins/rtp/meson.build +++ b/plugins/rtp/meson.build @@ -1,18 +1,18 @@ dependencies = [ + dep_crypto_vala, + dep_dino, dep_gee, dep_glib, dep_gmodule, dep_gnutls, - dep_gtk4, dep_gstreamer, dep_gstreamer_app, dep_gstreamer_audio, dep_gstreamer_rtp, dep_gstreamer_video, - dep_crypto_vala, - dep_dino, + dep_gtk4, + dep_m, dep_qlite, - dep_webrtc_audio_processing, dep_xmpp_vala, ] sources = files( @@ -24,18 +24,35 @@ sources = files( 'src/register_plugin.vala', 'src/stream.vala', 'src/video_widget.vala', - 'src/voice_processor.vala', - 'src/voice_processor_native.cpp', ) c_args = [ '-DGST_1_16', '-DGST_1_18', '-DGST_1_20', - '-DWITH_VOICE_PROCESSOR', '-DG_LOG_DOMAIN="rtp"', ] vala_args = [ '--vapidir', meson.current_source_dir() / 'vapi', ] +if dep_webrtc_audio_processing.found() + dependencies += [dep_webrtc_audio_processing] + sources += files( + 'src/voice_processor.vala', + 'src/voice_processor_native.cpp', + ) + vala_args += ['-D', 'WITH_VOICE_PROCESSOR'] +endif +if get_option('plugin-rtp-h264').allowed() + vala_args += ['-D', 'ENABLE_H264'] +endif +if get_option('plugin-rtp-msdk').allowed() + vala_args += ['-D', 'ENABLE_MSDK'] +endif +if get_option('plugin-rtp-vaapi').allowed() + vala_args += ['-D', 'ENABLE_VAAPI'] +endif +if get_option('plugin-rtp-vp9').allowed() + vala_args += ['-D', 'ENABLE_VP9'] +endif lib_rtp = shared_library('rtp', sources, name_prefix: '', c_args: c_args, vala_args: vala_args, include_directories: include_directories('src'), dependencies: dependencies, install: true, install_dir: get_option('libdir') / 'dino/plugins') dep_rtp = declare_dependency(link_with: lib_rtp, include_directories: include_directories('.')) -- cgit v1.2.3-54-g00ecf