2014-02-12 18:38:32 +01:00
|
|
|
# This hook applies patches from "patches" directory.
|
|
|
|
|
|
|
|
_process_patch() {
|
|
|
|
local _args= _patch= i=$1
|
|
|
|
|
2021-06-18 02:38:20 +02:00
|
|
|
_args="-Np1"
|
2015-09-11 07:55:40 +02:00
|
|
|
_patch=${i##*/}
|
|
|
|
|
2022-05-19 20:56:42 +02:00
|
|
|
if [ -f "$PATCHESDIR/${_patch}.args" ]; then
|
|
|
|
_args=$(<"$PATCHESDIR/${_patch}.args")
|
2014-02-12 18:38:32 +01:00
|
|
|
elif [ -n "$patch_args" ]; then
|
|
|
|
_args=$patch_args
|
|
|
|
fi
|
2022-05-19 20:56:42 +02:00
|
|
|
cp -f "$i" "$wrksrc"
|
2014-02-12 18:38:32 +01:00
|
|
|
|
|
|
|
# Try to guess if its a compressed patch.
|
2022-05-19 20:56:42 +02:00
|
|
|
if [[ $i =~ .gz$ ]]; then
|
2015-07-29 10:17:37 +02:00
|
|
|
gunzip "$wrksrc/${_patch}"
|
2014-02-12 18:38:32 +01:00
|
|
|
_patch=${_patch%%.gz}
|
2022-05-19 20:56:42 +02:00
|
|
|
elif [[ $i =~ .bz2$ ]]; then
|
2015-07-29 10:17:37 +02:00
|
|
|
bunzip2 "$wrksrc/${_patch}"
|
2014-02-12 18:38:32 +01:00
|
|
|
_patch=${_patch%%.bz2}
|
2022-05-19 20:56:42 +02:00
|
|
|
elif [[ $i =~ .diff$ ]]; then
|
2014-02-12 18:38:32 +01:00
|
|
|
:
|
2022-05-19 20:56:42 +02:00
|
|
|
elif [[ $i =~ .patch$ ]]; then
|
2014-02-12 18:38:32 +01:00
|
|
|
:
|
|
|
|
else
|
|
|
|
msg_warn "$pkgver: unknown patch type: $i.\n"
|
2017-09-26 12:34:52 +02:00
|
|
|
return 0
|
2014-02-12 18:38:32 +01:00
|
|
|
fi
|
|
|
|
|
2015-07-29 10:17:37 +02:00
|
|
|
cd "$wrksrc"
|
2015-08-02 10:54:59 +02:00
|
|
|
msg_normal "$pkgver: patching: ${_patch}.\n"
|
2022-05-19 20:56:42 +02:00
|
|
|
patch -s ${_args} <"${_patch}" 2>/dev/null
|
2014-02-12 18:38:32 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
hook() {
|
|
|
|
if [ ! -d "$wrksrc" ]; then
|
|
|
|
return 0
|
|
|
|
fi
|
|
|
|
if [ -r $PATCHESDIR/series ]; then
|
2019-04-13 22:37:30 +02:00
|
|
|
while read -r f; do
|
2014-02-12 18:38:32 +01:00
|
|
|
_process_patch "$PATCHESDIR/$f"
|
2019-04-13 22:37:30 +02:00
|
|
|
done < $PATCHESDIR/series
|
2014-02-12 18:38:32 +01:00
|
|
|
else
|
|
|
|
for f in $PATCHESDIR/*; do
|
2022-05-19 20:56:42 +02:00
|
|
|
[ ! -f "$f" ] && continue
|
2019-04-14 07:14:05 +02:00
|
|
|
if [[ $f =~ ^.*.args$ ]]; then
|
2014-02-12 18:38:32 +01:00
|
|
|
continue
|
|
|
|
fi
|
2022-05-19 20:56:42 +02:00
|
|
|
_process_patch "$f"
|
2014-02-12 18:38:32 +01:00
|
|
|
done
|
|
|
|
fi
|
|
|
|
}
|