Files
asterisk/third-party/pjproject/apply_patches
Corey Farrell b4f7f8250f Build: Fix OSX build issues.
OSX does not support 'readlink -f' or 'sed -r'.  Replace readlink with
the GNU make macro 'realpath'.  Replace sed with grep in one place, cut
in the other.

ASTERISK-27332

Change-Id: I5d34ecca905384decb22ead45c913ae5e8aff748
2017-11-19 14:33:26 -06:00

35 lines
638 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}
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
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