xargs --no-run-if-empty rm -f
end
-MACRO_PATCHES = /usr/lib/pakfire/patch %{patches}
+MACRO_PATCHES = /usr/lib/pakfire/patch --search-path=%{DIR_PATCHES} %{patches}
# Pre-defined build scripts.
build
# By default, take all patches from the patches directory
# in alphabetical order.
-patches = $(find %{DIR_PATCHES} -not -type d 2>/dev/null | sort)
+patches = $(find . -not -type d 2>/dev/null | sort)
sources = %{thisapp}.tar.gz
# Macro definitions
#!/bin/bash
# Script that automatically applies patches.
-if [ -n "${1}" ]; then
+paths=
+patches=
+
+while [ $# -gt 0 ]; do
+ case "${1}" in
+ --search-path=*)
+ paths="${paths} ${1#--search-path=}"
+ ;;
+ *)
+ patches="${patches} ${1}"
+ ;;
+ esac
+ shift
+done
+
+if [ -n "${patches}" ]; then
echo "Applying patches..."
fi
# Apply all patches given on command line.
-for patch in $@; do
+for patch in ${patches}; do
+ case "${patch}" in
+ /*)
+ ;;
+ *)
+ for path in ${paths}; do
+ if [ -e "${path}/${patch}" ]; then
+ patch="${path}/${patch}"
+ break
+ fi
+ done
+ ;;
+ esac
+
# Check if patch file does exist.
if ! [ -e "${patch}" ]; then
echo >&2 " ERROR: Patch file does not exist: ${patch}"