Prefer using GNU Patch

The patches we use do not apply with BSD Patch. Attempt to find GNU
Patch and use that instead of the default 'patch' program. The patches
appear to apply fine as no errors are returned when we run patch.
However, files like libsysbase/dummy.c aren't created and we see the
following error:

    gmake[2]: Entering directory '.devkitARM/arm-none-eabi/newlib/arm-none-eabi/libgloss' /usr/local/bin/gmake  all-recursive
    gmake[3]: Entering directory '.devkitARM/arm-none-eabi/newlib/arm-none-eabi/libgloss'
    Making all in .
    gmake[4]: Entering directory '.devkitARM/arm-none-eabi/newlib/arm-none-eabi/libgloss'
      MAKEINFO ../../../../newlib-4.4.0.20231231/libgloss/doc/porting.info
      gmake[4]: *** No rule to make target 'libsysbase/dummy.c', needed by 'libsysbase/dummy.o'.  Stop.

By switching to GNU Patch, our patches properly apply and the build
succeeds.
This commit is contained in:
Jaeden Amero 2024-07-07 11:14:43 +00:00 committed by Dave Murphy
parent d3d636cb54
commit 88bd526925

View File

@ -36,6 +36,18 @@ DKA64_RULES_VER=1.1.1
OSXMIN=${OSXMIN:-10.9}
#---------------------------------------------------------------------------------
# find proper patch
#---------------------------------------------------------------------------------
if [ -z "$PATCH" -a -x "$(which gpatch)" ]; then PATCH=$(which gpatch); fi
if [ -z "$PATCH" -a -x "$(which patch)" ]; then PATCH=$(which patch); fi
if [ -z "$PATCH" ]; then
echo no patch found
exit 1
fi
echo use $PATCH as patch
export PATCH
#---------------------------------------------------------------------------------
function extract_and_patch {
#---------------------------------------------------------------------------------
@ -46,7 +58,7 @@ function extract_and_patch {
fi
if [[ ! -f patched-$1-$2 && -f $patchdir/$1-$2.patch ]]; then
echo "patching $1-$2"
patch -p1 -d $1-$2 -i $patchdir/$1-$2.patch || { echo "Error patching $1"; exit 1; }
$PATCH -p1 -d $1-$2 -i $patchdir/$1-$2.patch || { echo "Error patching $1"; exit 1; }
touch patched-$1-$2
fi
}