mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-31 18:55:19 +00:00
bundled_pjproject: Make it easier to hack
There are times when you need to troubleshoot issues with bundled pjproject or add new features that need to be pushed upstream but... * The source directory created by extracting the pjproject tarball is not scanned for code changes so you have to keep forcing rebuilds. * The source directory isn't a git repo so you can't easily create patches, do git bisects, etc. * Accidentally doing a make distclean will ruin your day by wiping out the source directory, and your changes. * etc. This commit makes that easier. See third-party/pjproject/README-hacking.md for the details. ASTERISK-29824 Change-Id: Idb1251040affdab31d27cd272dda68676da9b268
This commit is contained in:
96
third-party/pjproject/dependency_utils
vendored
Executable file
96
third-party/pjproject/dependency_utils
vendored
Executable file
@@ -0,0 +1,96 @@
|
||||
#!/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
|
||||
;;
|
||||
.pjsua-lib)
|
||||
libfile=libpjsua
|
||||
;;
|
||||
.*)
|
||||
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
|
||||
;;
|
||||
pjsua)
|
||||
depfile=.pjsua-lib
|
||||
;;
|
||||
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
|
||||
Reference in New Issue
Block a user