From: Mike Bradeen Date: Tue, 14 Jul 2026 16:08:46 +0000 (-0600) Subject: build: re-add pjsua test application X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=ea9b48659d3fb861bd8d6d5b88512d48bf63f8a7;p=thirdparty%2Fasterisk.git build: re-add pjsua test application pjsua and it's python bindings were removed as part of PR 1854. Testing for RTT requires the pjsua application be re-added to the third pary build process. This applies to the pjsua application ONLY and not the associated python bindings. Resolves: #2024 --- diff --git a/third-party/pjproject/Makefile b/third-party/pjproject/Makefile index 67d2b22107..332ff30251 100644 --- a/third-party/pjproject/Makefile +++ b/third-party/pjproject/Makefile @@ -60,9 +60,18 @@ ifeq ($(SPECIAL_TARGETS),) CF := $(filter-out -I%,$(CF)) ifeq ($(PJPROJECT_BUNDLED_OOT),) ifeq ($(AST_DEVMODE),yes) + apps := source/pjsip-apps/bin/pjsua-$(TARGET_NAME) + TARGETS += $(apps) CF += -DPJPROJECT_BUNDLED_ASSERTIONS=yes endif endif + MALLOC_DEBUG_LIBS = source/pjsip-apps/lib/libasterisk_malloc_debug.a + ifneq ($(findstring darwin,$(OSARCH)),) + MALLOC_DEBUG_LDFLAGS = -L$(PJDIR)/pjsip-apps/lib -Wl,-all_load -lasterisk_malloc_debug -Wl,-noall_load + else + # These are used for all but Darwin + MALLOC_DEBUG_LDFLAGS = -L$(PJDIR)/pjsip-apps/lib -Wl,-whole-archive -lasterisk_malloc_debug -Wl,-no-whole-archive + endif ifeq ($(findstring DONT_OPTIMIZE,$(MENUSELECT_CFLAGS)),) CF += -O3 endif @@ -204,10 +213,34 @@ pjproject.symbols: $(ALL_LIB_FILES) $(ECHO_PREFIX) Generating symbols $(CMD_PREFIX) $(NM) -Pog $(ALL_LIB_FILES) | $(SED) -n -E -e "s/.+: ([_]?[pP][jJ][^ ]+) .+/\1/gp" | sort -u > pjproject.symbols +source/pjsip-apps/src/asterisk_malloc_debug.c: patches/asterisk_malloc_debug.c + $(ECHO_PREFIX) Copying $< to $@ + $(CMD_PREFIX) cp -f $< $@ + -$(CMD_PREFIX) mkdir source/pjsip-apps/lib/ $(REALLY_QUIET) + +source/pjsip-apps/lib/asterisk_malloc_debug.o: source/pjsip-apps/src/asterisk_malloc_debug.c | source/pjlib/include/pj/config_site.h source/pjlib/include/pj/asterisk_malloc_debug.h + $(ECHO_PREFIX) Compiling asterisk debug malloc stubs + $(CMD_PREFIX) $(CC) -fPIC $(PJ_CFLAGS) -c $< -o $@ + +source/pjsip-apps/lib/libasterisk_malloc_debug.a: source/pjsip-apps/lib/asterisk_malloc_debug.o + $(ECHO_PREFIX) Creating archive $(@F) + $(CMD_PREFIX) ar qs $@ $< $(REALLY_QUIET) + +$(apps): APP = $(filter pj%,$(subst -, ,$(notdir $@))) +$(apps): LDFLAGS += $(MALLOC_DEBUG_LDFLAGS) +$(apps): $(MALLOC_DEBUG_LIBS) pjproject.symbols + $(ECHO_PREFIX) Compiling $(APP) + $(CMD_PREFIX) +$(MAKE) -C source/pjsip-apps/build $(APP) $(REALLY_QUIET) + $(CMD_PREFIX) touch $@ + _install: _all @if [ ! -d "$(DESTDIR)$(ASTDATADIR)/third-party/pjproject" ]; then \ $(INSTALL) -d "$(DESTDIR)$(ASTDATADIR)/third-party/pjproject"; \ fi; +ifneq ($(findstring source/pjsip-apps/bin/pjsua-$(TARGET_NAME),$(TARGETS)),) + $(ECHO_PREFIX) Installing app + $(CMD_PREFIX) $(INSTALL) -m 755 source/pjsip-apps/bin/pjsua-$(TARGET_NAME) "$(DESTDIR)$(ASTDATADIR)/third-party/pjproject/pjsua" +endif all: _all @@ -220,6 +253,7 @@ clean: +-$(CMD_PREFIX) {\ if [ -d source ] ; then \ $(SUBMAKE) -C source clean ;\ + rm -f source/pjsip-apps/bin/pjsua-* ;\ $(FIND) source/ '(' -name *.a -or -name *.o -or -name *.so ')' -delete ;\ fi ;\ rm -rf pjproject.symbols ;\ diff --git a/third-party/pjproject/patches/asterisk_malloc_debug.c b/third-party/pjproject/patches/asterisk_malloc_debug.c new file mode 100644 index 0000000000..061bdd4915 --- /dev/null +++ b/third-party/pjproject/patches/asterisk_malloc_debug.c @@ -0,0 +1,70 @@ +/* + * Asterisk -- An open source telephony toolkit. + * + * Copyright (C) 2016, Digium, Inc + * + * George Joseph + * + * See http://www.asterisk.org for more information about + * the Asterisk project. Please do not directly contact + * any of the maintainers of this project for assistance; + * the project provides a web site, mailing lists and IRC + * channels for your use. + * + * This program is free software, distributed under the terms of + * the GNU General Public License Version 2. See the LICENSE file + * at the top of the source tree. + */ +#define _GNU_SOURCE + +#include +#include +#include +#include + +int __ast_repl_asprintf(const char *file, int lineno, const char *func, char **strp, const char *format, ...) +{ + va_list ap; + int rc = 0; + + va_start(ap, format); + rc = vasprintf(strp, format, ap); + va_end(ap); + + return rc; +} + +void *__ast_repl_calloc(size_t nmemb, size_t size, const char *file, int lineno, const char *func) +{ + return calloc(nmemb, size); +} + +void __ast_free(void *ptr, const char *file, int lineno, const char *func) +{ + free(ptr); +} + +void *__ast_repl_malloc(size_t size, const char *file, int lineno, const char *func) +{ + return malloc(size); +} + +void *__ast_repl_realloc(void *ptr, size_t size, const char *file, int lineno, const char *func) +{ + return realloc(ptr, size); +} + +char *__ast_repl_strdup(const char *s, const char *file, int lineno, const char *func) +{ + return strdup(s); +} + +char *__ast_repl_strndup(const char *s, size_t n, const char *file, int lineno, const char *func) +{ + return strndup(s, n); +} + +int __ast_repl_vasprintf(char **strp, const char *format, va_list ap, const char *file, int lineno, const char *func) +{ + return vasprintf(strp, format, ap); +}