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##*/}
|
|
|
|
|
2014-02-12 18:38:32 +01:00
|
|
|
if [ -f $PATCHESDIR/${_patch}.args ]; then
|
2019-04-13 22:37:30 +02:00
|
|
|
_args=$(<$PATCHESDIR/${_patch}.args)
|
2014-02-12 18:38:32 +01:00
|
|
|
elif [ -n "$patch_args" ]; then
|
|
|
|
_args=$patch_args
|
|
|
|
fi
|
2015-07-29 10:17:37 +02:00
|
|
|
cp -f $i "$wrksrc"
|
2014-02-12 18:38:32 +01:00
|
|
|
|
|
|
|
# Try to guess if its a compressed patch.
|
2014-05-31 07:55:46 +02:00
|
|
|
if [[ $f =~ .gz$ ]]; then
|
2015-07-29 10:17:37 +02:00
|
|
|
gunzip "$wrksrc/${_patch}"
|
2014-02-12 18:38:32 +01:00
|
|
|
_patch=${_patch%%.gz}
|
2014-05-31 07:55:46 +02:00
|
|
|
elif [[ $f =~ .bz2$ ]]; then
|
2015-07-29 10:17:37 +02:00
|
|
|
bunzip2 "$wrksrc/${_patch}"
|
2014-02-12 18:38:32 +01:00
|
|
|
_patch=${_patch%%.bz2}
|
2017-09-26 12:34:52 +02:00
|
|
|
elif [[ $f =~ .diff$ ]]; then
|
2014-02-12 18:38:32 +01:00
|
|
|
:
|
2017-09-26 12:34:52 +02:00
|
|
|
elif [[ $f =~ .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"
|
2014-02-12 18:38:32 +01:00
|
|
|
patch -sl ${_args} -i ${_patch} 2>/dev/null
|
|
|
|
}
|
|
|
|
|
|
|
|
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
|
|
|
|
[ ! -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
|
|
|
|
_process_patch $f
|
|
|
|
done
|
|
|
|
fi
|
|
|
|
}
|