Files
asterisk/third-party/pjproject/dependency_utils
Alexei Gradinari 47011850d4 build: remove pjsua, pjsystest, Python bindings and asterisk_malloc_debug stubs from pjproject dev build
The pjsua Python module and the pjsua/pjsystest apps were used by the
Asterisk Test Suite for SIP simulation in dev mode builds. They are now
fully obsolete for three independent reasons:

1. **pjsua Python bindings officially deprecated upstream.** The pjproject
   maintainers added `pjsip-apps/src/python/DEPRECATED.txt` directing
   users to the PJSUA2 SWIG binding instead. A build-fix PR
   (https://github.com/pjsip/pjproject/pull/4892) was closed by the
   maintainer explicitly citing this deprecation.

2. **Removed from the Asterisk Test Suite.** As confirmed by @mbradeen:
   > *"We had to get rid of pjsua when we went to Python3 because it would
   > hang due to a conflict between async calls within pjsua and twisted.
   > There are still some old references to tests we couldn't fully convert
   > to sipp, but those are skipped."*

3. **Broken and unmaintained.** Building with Python 2.7 (the only version
   `configure.ac` searched for) fails with:
   ```
   _pjsua.c: error: 'INIT_RETURN' undeclared (first use in this function)
   ```
   due to a bug in pjproject 2.16's `python3_compat.h` that upstream
   declined to fix.

This PR removes all pjsua-related build artifacts from Asterisk's bundled
pjproject build: the pjsua and pjsystest application binaries, the deprecated
Python (`_pjsua.so`) bindings, the `asterisk_malloc_debug.c` stubs, and the
`PYTHONDEV` detection from `configure.ac`. Also removes `libpjsua` from
Asterisk's main linker flags.

DeveloperNote: The pjsua and pjsystest application binaries, the deprecated
Python pjsua bindings (`_pjsua.so`), and the `asterisk_malloc_debug.c` stub
implementations are no longer built or installed as part of the bundled
pjproject dev mode build. The `PYTHONDEV` (python2.7-dev) build dependency
is also removed. Developers who relied on the pjsua binary for Test Suite
SIP simulation should use SIPp instead, which is the current Asterisk Test
Suite standard.

Fixes: #1840
2026-04-07 17:18:45 +00:00

91 lines
2.0 KiB
Bash
Executable File

#!/bin/sh
[ "x${SED}" = "x" ] && SED=sed
[ "x${GREP}" = "x" ] && GREP=grep
[ "x${REALPATH}" = "x" ] && REALPATH=realpath
[ "x${DIRNAME}" = "x" ] && DIRNAME=dirname
[ "x${BASENAME}" = "x" ] && BASENAME=basename
[ "x${GREP}" = "x" ] && GREP=grep
if [ "x${TARGET_NAME}" = "x" ] ; then
if [ ! -f build.mak ] ; then
exit 0;
fi
TARGET_NAME=$(${SED} -n -r -e "s/export\s+TARGET_NAME\s*:=\s*(.*)/\1/gp" build.mak)
fi
getlibname() {
dep="$1"
libdir=$(${DIRNAME} $(${DIRNAME} "${dep}"))/lib
depname=$(${BASENAME} "${dep}")
depprefix="${depname%%-${TARGET_NAME}.depend}"
case ${depprefix} in
.pjlib)
libfile=libpj
;;
.*)
libfile=lib${depprefix#.*}
;;
esac
echo "${libdir}/${libfile}-${TARGET_NAME}.a"
}
gendepfile() {
pjdf="$1"
astdf="${pjdf%*.depend}.astdep"
dirname=$(${DIRNAME} "${astdf}")
lines=$(grep -E -o -- "[.][.]/[^ ]+" "${pjdf}" | sort -u | wc -l)
libname=$(getlibname "${pjdf}")
backslash="\\"
echo "${libname}: ${backslash}" >"${astdf}"
for dep in $(grep -E -o -- "[.][.]/[^ ]+" "${pjdf}" | sort -u) ; do
( echo "${dep}" | grep -Eq "(test|/bin/)" ; ) && continue
newdep=$( cd "${dirname}" ; ${REALPATH} -L --relative-to=../../ "${dep}" ; )
lines=$(( ${lines} - 1 ))
if [ ${lines} -eq 0 ] ; then
echo "source/${newdep}" >>"${astdf}"
else
echo "source/${newdep} ${backslash}" >>"${astdf}"
fi
done
echo >>"${astdf}"
}
getpjdepname () {
lib="$1"
builddir=$(${DIRNAME} $(${DIRNAME} "${lib}"))/build
libname=$(${BASENAME} "${lib}")
libprefix="${libname%%-${TARGET_NAME}.a}"
nolib=$(echo "${libprefix}" | ${SED} -r -e "s@^lib@@g")
case ${nolib} in
pj)
depfile=.pjlib
;;
resample)
depfile=resample/.libresample
;;
*)
depfile=.${nolib}
;;
esac
echo "${builddir}/${depfile}-${TARGET_NAME}.depend"
}
case $1 in
getpjdepname)
shift
for lib in $@ ; do getpjdepname "${lib}" ; done
;;
gendepfile)
shift
for dep in $@ ; do gendepfile "${dep}" ; done
;;
getlibname)
shift
for dep in $@ ; do getlibname "${dep}" ; done
;;
*)
echo Invalid command
exit 1
;;
esac