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