diff --git a/README b/README index c192fc6be4f4b3c73353d59404d299c11d631726..e67f671ec244fe999a32dcca0e9fd65af23e477f 100644 --- a/README +++ b/README @@ -19,7 +19,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. Introduction ------------ -GNU Ring is a Voice-over-IP software phone. We want it to be: +GNU Jami is a Voice-over-IP software phone. We want it to be: - user friendly (fast, sleek, easy to learn interface) - professional grade (transfers, holds, optimal audio quality) - compatible with Asterisk (using SIP account) @@ -27,17 +27,17 @@ GNU Ring is a Voice-over-IP software phone. We want it to be: - customizable As the SIP/audio daemon and the user interface are separate processes, -it is easy to provide different user interfaces. GNU Ring comes with +it is easy to provide different user interfaces. GNU Jami comes with various graphical user interfaces and even scripts to control the daemon from the shell. -GNU Ring is currently used by the support team of Savoir-faire Linux Inc. +GNU Jami is currently used by the support team of Savoir-faire Linux Inc. More information is available on the project homepage: https://www.jami.net/ -This source tree contains the daemon application only, DRing, that handles -the business logic of GNU Ring. UIs are located in differents repositories. See +This source tree contains the daemon application only that handles +the business logic of GNU Jami. UIs are located in differents repositories. See the Contributing section for more information. @@ -47,7 +47,6 @@ Short description of content of source tree - src/ is the core of DRing. - bin/ contains applications main code. - bin/dbus, the D-Bus XML interfaces, and C++ bindings -- bin/restcpp, the C++ REST API implemented with Restinio About Savoir-faire Linux ------------------------ @@ -68,19 +67,54 @@ cd native ../bootstrap make -2) Then the dring application +2) Then the jamid application cd ../../ -./autogen.sh -./configure -make -make install +mkdir build +export PATH=$PATH:`pwd`/contrib/`cc -dumpmachine`/bin +meson -Dpkg_config_path=`pwd`/contrib/`cc -dumpmachine`/lib/pkgconfig -Ddefault_library=static -Dinterfaces=dbus build +cd build +ninja +ninja install Done ! More details available here: https://git.jami.net/savoirfairelinux/ring-project/wikis/technical/Build-instructions +How to compile on Linux for Android +----------------------------------- + +1) Download and install Android NDK +2) Compile the dependencies + +export ANDROID_NDK=<NDK> +export ANDROID_ABI=arm64-v8a +export ANDROID_API=29 +export TOOLCHAIN=$ANDROID_NDK/toolchains/llvm/prebuilt/linux-x86_64 +export TARGET=aarch64-linux-android +export CC=$TOOLCHAIN/bin/$TARGET$ANDROID_API-clang +export CXX=$TOOLCHAIN/bin/$TARGET$ANDROID_API-clang++ +export AR=$TOOLCHAIN/bin/$TARGET-ar +export LD=$TOOLCHAIN/bin/$TARGET-ld +export RANLIB=$TOOLCHAIN/bin/$TARGET-ranlib +export STRIP=$TOOLCHAIN/bin/$TARGET-strip +export PATH=$PATH:$TOOLCHAIN/bin +cd contrib +mkdir native +cd native +../bootstrap --build=x86_64-pc-linux-gnu --host=$TARGET$ANDROID_API +make + +3) Update directories in the file /cross-files/android_arm64_api29.txt +4) Compile the library libjami.so + +cd ../../ +mkdir build +meson --cross-file `pwd`/cross-files/android_arm64_api29.txt build +cd build +ninja +ninja install How to compile on OSX --------------------- @@ -125,7 +159,7 @@ Run: 'brew link --force gettext' to fix it. Clang compatibility (developers only) ------------------------------------- -It is possible to compile dring with Clang by setting CC and CXX variables +It is possible to compile jamid with Clang by setting CC and CXX variables to 'clang' and 'clang++' respectively when calling ./configure. Currently it is not possible to use the DBus interface mechanism, and the @@ -133,26 +167,6 @@ interaction between daemon and client will not work; for each platform where D-Bus is not available the client should implement all the methods in the *_stub.cpp files. -How to compile with the REST API --------------------------------- - -GNU Ring offers two REST API. One written in C++, and the other written in Cython. -Up to this date, only the C++ API is available. The Cython API will soon follow. - -To compile Ring-daemon with the C++ REST API, follow these two steps : - -1) Compile the dependencies -cd contrib -mkdir native -cd native -../bootstrap -make - -2) Then compile the daemon -cd ../../ -./autogen.sh -./configure --without-dbus --with-restcpp -make SIP accounts --------------------- @@ -162,7 +176,7 @@ clients (KDE and GNOME). By doing this, you will be able to call other accounts known to this server. -Contributing to GNU Ring +Contributing to GNU Jami ------------------------ Of course we love patches. And contributions. And spring rolls. @@ -175,10 +189,10 @@ contains the client subprojects: - https://gerrit-ring.savoirfairelinux.com/#/admin/projects/ Do not hesitate to join us and post comments, suggestions, questions -and general feedback on the GNU Ring mailing-list: +and general feedback on the GNU Jami mailing-list: https://lists.gnu.org/mailman/listinfo/ring IRC (on #freenode): - #ring - -- The GNU Ring Team + -- The GNU Jami Team diff --git a/bin/dbus/dbusvideomanager.cpp b/bin/dbus/dbusvideomanager.cpp index 8568d9ad6a0e2ac2157f06675fea87d6d57e1f1c..8c0fbb485cf97cd79c0e1cf3e00ca2c4b5d1906d 100644 --- a/bin/dbus/dbusvideomanager.cpp +++ b/bin/dbus/dbusvideomanager.cpp @@ -19,7 +19,7 @@ */ #include "dbusvideomanager.h" -#include "client/videomanager.h" +#include "dring/videomanager_interface.h" DBusVideoManager::DBusVideoManager(DBus::Connection& connection) : DBus::ObjectAdaptor(connection, "/cx/ring/Ring/VideoManager") diff --git a/bin/dbus/jamid.pod b/bin/dbus/jamid.pod new file mode 100644 index 0000000000000000000000000000000000000000..51c9941c2496a4588051a9e7b614686a87be2fcd --- /dev/null +++ b/bin/dbus/jamid.pod @@ -0,0 +1,64 @@ +=head1 NAME + +jamid - core daemon for Jami: secure and distributed voice, video and chat communication platform. + +=head1 SYNOPSIS + +B<jamid> [OPTION]... + +=head1 DESCRIPTION + +Jami is meant to be a robust enterprise-class desktop phone. It provides functions like call transfer, call hold, multiple lines, multiple accounts support. +Jami audio layer is build upon a native ALSA interface and a native PulseAudio interface. +B<jamid> is the core of Jami; it provides the DBus service "cx.ring.Ring". You need to install a client to use the daemon, for instance GTK+ client, B<jami-gnome>. + +=head1 OPTIONS + +=over 8 + +=item B<-c, --console> + +Output the log to the console instead of syslog. + +=item B<-d, --debug> + +Debug mode (more verbose output). + +=item B<-a, --auto-answer> + +Force automatic answer to incoming calls. + +=item B<-p, --persistent> + +Stay alive after all clients quit. + +=item B<-h, --help> + +Print short list of command-line options. + +=back + +=head1 BUGS + +Please report bugs at https://git.jami.net. + +=head1 AUTHORS + +B<jamid> is developed in Montreal by Savoir-faire Linux Inc. + +This manual page was written by Emmanuel Milou <emmanuel.milou@savoirfairelinux.com>. + +=head1 SEE ALSO + +B<jami-gnome>(1) + +=head1 COPYRIGHT + +This program is free software; you can redistribute it and/or modify it +under the terms of the GNU General Public License version 3 as published by the +Free Software Foundation. + +On Debian GNU/Linux systems, the complete text of the GNU General +Public License can be found in `/usr/share/common-licenses/GPL'. + +=cut diff --git a/bin/dbus/main.cpp b/bin/dbus/main.cpp new file mode 100644 index 0000000000000000000000000000000000000000..49f4cce061823824be32c5f630e10bfd9951987a --- /dev/null +++ b/bin/dbus/main.cpp @@ -0,0 +1,187 @@ +/* + * Copyright (C) 2004-2020 Savoir-faire Linux Inc. + * + * Author: Alexandre Bourget <alexandre.bourget@savoirfairelinux.com> + * Author: Yan Morin <yan.morin@savoirfairelinux.com> + * Author: Laurielle Lea <laurielle.lea@savoirfairelinux.com> + * Author: Simon Zeni <simon.zeni@savoirfairelinux.com> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#include "dbusclient.h" +#include "dring/dring.h" + +#include <signal.h> +#include <getopt.h> + +#include <iostream> +#include <thread> +#include <memory> +#include <cstring> +#include <cstdlib> + +static int ringFlags = 0; +static std::weak_ptr<DBusClient> weakClient; + +static void +print_title() +{ + std::cout + << "Jami Daemon " << DRing::version() + << ", by Savoir-faire Linux 2004-2020" << std::endl + << "https://jami.net/" << std::endl +#ifdef ENABLE_VIDEO + << "[Video support enabled]" << std::endl +#endif + << std::endl; +} + +static void +print_usage() +{ + std::cout << std::endl << + "-c, --console \t- Log in console (instead of syslog)" << std::endl << + "-d, --debug \t- Debug mode (more verbose)" << std::endl << + "-p, --persistent \t- Stay alive after client quits" << std::endl << + "--auto-answer \t- Force automatic answer to incoming calls" << std::endl << + "-h, --help \t- Print help" << std::endl; +} + +// Parse command line arguments, setting debug options or printing a help +// message accordingly. +// returns true if we should quit (i.e. help was printed), false otherwise +static bool +parse_args(int argc, char *argv[], bool& persistent) +{ + int consoleFlag = false; + int debugFlag = false; + int helpFlag = false; + int versionFlag = false; + int autoAnswer = false; + + const struct option long_options[] = { + /* These options set a flag. */ + {"debug", no_argument, nullptr, 'd'}, + {"console", no_argument, nullptr, 'c'}, + {"persistent", no_argument, nullptr, 'p'}, + {"help", no_argument, nullptr, 'h'}, + {"version", no_argument, nullptr, 'v'}, + {"auto-answer", no_argument, &autoAnswer, true}, + {nullptr, 0, nullptr, 0} /* Sentinel */ + }; + + while (true) { + /* getopt_long stores the option index here. */ + int option_index = 0; + + auto c = getopt_long(argc, argv, "dcphv:", long_options, &option_index); + + // end of the options + if (c == -1) + break; + + switch (c) { + case 'd': + debugFlag = true; + break; + + case 'c': + consoleFlag = true; + break; + + case 'p': + persistent = true; + break; + + case 'h': + case '?': + helpFlag = true; + break; + + case 'v': + versionFlag = true; + break; + + default: + break; + } + } + + if (helpFlag) { + print_usage(); + return true; + } + + if (versionFlag) { + // We've always print the title/version, so we can just exit + return true; + } + + if (consoleFlag) + ringFlags |= DRing::DRING_FLAG_CONSOLE_LOG; + + if (debugFlag) + ringFlags |= DRing::DRING_FLAG_DEBUG; + + if (autoAnswer) + ringFlags |= DRing::DRING_FLAG_AUTOANSWER; + + return false; +} + +static void +signal_handler(int code) +{ + std::cerr << "Caught signal " << strsignal(code) + << ", terminating..." << std::endl; + + // Unset signal handlers + signal(SIGHUP, SIG_DFL); + signal(SIGINT, SIG_DFL); + signal(SIGTERM, SIG_DFL); + + // Interrupt the process + if (auto client = weakClient.lock()) + client->exit(); +} + +int +main(int argc, char *argv []) +{ + print_title(); + + bool persistent = false; + if (parse_args(argc, argv, persistent)) + return 0; + + // TODO: Block signals for all threads but the main thread, decide how/if we should + // handle other signals + signal(SIGINT, signal_handler); + signal(SIGHUP, signal_handler); + signal(SIGTERM, signal_handler); + signal(SIGPIPE, SIG_IGN); + + try { + if (auto client = std::make_shared<DBusClient>(ringFlags, persistent)) + { + weakClient = client; + return client->event_loop(); + } + } catch (const std::exception& ex) { + std::cerr << "Exception in the DBusClient: " << ex.what() << std::endl; + } + return 1; +} diff --git a/bin/dbus/meson.build b/bin/dbus/meson.build new file mode 100644 index 0000000000000000000000000000000000000000..7cf5f6b97da687b4acc08e480ce275d1af734c6f --- /dev/null +++ b/bin/dbus/meson.build @@ -0,0 +1,93 @@ +jamid_includedirs = include_directories( + '../..', + '../../src', + '../../src/dring' +) + +jamid_sources = files( + 'dbuscallmanager.cpp', + 'dbusclient.cpp', + 'dbusconfigurationmanager.cpp', + 'dbusinstance.cpp', + 'dbuspresencemanager.cpp', + 'main.cpp' +) + +jamid_targets = [] +jamid_targets += custom_target('callmanager.adaptor', + command: [progdbusxxxml2cpp, '@INPUT@', '--adaptor=@OUTPUT@'], + input: 'cx.ring.Ring.CallManager.xml', + output: 'dbuscallmanager.adaptor.h' +) + +jamid_targets += custom_target('configurationmanager.adaptor', + command: [progdbusxxxml2cpp, '@INPUT@', '--adaptor=@OUTPUT@'], + input: 'cx.ring.Ring.ConfigurationManager.xml', + output: 'dbusconfigurationmanager.adaptor.h' +) + +jamid_targets += custom_target('instance.adaptor', + command: [progdbusxxxml2cpp, '@INPUT@', '--adaptor=@OUTPUT@'], + input: 'cx.ring.Ring.Instance.xml', + output: 'dbusinstance.adaptor.h' +) + +jamid_targets += custom_target('presencemanager.adaptor', + command: [progdbusxxxml2cpp, '@INPUT@', '--adaptor=@OUTPUT@'], + input: 'cx.ring.Ring.PresenceManager.xml', + output: 'dbuspresencemanager.adaptor.h' +) + +if conf.get('ENABLE_VIDEO') + jamid_targets += custom_target('videomanager.adaptor', + command: [progdbusxxxml2cpp, '@INPUT@', '--adaptor=@OUTPUT@'], + input: 'cx.ring.Ring.VideoManager.xml', + output: 'dbusvideomanager.adaptor.h' + ) + + jamid_sources += files( + 'dbusvideomanager.cpp' + ) +endif + +if progpod2man.found() + jamid_targets += custom_target('jamid.man', + command: [progpod2man, '--section=8', '--release='+meson.project_version(), '--center', '""', '@INPUT@', '@OUTPUT@'], + input: 'jamid.pod', + output: 'jamid.8', + install: true, + install_dir: get_option('mandir') / 'man8' + ) +endif + +jamid = executable('jamid', + jamid_targets, + include_directories: jamid_includedirs, + sources: jamid_sources, + dependencies: depdbuscpp, + link_with: libjami, + install: true, + install_dir: get_option('libdir') +) + +configure_file( + configuration: {'LIBDIR': get_option('prefix') / get_option('libdir')}, + input: 'net.jami.daemon.service.in', + output: 'cx.ring.Ring.service', + install: true, + install_dir: get_option('datadir') / 'dbus-1' / 'services' +) + +install_data( + 'cx.ring.Ring.CallManager.xml', + 'cx.ring.Ring.ConfigurationManager.xml', + 'cx.ring.Ring.Instance.xml', + 'cx.ring.Ring.PresenceManager.xml', + install_dir: get_option('datadir') / 'dbus-1' / 'interfaces' +) +if conf.get('ENABLE_VIDEO') + install_data( + 'cx.ring.Ring.VideoManager.xml', + install_dir: get_option('datadir') / 'dbus-1' / 'interfaces' + ) +endif diff --git a/bin/dbus/net.jami.daemon.service.in b/bin/dbus/net.jami.daemon.service.in new file mode 100644 index 0000000000000000000000000000000000000000..8e79e23e920d618f04b7eab6d5d832123109ad3d --- /dev/null +++ b/bin/dbus/net.jami.daemon.service.in @@ -0,0 +1,3 @@ +[D-BUS Service] +Name=cx.ring.Ring +Exec=@LIBDIR@/jamid diff --git a/bin/nodejs/meson.build b/bin/nodejs/meson.build new file mode 100644 index 0000000000000000000000000000000000000000..606b5f2ae2cb4bf2424c3477458659bb137837c7 --- /dev/null +++ b/bin/nodejs/meson.build @@ -0,0 +1,18 @@ +nodejs_wrapper_target = custom_target('nodejs.wrapper', + command: [progswig, '-v', '-c++', '-javascript', '-node', '-o', '@OUTPUT@', '@INPUT@'], + input: 'nodejs_interface.i', + output: 'nodejs_wrapper.cpp' +) + +nodejs_makefile_target = custom_target('nodejs.makefile', + command: [prognodegyp, 'configure', '--target=1.6.2', '--arch=x64', '--dist-url=https://atom.io/download/electron'], + output: 'build/Makefile', + depends: nodejs_wrapper_target +) + +nodejs_node_target = custom_target('nodejs.node', + command: [prognodegyp, 'build'], + output: 'build/Release/obj.target/dring.node', + depends: nodejs_makefile_target, + build_by_default: true +) diff --git a/contrib/src/pjproject/0010-fix-pkgconfig.patch b/contrib/src/pjproject/0010-fix-pkgconfig.patch new file mode 100644 index 0000000000000000000000000000000000000000..e621e990b92ccbe53941d164e3d20ad5bf8e30be --- /dev/null +++ b/contrib/src/pjproject/0010-fix-pkgconfig.patch @@ -0,0 +1,89 @@ +From 078414b75fe0544a529332d42c583bcb76e271be Mon Sep 17 00:00:00 2001 +From: Vladimir Stoiakin <VStoiakin@lavabit.com> +Date: Thu, 23 Apr 2020 14:06:40 +0300 +Subject: [PATCH] libpjproject.pc: correct the field 'cflags' + +--- + Makefile | 6 ++---- + aconfigure.ac | 3 +++ + build.mak.in | 7 +++---- + libpjproject.pc.in | 4 ++-- + 4 files changed, 10 insertions(+), 10 deletions(-) + +diff --git a/Makefile b/Makefile +index ffaf638dd..3fd5cab40 100644 +--- a/Makefile ++++ b/Makefile +@@ -132,10 +132,8 @@ install: + sed -e "s!@INCLUDEDIR@!$(includedir)!" | \ + sed -e "s!@LIBDIR@!$(libdir)!" | \ + sed -e "s/@PJ_VERSION@/$(PJ_VERSION)/" | \ +- sed -e "s!@PJ_LDLIBS@!!" | \ +- sed -e "s!@PJ_LDXXLIBS@!$(PJ_LDXXLIBS)!" | \ +- sed -e "s!@PJ_INSTALL_CFLAGS@!!" | \ +- sed -e "s!@PJ_INSTALL_CXXFLAGS@!$(PJ_INSTALL_CXXFLAGS)!" > $(DESTDIR)/$(libdir)/pkgconfig/libpjproject.pc ++ sed -e "s!@PJ_INSTALL_LDFLAGS@!$(PJ_INSTALL_LDFLAGS)!" | \ ++ sed -e "s!@PJ_INSTALL_CFLAGS@!$(PJ_INSTALL_CFLAGS)!" > $(DESTDIR)/$(libdir)/pkgconfig/libpjproject.pc + + uninstall: + $(RM) $(DESTDIR)$(libdir)/pkgconfig/libpjproject.pc +diff --git a/aconfigure.ac b/aconfigure.ac +index 0367679e2..954b81515 100644 +--- a/aconfigure.ac ++++ b/aconfigure.ac +@@ -71,6 +71,7 @@ AC_SUBST(CC_CFLAGS) + + AC_SUBST(ac_pjdir) + AC_SUBST(ac_build_mak_vars) ++AC_SUBST(ac_cflags) + + case $host in + *mingw* | *cygw* | *win32* | *w32* ) +@@ -144,8 +145,10 @@ AC_C_BIGENDIAN + + if test "x$ac_cv_c_bigendian" = "xyes"; then + CFLAGS="$CFLAGS -DPJ_IS_BIG_ENDIAN=1 -DPJ_IS_LITTLE_ENDIAN=0" ++ ac_cflags="$ac_cflags -DPJ_IS_BIG_ENDIAN=1 -DPJ_IS_LITTLE_ENDIAN=0" + else + CFLAGS="$CFLAGS -DPJ_IS_BIG_ENDIAN=0 -DPJ_IS_LITTLE_ENDIAN=1" ++ ac_cflags="$ac_cflags -DPJ_IS_BIG_ENDIAN=0 -DPJ_IS_LITTLE_ENDIAN=1" + fi + + dnl +diff --git a/build.mak.in b/build.mak.in +index abc0c4fa0..a9078bb25 100644 +--- a/build.mak.in ++++ b/build.mak.in +@@ -299,7 +299,7 @@ export APP_LDXXLIBS := $(PJSUA2_LIB_LDLIB) \ + -lstdc++ \ + $(APP_LDLIBS) + +-# Here are the variabels to use if application is using the library ++# Here are the variables to use if application is using the library + # from within the source distribution + export PJ_CC := $(APP_CC) + export PJ_CXX := $(APP_CXX) +@@ -317,6 +317,5 @@ export PJ_LIBXX_FILES := $(APP_LIBXX_FILES) + export PJ_INSTALL_DIR := @prefix@ + export PJ_INSTALL_INC_DIR := @includedir@ + export PJ_INSTALL_LIB_DIR := @libdir@ +-export PJ_INSTALL_CFLAGS := -I$(PJ_INSTALL_INC_DIR) -DPJ_AUTOCONF=1 @CFLAGS@ +-export PJ_INSTALL_CXXFLAGS := @CXXFLAGS@ $(PJ_INSTALL_CFLAGS) +-export PJ_INSTALL_LDFLAGS := -L$(PJ_INSTALL_LIB_DIR) $(APP_LDLIBS) ++export PJ_INSTALL_CFLAGS := -I$(PJ_INSTALL_INC_DIR) -DPJ_AUTOCONF=1 @ac_cflags@ ++export PJ_INSTALL_LDFLAGS := -L$(PJ_INSTALL_LIB_DIR) $(APP_LDXXLIBS) +diff --git a/libpjproject.pc.in b/libpjproject.pc.in +index fa8d39114..30ea05c07 100644 +--- a/libpjproject.pc.in ++++ b/libpjproject.pc.in +@@ -9,5 +9,5 @@ Name: libpjproject + Description: Multimedia communication library + URL: http://www.pjsip.org + Version: @PJ_VERSION@ +-Libs: -L${libdir} @PJ_LDXXLIBS@ +-Cflags: -I${includedir} @PJ_INSTALL_CXXFLAGS@ ++Libs: @PJ_INSTALL_LDFLAGS@ ++Cflags: @PJ_INSTALL_CFLAGS@ +-- +2.26.2 + diff --git a/contrib/src/pjproject/rules.mak b/contrib/src/pjproject/rules.mak index 85c3834315ded3d7d12b7b305d1b4f1e4315c5a6..1a302e40c55744790dc7539dc8efc66af6b5b859 100644 --- a/contrib/src/pjproject/rules.mak +++ b/contrib/src/pjproject/rules.mak @@ -54,6 +54,7 @@ pjproject: pjproject-$(PJPROJECT_VERSION).tar.gz .sum-pjproject $(APPLY) $(SRC)/pjproject/0007-pj_ice_sess.patch $(APPLY) $(SRC)/pjproject/0008-fix_ioqueue_ipv6_sendto.patch $(APPLY) $(SRC)/pjproject/0009-add-config-site.patch + $(APPLY) $(SRC)/pjproject/0010-fix-pkgconfig.patch ifdef HAVE_ANDROID $(APPLY) $(SRC)/pjproject/0001-android.patch endif @@ -61,6 +62,7 @@ endif $(MOVE) .pjproject: pjproject + cd $< && autoconf -o aconfigure aconfigure.ac # for 0010-fix-pkgconfig.patch ifdef HAVE_IOS cd $< && ARCH="-arch $(ARCH)" IPHONESDK=$(IOS_SDK) $(HOSTVARS) EXCLUDE_APP=1 ./configure-iphone $(HOSTCONF) $(PJPROJECT_OPTIONS) else diff --git a/cross-files/android_arm64_api29.txt b/cross-files/android_arm64_api29.txt new file mode 100644 index 0000000000000000000000000000000000000000..1af12c9c11f2e15493701a9ce2e05c56054a09e8 --- /dev/null +++ b/cross-files/android_arm64_api29.txt @@ -0,0 +1,29 @@ +[host_machine] +system = 'linux' +cpu_family = 'aarch64' +cpu = 'aarch64' +endian = 'little' + +# Compilers and tools reside in <NDK>/toolchains/llvm/prebuilt/<host-tag>/bin/ +# Please add this path to the environment(PATH) before compiling +[binaries] +c = 'aarch64-linux-android29-clang' +cpp = 'aarch64-linux-android29-clang++' +ar = 'aarch64-linux-android-ar' +strip = 'aarch64-linux-android-strip' +pkgconfig = 'pkg-config' + +#cmake = 'cmake' +#c_ld = 'gold' +#cpp_ld = 'gold' +#exe_wrapper = '' + +[properties] +sys_root = '<daemon>/contrib/aarch64-linux-android29' +pkg_config_libdir = '<daemon>/contrib/aarch64-linux-android29/lib/pkgconfig' + +#c_args = [''] +#c_link_args = [''] +#cpp_args = [''] +#cpp_link_args = [''] +#needs_exe_wrapper = true diff --git a/cross-files/mingw_w64_x86-64.txt b/cross-files/mingw_w64_x86-64.txt new file mode 100644 index 0000000000000000000000000000000000000000..83f0afc2e59da98866a172f803dd174bb46cbc83 --- /dev/null +++ b/cross-files/mingw_w64_x86-64.txt @@ -0,0 +1,23 @@ +[host_machine] +system = 'windows' +cpu_family = 'x86_64' +cpu = 'x86_64' +endian = 'little' + +[binaries] +c = 'x86_64-w64-mingw32-gcc' +cpp = 'x86_64-w64-mingw32-g++' +ar = 'x86_64-w64-mingw32-ar' +strip = 'x86_64-w64-mingw32-strip' +pkgconfig = 'x86_64-w64-mingw32-pkg-config' +windres = 'x86_64-w64-mingw32-windres' + +[properties] + +#sys_root = '' +#pkg_config_libdir = '' +#c_args = [''] +#c_link_args = [''] +#cpp_args = [''] +#cpp_link_args = [''] +#needs_exe_wrapper = true diff --git a/meson.build b/meson.build new file mode 100644 index 0000000000000000000000000000000000000000..9d4d68969b29dbae666d6ff543164317367cc1e4 --- /dev/null +++ b/meson.build @@ -0,0 +1,184 @@ +project('jami-daemon', ['c', 'cpp'], + version: '9.1.0', + license: 'GPL3+', + default_options: ['cpp_std=gnu++14', 'buildtype=debugoptimized'], + meson_version:'>= 0.54' + ) + +modpkgconfig = import('pkgconfig') +modcmake = import('cmake') + +################################################# +# Required dependencies +################################################# +depthreads = dependency('threads') +depopendht = dependency('opendht', version: '>= 2.1.0') +depgnutls = dependency('gnutls', version: '>= 3.6.7') +deplibpjproject = dependency('libpjproject') +deplibsecp256k1 = dependency('libsecp256k1', version: '>= 0.1') +deplibavcodec = dependency('libavcodec', version: '>= 56.60.100') +deplibavfilter = dependency('libavfilter', version: '>= 5.40.101') +deplibavdevice = dependency('libavdevice', version: '>= 56.4.100') +deplibavformat = dependency('libavformat', version: '>= 56.40.101') +deplibswscale = dependency('libswscale', version: '>= 3.1.101') +deplibswresample = dependency('libswresample', version: '>= 1.2.101') +deplibavutil = dependency('libavutil', version: '>= 55.75.100') +depspeex = dependency('speex') +depspeexdsp = dependency('speexdsp') + +depyamlcpp = dependency('yaml-cpp', version: '>= 0.5.1', required: false) +if not depyamlcpp.found() + depyamlcpp = modcmake.subproject('yaml-cpp', cmake_options: [ + '-DYAML_CPP_BUILD_TOOLS=OFF', + '-DYAML_CPP_BUILD_TESTS=OFF', + '-DYAML_CPP_BUILD_CONTRIB=OFF', + '-DBUILD_SHARED_LIBS=OFF' + ]).dependency('yaml-cpp') +endif + +depjsoncpp = dependency('jsoncpp', version: '>= 1.6.5', + fallback: ['jsoncpp', 'jsoncpp_dep'], default_options: ['default_library=static']) +depzlib = dependency('zlib', fallback: ['zlib', 'zlib_dep'], default_options: ['default_library=static']) + +if get_option('interfaces').contains('dbus') + depdbuscpp = dependency('dbus-c++-1') + progdbusxxxml2cpp = find_program('dbusxx-xml2cpp', native: true) +endif + +if get_option('interfaces').contains('nodejs') + progswig = find_program('swig', native: true) + prognodegyp = find_program('node-gyp', native: true) +endif + +if get_option('tests') + depcppunit = dependency('cppunit', version: '>= 1.12') +endif + +################################################# +# Optional dependencies and configuration +################################################# +progpod2man = find_program('pod2man', native: true, required: false) + +conf = configuration_data() +conf.set_quoted('PACKAGE', 'jami') +conf.set_quoted('PACKAGE_NAME', 'Jami Daemon') +conf.set_quoted('PACKAGE_VERSION', meson.project_version()) +conf.set_quoted('PACKAGE_STRING', 'Jami Daemon ' + meson.project_version()) +conf.set_quoted('PROGSHAREDIR', get_option('datadir') / 'ring') + +depopensl = meson.get_compiler('cpp').find_library('OpenSLES', has_headers: 'SLES/OpenSLES.h', required: get_option('opensl')) +conf.set10('HAVE_OPENSL', depopensl.found()) + +depalsa = dependency('alsa', version: '>= 1.0', required: get_option('alsa')) +conf.set10('HAVE_ALSA', depalsa.found()) + +deplibpulse = dependency('libpulse', version: '>= 0.9.15', required: get_option('pulseaudio')) +conf.set10('HAVE_PULSE', deplibpulse.found()) + +depjack = dependency('jack', required: get_option('jack')) +conf.set10('HAVE_JACK', depjack.found()) + +depportaudio = dependency('portaudio-2.0', required: get_option('portaudio')) +conf.set10('HAVE_PORTAUDIO', depportaudio.found()) + +deplibupnp = dependency('libupnp', required: get_option('upnp')) +conf.set10('HAVE_LIBUPNP', deplibupnp.found()) + +if get_option('natpmp_prefix') == '' + depnatpmp = meson.get_compiler('cpp').find_library('natpmp', has_headers: 'natpmp.h', required: get_option('natpmp')) +else + depnatpmp_ = meson.get_compiler('cpp').find_library('natpmp', dirs: get_option('natpmp_prefix') / 'lib', required: get_option('natpmp')) + if depnatpmp_.found() + depnatpmp = declare_dependency( + compile_args: '-I' + get_option('natpmp_prefix') / 'include', + dependencies: depnatpmp_ + ) + else + depnatpmp = depnatpmp_ + endif +endif +conf.set10('HAVE_LIBNATPMP', depnatpmp.found()) + +depopenssl = dependency('openssl', required: get_option('name_service')) +conf.set10('HAVE_RINGNS', depopenssl.found()) + +if get_option('video') + conf.set('ENABLE_VIDEO', true) + if host_machine.system() == 'linux' and meson.get_compiler('cpp').get_define('__ANDROID__') != '1' + deplibudev = dependency('libudev') + endif + + if get_option('hw_acceleration') + conf.set('RING_ACCEL', true) + conf.set('ENABLE_VIDEOTOOLBOX', host_machine.system() == 'darwin') + endif +endif + +conf.set10('HAVE_COREAUDIO', host_machine.system() == 'darwin') +conf.set10('HAVE_SHM', host_machine.system() == 'linux' and meson.get_compiler('cpp').get_define('__ANDROID__') != '1') + +configure_file( + output: 'config.h', + configuration: conf +) +add_project_arguments('-DHAVE_CONFIG_H', language: 'cpp') +add_project_arguments('-DHAVE_CONFIG_H', language: 'c') + +################################################# +# Build targets +################################################# +add_project_arguments('-DRING_BUILD', language: 'cpp') +add_project_arguments('-DRING_BUILD', language: 'c') +if get_option('default_library') != 'static' + add_project_arguments('-Ddring_EXPORTS', language: 'cpp') + add_project_arguments('-Ddring_EXPORTS', language: 'c') +endif + +add_project_arguments('-DASIO_STANDALONE', language: 'cpp') +add_project_arguments('-DASIO_STANDALONE', language: 'c') + +subdir('src') + +if get_option('interfaces').contains('dbus') + subdir('bin' / 'dbus') +endif + +if get_option('interfaces').contains('nodejs') + subdir('bin' / 'nodejs') +endif + +if get_option('tests') + subdir('test') +endif + +################################################# +# Resources and metafiles +################################################# +subdir('ringtones') + +if host_machine.system() == 'linux' and meson.get_compiler('cpp').get_define('__ANDROID__') != '1' + provides_content = '' + if get_option('interfaces').contains('dbus') + provides_content += ' <dbus type="user">cx.ring.Ring</dbus>' + endif + if get_option('interfaces').contains('library') + provides_content += (provides_content == '')? '' : '\n' + if get_option('default_library') == 'static' + provides_content += ' <library>libjami.a</library>' + elif get_option('default_library') == 'shared' + provides_content += ' <library>libjami.so</library>' + else + provides_content += ' <library>libjami.so</library>\n' + provides_content += ' <library>libjami.a</library>' + endif + endif + if provides_content != '' + configure_file( + configuration: {'PROVIDES_CONTENT': provides_content}, + input: 'net.jami.daemon.metainfo.xml.in', + output: 'net.jami.daemon.metainfo.xml', + install: true, + install_dir: get_option('datadir') / 'metainfo' + ) + endif +endif diff --git a/meson_options.txt b/meson_options.txt new file mode 100644 index 0000000000000000000000000000000000000000..168d06fb0938f3d4c9ce2807712b55a7eb1c1216 --- /dev/null +++ b/meson_options.txt @@ -0,0 +1,15 @@ +option('interfaces', type: 'array', choices: ['library', 'dbus', 'nodejs'], value: ['library']) +option('video', type: 'boolean', value: true, description: 'Enable video support') +option('hw_acceleration', type: 'boolean', value: true, description: 'Enable hardware acceleration') + +option('name_service', type: 'feature', value: 'auto', description: 'Enable Name Service') +option('opensl', type: 'feature', value: 'auto', description: 'Enable support for OpenSL') +option('alsa', type: 'feature', value: 'auto', description: 'Enable support for ALSA') +option('pulseaudio', type: 'feature', value: 'auto', description: 'Enable support for PulseAudio') +option('jack', type: 'feature', value: 'auto', description: 'Enable support for Jack') +option('portaudio', type: 'feature', value: 'auto', description: 'Enable support for PortAudio') +option('upnp', type: 'feature', value: 'auto', description: 'Enable support for UPnP') +option('natpmp', type: 'feature', value: 'auto', description: 'Enable support for NAT-PMP') + +option('natpmp_prefix', type: 'string', value: '', description: 'Override a system directory to search for the library "natpmp"') +option('tests', type: 'boolean', value: false, description: 'Build tests') diff --git a/jami-daemon.metainfo.xml b/net.jami.daemon.metainfo.xml.in similarity index 94% rename from jami-daemon.metainfo.xml rename to net.jami.daemon.metainfo.xml.in index 71ad1ec3318ae0e5c6606c273ac8b7771b1b480d..0c6c56b929c765d1704262f417c928f4d3fa9a13 100644 --- a/jami-daemon.metainfo.xml +++ b/net.jami.daemon.metainfo.xml.in @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- Copyright 2019 Savoir-faire Linux --> +<!-- Copyright 2020 Savoir-faire Linux --> <component> <id>net.jami.daemon</id> <metadata_license>CC-BY-SA-3.0</metadata_license> @@ -26,7 +26,7 @@ <url type="bugtracker">https://git.jami.net/savoirfairelinux/ring-daemon/issues/</url> <provides> - <dbus type="user">cx.ring.Ring</dbus> +@PROVIDES_CONTENT@ </provides> <categories> diff --git a/ringtones/meson.build b/ringtones/meson.build new file mode 100644 index 0000000000000000000000000000000000000000..1bfcef7eb065c1750f9c8e8cd2926b08761740ca --- /dev/null +++ b/ringtones/meson.build @@ -0,0 +1,14 @@ +install_data( + '01_AfroNigeria.opus', + '02_AfroNigeria.opus', + '03_AcousticGuitar.opus', + '04_ElectricGuitar.opus', + '05_AcousticIndia.opus', + '06_RingSoft.opus', + '07_RingTribal.opus', + '08_RingFirefly.opus', + '09_ElectroCloud.opus', + '10_UrbanTrap.opus', + 'default.opus', + install_dir: get_option('datadir') / 'ring' / 'ringtones' +) diff --git a/src/logger.cpp b/src/logger.cpp index dac9db96b0329b4b03df6cc65e50ce772a8e844d..7416f8259342e2c0e35666c4c4254f81f373eaa8 100644 --- a/src/logger.cpp +++ b/src/logger.cpp @@ -177,30 +177,31 @@ getDebugMode(void) return debugMode; } -void -strErr(void) -{ -#ifdef __GLIBC__ - JAMI_ERR("%m"); -#else - char buf[1000]; - const char* errstr; - - switch (strerror_r(errno, buf, sizeof(buf))) { +static const char* check_error(int result, char* buffer) { + switch (result) { case 0: - errstr = buf; - break; + return buffer; case ERANGE: /* should never happen */ - errstr = "unknown (too big to display)"; - break; + return "unknown (too big to display)"; default: - errstr = "unknown (invalid error number)"; - break; + return "unknown (invalid error number)"; } +} - JAMI_ERR("%s", errstr); +static const char* check_error(char* result, char*) { + return result; +} + +void +strErr(void) +{ +#ifdef __GLIBC__ + JAMI_ERR("%m"); +#else + char buf[1000]; + JAMI_ERR("%s", check_error(strerror_r(errno, buf, sizeof(buf)), buf)); #endif } diff --git a/src/media/audio/portaudio/portaudiolayer.cpp b/src/media/audio/portaudio/portaudiolayer.cpp index d36722d208ad8d541fcc84124d972ed12ddeaf3c..02c8e1fde1fce2b9676e78b21f52fc9940a648a9 100644 --- a/src/media/audio/portaudio/portaudiolayer.cpp +++ b/src/media/audio/portaudio/portaudiolayer.cpp @@ -33,8 +33,6 @@ #include <cmath> namespace jami { - -struct AudioLayer::EchoState; enum Direction { Input = 0, Output = 1, IO = 2, End = 3 }; diff --git a/src/meson.build b/src/meson.build new file mode 100644 index 0000000000000000000000000000000000000000..2a82eabe56f901a1ff38c1aff34944b452dcdd4b --- /dev/null +++ b/src/meson.build @@ -0,0 +1,309 @@ +libjami_includedirs = include_directories( + '..', + 'dring', + 'media', + 'jamidht/eth' +) + +libjami_sources = files( + 'client/callmanager.cpp', + 'client/configurationmanager.cpp', + 'client/datatransfer.cpp', + 'client/presencemanager.cpp', + 'client/ring_signal.cpp', + 'client/videomanager.cpp', + 'config/yamlparser.cpp', + 'hooks/urlhook.cpp', + 'im/instant_messaging.cpp', + 'im/message_engine.cpp', + 'jamidht/eth/libdevcore/Common.cpp', + 'jamidht/eth/libdevcore/CommonData.cpp', + 'jamidht/eth/libdevcore/FixedHash.cpp', + 'jamidht/eth/libdevcore/SHA3.cpp', + 'jamidht/eth/libdevcrypto/Common.cpp', + 'jamidht/accountarchive.cpp', + 'jamidht/account_manager.cpp', + 'jamidht/archive_account_manager.cpp', + 'jamidht/channeled_transport.cpp', + 'jamidht/connectionmanager.cpp', + 'jamidht/contact_list.cpp', + 'jamidht/jamiaccount.cpp', + 'jamidht/multiplexed_socket.cpp', + 'jamidht/namedirectory.cpp', + 'jamidht/p2p.cpp', + 'jamidht/server_account_manager.cpp', + 'jamidht/sips_transport_ice.cpp', + 'media/audio/sound/audiofile.cpp', + 'media/audio/sound/dtmf.cpp', + 'media/audio/sound/dtmfgenerator.cpp', + 'media/audio/sound/tone.cpp', + 'media/audio/sound/tonelist.cpp', + 'media/audio/audiobuffer.cpp', + 'media/audio/audio_frame_resizer.cpp', + 'media/audio/audio_input.cpp', + 'media/audio/audiolayer.cpp', + 'media/audio/audioloop.cpp', + 'media/audio/audio_receive_thread.cpp', + 'media/audio/audio_rtp_session.cpp', + 'media/audio/audio_sender.cpp', + 'media/audio/dcblocker.cpp', + 'media/audio/dsp.cpp', + 'media/audio/resampler.cpp', + 'media/audio/ringbuffer.cpp', + 'media/audio/ringbufferpool.cpp', + 'media/audio/tonecontrol.cpp', + 'media/congestion_control.cpp', + 'media/libav_utils.cpp', + 'media/localrecorder.cpp', + 'media/localrecordermanager.cpp', + 'media/media_buffer.cpp', + 'media/media_codec.cpp', + 'media/media_decoder.cpp', + 'media/media_encoder.cpp', + 'media/media_filter.cpp', + 'media/media_io_handle.cpp', + 'media/media_player.cpp', + 'media/media_recorder.cpp', + 'media/recordable.cpp', + 'media/socket_pair.cpp', + 'media/srtp.c', + 'media/system_codec_container.cpp', + 'security/certstore.cpp', + 'security/diffie-hellman.cpp', + 'security/memory.cpp', + 'security/tls_session.cpp', + 'security/tlsvalidator.cpp', + 'sip/pres_sub_client.cpp', + 'sip/pres_sub_server.cpp', + 'sip/sdes_negotiator.cpp', + 'sip/sdp.cpp', + 'sip/sipaccountbase.cpp', + 'sip/sipaccount.cpp', + 'sip/sipcall.cpp', + 'sip/sippresence.cpp', + 'sip/siptransport.cpp', + 'sip/sip_utils.cpp', + 'sip/sipvoiplink.cpp', + 'upnp/protocol/igd.cpp', + 'upnp/protocol/mapping.cpp', + 'upnp/upnp_context.cpp', + 'upnp/upnp_control.cpp', + 'account.cpp', + 'account_factory.cpp', + 'archiver.cpp', + 'base64.cpp', + 'buildinfo.cpp', + 'call.cpp', + 'call_factory.cpp', + 'conference.cpp', + 'data_transfer.cpp', + 'fileutils.cpp', + 'ftp_server.cpp', + 'ice_transport.cpp', + 'ip_utils.cpp', + 'logger.cpp', + 'manager.cpp', + 'peer_connection.cpp', + 'preferences.cpp', + 'ring_api.cpp', + 'scheduled_executor.cpp', + 'smartools.cpp', + 'string_utils.cpp', + 'threadloop.cpp', + 'turn_transport.cpp', + 'utf8_utils.cpp' +) +if host_machine.system() == 'windows' + libjami_sources += files('winsyslog.c') +endif + +libjami_dependencies = [ + depthreads, + depopendht, + depgnutls, + deplibpjproject, + deplibsecp256k1, + deplibavcodec, + deplibavfilter, + deplibavdevice, + deplibavformat, + deplibswscale, + deplibswresample, + deplibavutil, + depspeex, + depspeexdsp, + depyamlcpp, + depjsoncpp, + depzlib +] + +if conf.get('HAVE_OPENSL') == 1 + libjami_sources += files( + 'media/audio/opensl/audio_player.cpp', + 'media/audio/opensl/audio_recorder.cpp', + 'media/audio/opensl/opensllayer.cpp' + ) + libjami_dependencies += depopensl +endif + +if conf.get('HAVE_ALSA') == 1 + libjami_sources += files( + 'media/audio/alsa/alsalayer.cpp' + ) + libjami_dependencies += depalsa +endif + +if conf.get('HAVE_PULSE') == 1 + libjami_sources += files( + 'media/audio/pulseaudio/audiostream.cpp', + 'media/audio/pulseaudio/pulselayer.cpp' + ) + libjami_dependencies += deplibpulse +endif + +if conf.get('HAVE_JACK') == 1 + libjami_sources += files( + 'media/audio/jack/jacklayer.cpp' + ) + libjami_dependencies += depjack +endif + +if conf.get('HAVE_PORTAUDIO') == 1 + libjami_sources += files( + 'media/audio/portaudio/portaudiolayer.cpp' + ) + libjami_dependencies += depportaudio +endif + +if conf.get('HAVE_COREAUDIO') == 1 + libjami_sources += files( + 'media/audio/coreaudio/osx/audiodevice.cpp', + 'media/audio/coreaudio/osx/corelayer.cpp' + ) +endif + +if conf.get('HAVE_LIBUPNP') == 1 + libjami_sources += files( + 'upnp/protocol/pupnp/pupnp.cpp', + 'upnp/protocol/pupnp/upnp_igd.cpp' + ) + libjami_dependencies += deplibupnp +endif + +if conf.get('HAVE_LIBNATPMP') == 1 + libjami_sources += files( + 'upnp/protocol/natpmp/nat_pmp.cpp', + 'upnp/protocol/natpmp/pmp_igd.cpp' + ) + libjami_dependencies += depnatpmp +endif + +if conf.get('HAVE_RINGNS') == 1 + libjami_dependencies += depopenssl +endif + +if conf.get('ENABLE_VIDEO') + libjami_sources += files( + 'media/video/filter_transpose.cpp', + 'media/video/sinkclient.cpp', + 'media/video/video_base.cpp', + 'media/video/video_device_monitor.cpp', + 'media/video/video_input.cpp', + 'media/video/video_mixer.cpp', + 'media/video/video_receive_thread.cpp', + 'media/video/video_rtp_session.cpp', + 'media/video/video_scaler.cpp', + 'media/video/video_sender.cpp' + ) + + if conf.get('RING_ACCEL') + libjami_sources += files( + 'media/video/accel.cpp' + ) + endif + + if host_machine.system() == 'linux' + if meson.get_compiler('cpp').get_define('__ANDROID__') == '1' + libjami_sources += files( + 'media/video/androidvideo/video_device_impl.cpp', + 'media/video/androidvideo/video_device_monitor_impl.cpp' + ) + else + libjami_sources += files( + 'media/video/v4l2/video_device_impl.cpp', + 'media/video/v4l2/video_device_monitor_impl.cpp' + ) + libjami_dependencies += deplibudev + endif + elif host_machine.system() == 'darwin' + if meson.get_compiler('cpp').compiles('''#import <TargetConditionals.h> + #if TARGET_OS_IPHONE == 0 + #error This is not an IPHONE + #endif''') + libjami_sources += files( + 'media/video/iosvideo/video_device_impl.cpp', + 'media/video/iosvideo/video_device_monitor_impl.cpp' + ) + else + libjami_sources += files( + 'media/video/osxvideo/video_device_impl.mm', + 'media/video/osxvideo/video_device_monitor_impl.mm' + ) + endif + elif host_machine.system() == 'windows' + libjami_sources += files( + 'media/video/winvideo/video_device_impl.cpp', + 'media/video/winvideo/video_device_monitor_impl.cpp' + ) + else + error('Jami currently doesn\'t have support for video on @0@.\nPlease reconfigure the project with -Dvideo=false option.'.format(host_machine.system())) + endif +endif + +libjami = library('jami', + version: meson.project_version(), + include_directories: libjami_includedirs, + sources: libjami_sources, + dependencies: libjami_dependencies, + install: get_option('interfaces').contains('library') +) + +libjami_dep = declare_dependency( + include_directories: 'dring', + link_with: libjami, + variables: {'video': conf.get('ENABLE_VIDEO')? 'true' : 'false'} +) + +if get_option('interfaces').contains('library') + install_headers( + 'dring/account_const.h', + 'dring/call_const.h', + 'dring/callmanager_interface.h', + 'dring/configurationmanager_interface.h', + 'dring/datatransfer_interface.h', + 'dring/def.h', + 'dring/dring.h', + 'dring/media_const.h', + 'dring/presence_const.h', + 'dring/presencemanager_interface.h', + 'dring/security_const.h', + subdir: 'dring' + ) + if conf.get('ENABLE_VIDEO') + install_headers( + 'dring/videomanager_interface.h', + subdir: 'dring' + ) + endif + + modpkgconfig.generate( + libjami, + name: 'jami', + version: meson.project_version(), + description: 'The Jami core library', + url: 'https://jami.net/', + subdirs: 'dring', + filebase: 'jami', + variables: 'video=' + (conf.get('ENABLE_VIDEO')? 'true' : 'false') + ) +endif diff --git a/subprojects/jsoncpp.wrap b/subprojects/jsoncpp.wrap new file mode 100644 index 0000000000000000000000000000000000000000..6ecb2d1ceba9d5f24864f077fb72d550932d0ad5 --- /dev/null +++ b/subprojects/jsoncpp.wrap @@ -0,0 +1,10 @@ +[wrap-file] +directory = jsoncpp-1.8.4 + +source_url = https://github.com/open-source-parsers/jsoncpp/archive/1.8.4.tar.gz +source_filename = jsoncpp-1.8.4.tar.gz +source_hash = c49deac9e0933bcb7044f08516861a2d560988540b23de2ac1ad443b219afdb6 + +patch_url = https://wrapdb.mesonbuild.com/v1/projects/jsoncpp/1.8.4/1/get_zip +patch_filename = jsoncpp-1.8.4-1-wrap.zip +patch_hash = 4503fcbfd31ee903a6bcfc898fdb4be1ebc3e2a71add8f24eecbd390dcf386a9 diff --git a/subprojects/yaml-cpp.wrap b/subprojects/yaml-cpp.wrap new file mode 100644 index 0000000000000000000000000000000000000000..c7db8e8bf3ee848a23975c97cadc556621868fcf --- /dev/null +++ b/subprojects/yaml-cpp.wrap @@ -0,0 +1,6 @@ +[wrap-file] +directory = yaml-cpp-yaml-cpp-0.6.3 + +source_url = https://github.com/jbeder/yaml-cpp/archive/yaml-cpp-0.6.3.tar.gz +source_filename = yaml-cpp-yaml-cpp-0.6.3.tar.gz +source_hash = 77ea1b90b3718aa0c324207cb29418f5bced2354c2e483a9523d98c3460af1ed diff --git a/subprojects/zlib.wrap b/subprojects/zlib.wrap new file mode 100644 index 0000000000000000000000000000000000000000..91c1d4d991d0239c58825ef5195798025945184f --- /dev/null +++ b/subprojects/zlib.wrap @@ -0,0 +1,10 @@ +[wrap-file] +directory = zlib-1.2.11 + +source_url = http://zlib.net/fossils/zlib-1.2.11.tar.gz +source_filename = zlib-1.2.11.tar.gz +source_hash = c3e5e9fdd5004dcb542feda5ee4f0ff0744628baf8ed2dd5d66f8ca1197cb1a1 + +patch_url = https://wrapdb.mesonbuild.com/v1/projects/zlib/1.2.11/4/get_zip +patch_filename = zlib-1.2.11-4-wrap.zip +patch_hash = f733976fbfc59e0bcde01aa9469a24eeb16faf0a4280b17e9eaa60a301d75657 diff --git a/test/meson.build b/test/meson.build new file mode 100644 index 0000000000000000000000000000000000000000..dfc341c1eadd4348803b813706b8b31ac54bd68f --- /dev/null +++ b/test/meson.build @@ -0,0 +1,221 @@ +progsipp = find_program('sipp', native: true, required: false) +if progsipp.found() + ut_sip = executable('ut_sip', + include_directories: include_directories('..', '../src', '../src/dring', '../src/media'), + sources: files('sip/sip.cpp', 'sip/test_SIP.cpp'), + link_with: libjami, + dependencies: [depcppunit, deplibpjproject] + ) + test('sip', ut_sip, workdir: meson.current_source_dir() / 'sip') +endif + +#ut_turn = executable('ut_turn', +# include_directories: include_directories('../src', '../src/dring'), +# sources: files('turn/main.cpp', 'turn/test_TURN.cpp'), +# link_with: libjami, +# dependencies: [depcppunit, depopendht] +#) +#test('turn', ut_turn) + + +####### Unit Tests ######## + +# +# account_factory +# +ut_account_factory = executable('ut_account_factory', + include_directories: include_directories('../src', '../src/dring'), + sources: files('unitTest/account_factory/testAccount_factory.cpp'), + link_with: libjami, + dependencies: depcppunit +) +test('account_factory', ut_account_factory) + +# +# certstore +# +ut_certstore = executable('ut_certstore', + include_directories: include_directories('../src', '../src/dring'), + sources: files('unitTest/certstore.cpp'), + link_with: libjami, + dependencies: [depcppunit, depopendht] +) +test('certstore', ut_certstore) + +# +# base64 +# +ut_base64 = executable('ut_base64', + include_directories: include_directories('../src', '../src/dring'), + sources: files('unitTest/base64/base64.cpp'), + link_with: libjami, + dependencies: depcppunit +) +test('base64', ut_base64) + +# +# channel +# +ut_channel = executable('ut_channel', + include_directories: include_directories('../src', '../src/dring'), + sources: files('unitTest/channel/testChannel.cpp'), + link_with: libjami, + dependencies: [depcppunit, depthreads] +) +test('channel', ut_channel) + +# +# map_utils +# +ut_map_utils = executable('ut_map_utils', + include_directories: include_directories('../src', '../src/dring'), + sources: files('unitTest/map_utils/testMap_utils.cpp'), + link_with: libjami, + dependencies: depcppunit +) +test('map_utils', ut_map_utils) + +# +# fileutils +# +ut_fileutils = executable('ut_fileutils', + include_directories: include_directories('../src', '../src/dring'), + sources: files('unitTest/fileutils/testFileutils.cpp'), + link_with: libjami, + dependencies: depcppunit +) +test('fileutils', ut_fileutils) + +# +# smartools +# +ut_smartools = executable('ut_smartools', + include_directories: include_directories('../src', '../src/dring'), + sources: files('unitTest/smartools/testSmartools.cpp'), + link_with: libjami, + dependencies: depcppunit +) +test('smartools', ut_smartools) + +# +# utf8_utils +# +ut_utf8_utils = executable('ut_utf8_utils', + include_directories: include_directories('../src', '../src/dring'), + sources: files('unitTest/utf8_utils/testUtf8_utils.cpp'), + link_with: libjami, + dependencies: depcppunit +) +test('utf8_utils', ut_utf8_utils) + +# +# string_utils +# +ut_string_utils = executable('ut_string_utils', + include_directories: include_directories('../src', '../src/dring'), + sources: files('unitTest/string_utils/testString_utils.cpp'), + link_with: libjami, + dependencies: depcppunit +) +test('string_utils', ut_string_utils) + +# +# media_encoder +# +ut_media_encoder = executable('ut_media_encoder', + include_directories: include_directories('..', '../src', '../src/dring', '../src/media'), + sources: files('unitTest/media/test_media_encoder.cpp'), + link_with: libjami, + dependencies: [depcppunit, deplibpjproject, deplibavutil] +) +test('media_encoder', ut_media_encoder) + +# +# media_decoder +# +ut_media_decoder = executable('ut_media_decoder', + include_directories: include_directories('..', '../src', '../src/dring', '../src/media'), + sources: files('unitTest/media/test_media_decoder.cpp'), + link_with: libjami, + dependencies: [depcppunit, deplibpjproject, deplibavcodec] +) +test('media_decoder', ut_media_decoder) + +# +# media_filter +# +#ut_media_filter = executable('ut_media_filter', +# include_directories: include_directories('..', '../src', '../src/dring', '../src/media'), +# sources: files('unitTest/media/test_media_filter.cpp'), +# link_with: libjami, +# dependencies: depcppunit +#) +#test('media_filter', ut_media_filter) + +# +# media_frame +# +ut_media_frame = executable('ut_media_frame', + include_directories: include_directories('..', '../src', '../src/dring', '../src/media'), + sources: files('unitTest/media/test_media_frame.cpp'), + link_with: libjami, + dependencies: depcppunit +) +test('media_frame', ut_media_frame) + +# +# resampler +# +ut_resampler = executable('ut_resampler', + include_directories: include_directories('..', '../src', '../src/dring', '../src/media'), + sources: files('unitTest/media/audio/test_resampler.cpp'), + link_with: libjami, + dependencies: depcppunit +) +test('resampler', ut_resampler) + +# +# audio_frame_resizer +# +ut_audio_frame_resizer = executable('ut_audio_frame_resizer', + include_directories: include_directories('..', '../src', '../src/dring', '../src/media'), + sources: files('unitTest/media/audio/test_audio_frame_resizer.cpp'), + link_with: libjami, + dependencies: [depcppunit, deplibavutil] +) +test('audio_frame_resizer', ut_audio_frame_resizer) + +if conf.get('ENABLE_VIDEO') + # + # video_input + # + ut_video_input = executable('ut_video_input', + include_directories: include_directories('..', '../src', '../src/dring', '../src/media'), + sources: files('unitTest/media/video/testVideo_input.cpp'), + link_with: libjami, + dependencies: depcppunit + ) + test('video_input', ut_video_input) + + # + # video_scaler + # + ut_video_scaler = executable('ut_video_scaler', + include_directories: include_directories('../src', '../src/dring'), + sources: files('unitTest/media/video/test_video_scaler.cpp'), + link_with: libjami, + dependencies: depcppunit + ) + test('video_scaler', ut_video_scaler) +endif + +# +# connectionManager +# +ut_connectionManager = executable('ut_connectionManager', + include_directories: include_directories('..', '../src', '../src/dring', '../src/media'), + sources: files('unitTest/connectionManager/connectionManager.cpp'), + link_with: libjami, + dependencies: [depcppunit, deplibpjproject] +) +test('connectionManager', ut_connectionManager)