mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-22 05:06:38 +00:00
* CFLAGS is now properly set when using older gcc. * All third-party pjproject targets have been removed. This fixes an issue with older libsrtp in some distros. * Manually removing the source directory now causes a rebuild. * EXTERNALS_CACHE_DIR is now properly checked. * Whitespace fixes. Change-Id: I98fec6847efc5602a9f41cb95096fd660a49fa60
48 lines
996 B
Bash
Executable File
48 lines
996 B
Bash
Executable File
#!/bin/sh
|
|
|
|
if [ "$1" = "-q" ] ; then
|
|
quiet=1
|
|
shift
|
|
fi
|
|
|
|
PATCH=${PATCH:-patch}
|
|
|
|
patchdir=${1:?You must supply a patches directory}
|
|
sourcedir=${2?:You must supply a source directory}
|
|
|
|
patchdir=`readlink -f $patchdir`
|
|
sourcedir=`readlink -f $sourcedir`
|
|
|
|
if [ ! -d "$patchdir" ] ; then
|
|
echo "$patchdir is not a directory" >&2
|
|
exit 1
|
|
fi
|
|
|
|
if [ ! -d "$sourcedir" ] ; then
|
|
echo "$sourcedir is not a directory" >&2
|
|
exit 1
|
|
fi
|
|
|
|
if [ ! "$(ls -A $patchdir/*.patch 2>/dev/null)" ] ; then
|
|
echo "No patches in $patchdir" >&2
|
|
exit 0
|
|
fi
|
|
|
|
if patch --dry-run </dev/null >/dev/null 2>&1 ; then
|
|
DRY_RUN=--dry-run
|
|
else
|
|
DRY_RUN=-C
|
|
fi
|
|
|
|
for patchfile in $patchdir/*.patch ; do
|
|
${PATCH} -d $sourcedir -p1 -s -r- -f -N $DRY_RUN -i "$patchfile" || (echo "Patchfile $(basename $patchfile) failed to apply" >&2 ; exit 1) || exit 1
|
|
done
|
|
|
|
for patchfile in "$patchdir"/*.patch ; do
|
|
[ -z $quiet ] && echo "Applying patch $(basename $patchfile)"
|
|
${PATCH} -d "$sourcedir" -p1 -s -i "$patchfile" || exit 1
|
|
done
|
|
|
|
exit 0
|
|
|