Commit 387f6988 authored by Vladimir Stoiakin's avatar Vladimir Stoiakin Committed by Adrien Béraud

build: add support for meson

Change-Id: I331522a09257d4ae787893ff72c270886c1aa210
Reviewed-by: Sébastien Blin's avatarSébastien Blin <sebastien.blin@savoirfairelinux.com>
parent c4a7918c
......@@ -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
......@@ -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")
......
=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
/*
* 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;
}
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
[D-BUS Service]
Name=cx.ring.Ring
Exec=@LIBDIR@/jamid
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
)
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
......@@ -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
......
[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 = ['']