# Check that a few mandatory programs are installed
missing_progs="no"
-for prog in patch perl tar wget cpio unzip rsync bc ${DL_TOOLS} ; do
+for prog in perl tar wget cpio unzip rsync bc ${DL_TOOLS} ; do
if ! which $prog > /dev/null ; then
echo "You must install '$prog' on your build machine";
missing_progs="yes"
exit 1
fi
-# apply-patches.sh needs patch with --no-backup-if-mismatch support (GNU, busybox w/DESKTOP)
-if ! patch --no-backup-if-mismatch </dev/null 2>/dev/null; then
- echo "Your patch program does not support the --no-backup-if-mismatch option. Install GNU patch"
+PATCH_VERSION="$(patch -v 2>/dev/null | sed -n 's/^GNU patch \(.*\)/\1/p')"
+if [ -z "${PATCH_VERSION}" ] ; then
+ echo
+ echo "You must install GNU patch"
exit 1
fi
+PATCH_MAJOR="$(echo "${PATCH_VERSION}" | cut -d . -f 1)"
+PATCH_MINOR="$(echo "${PATCH_VERSION}" | cut -d . -f 2)"
+if [ "${PATCH_MAJOR}" -lt 2 ] || [ "${PATCH_MAJOR}" -eq 2 -a "${PATCH_MINOR}" -lt 7 ] ; then
+ echo
+ echo "You have GNU patch '${PATCH_VERSION}' installed. GNU patch >= 2.7 is required"
+ exit 1;
+fi
if grep ^BR2_NEEDS_HOST_UTF8_LOCALE=y $BR2_CONFIG > /dev/null; then
if ! which locale > /dev/null ; then
echo " to be applied : ${path}/${patch}"
exit 1
fi
- if ${uncomp} "${path}/$patch" | grep -q "^rename from" && \
- ${uncomp} "${path}/$patch" | grep -q "^rename to" ; then
- echo "Error: patch contains some renames, not supported by old patch versions"
- exit 1
- fi
echo "${path}/${patch}" >> ${builddir}/.applied_patches_list
${uncomp} "${path}/$patch" | patch -g0 -p1 -E --no-backup-if-mismatch -d "${builddir}" -t -N $silent
if [ $? != 0 ] ; then