TT#6850 Fix build system

* Make all the C++ code build again. Due to the build system not
  failing on compilation/link errors, parts of the code base has
  suffered bit rot.

* Build the library as shared. Otherwise we are trying to link a
  static library built as PIE into a shared library.

* Fix module exclusion logic. Several of the modules cannot be
  compiled because they miss Makefiles, others require additional
  dependencies or similar. So encode this in the build system so
  that people building do not have to figure this out, even if
  they pass an explicit list of modules to include or exclude.

* Revamp the build system.
  - Make errors fatal, so that they do not get ignored anymore.
  - Use sane make variables that a shell will accept as valid,
    otherwise the exports do not work at all.
  - Do not use system paths when we should use in-tree ones.

Change-Id: I795783e0f1bd655cdbb2de0329c389e2bb2e2f07
changes/15/9815/6
Guillem Jover 10 years ago
parent b14b5dc5d1
commit efbb87f805

@ -0,0 +1,125 @@
Description: Make the code build again
Due to the build system not failing on compilation/link errors, parts of
the code base has suffered bit rot.
Author: Guillem Jover <gjover@sipwise.com>
---
--- ngcp-sems-1.6.0.orig/apps/examples/b2b_connect/b2b_connect.cpp
+++ ngcp-sems-1.6.0/apps/examples/b2b_connect/b2b_connect.cpp
@@ -251,10 +251,11 @@ inline UACAuthCred* b2b_connectCalleeSes
return &credentials;
}
-void b2b_connectCalleeSession::onSipReply(const AmSipReply& reply,
+void b2b_connectCalleeSession::onSipReply(const AmSipRequest& req,
+ const AmSipReply& reply,
AmSipDialog::Status old_dlg_status) {
- AmB2ABCalleeSession::onSipReply(reply, old_dlg_status);
+ AmB2ABCalleeSession::onSipReply(req, reply, old_dlg_status);
if ((old_dlg_status < AmSipDialog::Connected) &&
(dlg->getStatus() == AmSipDialog::Disconnected)) {
--- ngcp-sems-1.6.0.orig/apps/examples/b2b_connect/b2b_connect.h
+++ ngcp-sems-1.6.0/apps/examples/b2b_connect/b2b_connect.h
@@ -84,7 +84,7 @@ class b2b_connectCalleeSession
AmSipRequest invite_req;
protected:
- void onSipReply(const AmSipReply& reply, AmSipDialog::Status old_dlg_status);
+ void onSipReply(const AmSipRequest& req, const AmSipReply& reply, AmSipDialog::Status old_dlg_status);
public:
b2b_connectCalleeSession(const string& other_tag,
--- ngcp-sems-1.6.0.orig/apps/examples/cacheannounce/CacheAnnounce.cpp
+++ ngcp-sems-1.6.0/apps/examples/cacheannounce/CacheAnnounce.cpp
@@ -120,7 +120,7 @@ void CacheAnnounceDialog::process(AmEven
AmAudioEvent* audio_event = dynamic_cast<AmAudioEvent*>(event);
if(audio_event && (audio_event->event_id == AmAudioEvent::cleared)){
- dlg.bye();
+ dlg->bye();
setStopped();
return;
}
--- ngcp-sems-1.6.0.orig/apps/examples/jukecall/Jukecall.cpp
+++ ngcp-sems-1.6.0/apps/examples/jukecall/Jukecall.cpp
@@ -128,10 +128,10 @@ void JukecallSession::process(AmEvent* e
switch(state) {
case JC_initial_announcement: {
state = JC_connect;
- string callee = "sip:" + dlg->user.substr(3) + "@" + dlg->domain;
+ string callee = "sip:" + dlg->getUser().substr(3) + "@" + dlg->getDomain();
DBG("-------------------------- connecting %s ------------------------\n", callee.c_str());
connectCallee(callee, callee,
- dlg->remote_party, dlg->remote_uri);
+ dlg->getRemoteParty(), dlg->getRemoteUri());
return;
--- ngcp-sems-1.6.0.orig/apps/examples/pinauthconference/PinAuthConference.cpp
+++ ngcp-sems-1.6.0/apps/examples/pinauthconference/PinAuthConference.cpp
@@ -123,7 +123,7 @@ void PinAuthConferenceDialog::connectCon
changeCallgroup(conf_id);
// get a channel from the status
- channel.reset(AmConferenceStatus::getChannel(conf_id,getLocalTag()));
+ channel.reset(AmConferenceStatus::getChannel(conf_id,getLocalTag(),RTPStream()->getSampleRate()));
// clear the playlist
play_list.flush();
--- ngcp-sems-1.6.0.orig/apps/examples/simple_conference/SimpleConference.cpp
+++ ngcp-sems-1.6.0/apps/examples/simple_conference/SimpleConference.cpp
@@ -66,13 +66,13 @@ SimpleConferenceDialog::SimpleConference
SimpleConferenceDialog::~SimpleConferenceDialog()
{
// clean playlist items
- play_list.close(false);
+ play_list.flush();
}
void SimpleConferenceDialog::onSessionStart()
{
// set the conference id ('conference room') to user part of ruri
- conf_id = dlg->user;
+ conf_id = dlg->getUser();
// open the beep file
BeepSound.reset(new AmAudioFile());
@@ -81,7 +81,7 @@ void SimpleConferenceDialog::onSessionSt
}
// get a channel from the status
- channel.reset(AmConferenceStatus::getChannel(conf_id,getLocalTag()));
+ channel.reset(AmConferenceStatus::getChannel(conf_id,getLocalTag(),RTPStream()->getSampleRate()));
// add the channel to our playlist
play_list.addToPlaylist(new AmPlaylistItem(channel.get(),
@@ -100,7 +100,7 @@ void SimpleConferenceDialog::onSessionSt
void SimpleConferenceDialog::onBye(const AmSipRequest& req)
{
- play_list.close();
+ play_list.flush();
setInOut(NULL,NULL);
channel.reset(NULL);
setStopped();
--- ngcp-sems-1.6.0.orig/apps/examples/urlcatcher/UrlCatcher.cpp
+++ ngcp-sems-1.6.0/apps/examples/urlcatcher/UrlCatcher.cpp
@@ -63,8 +63,14 @@ int UrlCatcherFactory::onLoad()
AmSession* UrlCatcherFactory::onInvite(const AmSipRequest& req, const string& app_name,
const map<string,string>& app_params)
{
+ const AmMimeBody* body = req.body.hasContentType(SIP_APPLICATION_SDP);
+ if (!body) {
+ ERROR("Missing MIME body\n");
+ throw AmSession::Exception(404, "Not Found Here (Missing MIME body)");
+ }
+
AmSdp sdp;
- if (sdp.parse(req.body.c_str())) {
+ if (sdp.parse((const char *)body->getPayload())) {
ERROR("SDP parsing error\n");
throw AmSession::Exception(404, "Not Found Here (SDP parse error)");
}

@ -0,0 +1,68 @@
Description: Fix module exclusion logic
Several of the modules cannot be compiled because they miss Makefiles,
others require additional dependencies or similar. So encode this in the
build system so that people building do not have to figure this out, even
if they pass an explicit list of modules to include or exclude.
Author: Guillem Jover <gjover@sipwise.com>
---
--- ngcp-sems-1.6.0.orig/apps/Makefile
+++ ngcp-sems-1.6.0/apps/Makefile
@@ -1,7 +1,7 @@
COREPATH ?= ../core
.DEFAULT_GOAL := all
-local_exclude_app_modules=$(exclude_app_modules)
+local_exclude_app_modules=confpin early_dbprompt mobile_push py_sems gateway twit
include $(COREPATH)/../Makefile.defs
@@ -12,28 +12,22 @@ include $(COREPATH)/../Makefile.defs
# make $(app_modules)
# else
# if exclude_app_modules is set
-# make * - $(exclude_app_modules)
+# make * - $(exclude_app_modules) + local excludes
# else
# make * - Makefile.defs:exclude_app_modules + local excludes
#
-ifneq ($(app_modules),)
- app_modules = $(app_modules)
-else
- ifneq ($(local_exclude_app_modules),)
- exclude_app_modules = $(local_exclude_app_modules)
- else
- exclude_app_modules += mp3 examples py_sems gateway jsonrpc twit db_reg_agent
-
- ifneq ($(USE_MONITORING), yes)
- exclude_app_modules += monitoring
- endif
+ifeq ($(app_modules),)
+ exclude_modules = $(exclude_app_modules)
+ exclude_modules += $(local_exclude_app_modules)
+ ifneq ($(USE_MONITORING), yes)
+ exclude_modules += monitoring
endif
$(info local_exclude_app_modules: $(local_exclude_app_modules))
$(info exclude_app_modules: $(exclude_app_modules))
- app_modules = $(filter-out $(subst ;, ,$(exclude_app_modules))\
+ app_modules = $(filter-out $(subst ;, ,$(exclude_modules)) \
$(wildcard Makefile*) CVS CMakeLists.txt, \
$(wildcard *) examples/tutorial/cc_acc )
--- ngcp-sems-1.6.0.orig/apps/examples/Makefile
+++ ngcp-sems-1.6.0/apps/examples/Makefile
@@ -3,7 +3,7 @@ COREPATH ?= ../../core
include $(COREPATH)/../Makefile.defs
-exclude_modules ?=
+exclude_modules = ivr_examples
modules = $(filter-out $(subst ;, ,$(exclude_modules)) \
$(wildcard Makefile*) $(wildcard Readme*) CVS, \
$(wildcard *) )

@ -0,0 +1,18 @@
Description: Build the library as shared
Otherwise we are trying to link a static library built as PIE into a
shared library.
Author: Guillem Jover <gjover@sipwise.com>
---
--- ngcp-sems-1.6.0.orig/apps/rtmp/librtmp/Makefile
+++ ngcp-sems-1.6.0/apps/rtmp/librtmp/Makefile
@@ -30,7 +30,7 @@ SO_posix=so.0
SO_mingw=dll
SO_EXT=$(SO_$(SYS))
-SHARED=no
+SHARED=yes
SODEF_yes=-fPIC
SOLIB_yes=librtmp.$(SO_EXT)
SOINST_yes=install_$(SO_EXT)

File diff suppressed because it is too large Load Diff

@ -19,3 +19,7 @@ sipwise/MT-20649-add-vsc-for-block-in-clir
sipwise/MT-20649-change-config-validation
sipwise/MT-20649-use-macros
sipwise/0002-b-f-dsm-mod_conference-set-callgroup-to-conference-c.patch
build-fix-bit-rot.patch
build-fix-pie.patch
build-fix-excludes.patch
build-system-revamp.patch

6
debian/rules vendored

@ -23,7 +23,7 @@ export SYSTEM_SAMPLECLOCK_RATE=48000LL
override_dh_auto_build:
$(MAKE) \
cfg-target=/etc/$(APP_NAME)/ prefix=/usr \
cfg_target=/etc/$(APP_NAME)/ prefix=/usr \
exclude_app_modules="$(EXCLUDED_MODULES)" \
exclude_dsm_modules="$(EXCLUDED_DSM_MODULES)" \
DESTDIR=$(CURDIR)/debian/$(APP_NAME)
@ -32,14 +32,14 @@ override_dh_auto_install:
$(MAKE) -C core/ install \
DESTDIR=$(CURDIR)/debian/$(APP_NAME) \
prefix=/usr \
cfg-target=/etc/$(APP_NAME)/
cfg_target=/etc/$(APP_NAME)/
$(MAKE) -C apps/ install \
exclude_app_modules="$(EXCLUDED_MODULES) $(PYTHON_MODULES)" \
exclude_dsm_modules="$(EXCLUDED_DSM_PY_MODULES)" \
DESTDIR=$(CURDIR)/debian/$(APP_NAME) \
prefix=/usr \
cfg-target=/etc/$(APP_NAME)/
cfg_target=/etc/$(APP_NAME)/
dh_python2 /usr/lib/$(APP_NAME)

Loading…
Cancel
Save