2019-10-30 00:42:31 +01:00
|
|
|
fixupOutputHooks+=('if [ -z "${dontGzipMan-}" ]; then compressManPages "$prefix"; fi')
|
2014-06-27 13:33:05 +02:00
|
|
|
|
|
|
|
compressManPages() {
|
|
|
|
local dir="$1"
|
|
|
|
|
2017-02-27 20:03:45 +01:00
|
|
|
if [ -L "$dir"/share ] || [ -L "$dir"/share/man ] || [ ! -d "$dir/share/man" ]
|
|
|
|
then return
|
|
|
|
fi
|
|
|
|
echo "gzipping man pages under $dir/share/man/"
|
2014-06-27 13:33:05 +02:00
|
|
|
|
2017-02-27 20:03:45 +01:00
|
|
|
# Compress all uncompressed manpages. Don't follow symlinks, etc.
|
2021-08-19 22:38:07 +02:00
|
|
|
find "$dir"/share/man/ -type f -a '!' -regex '.*\.\(bz2\|gz\|xz\)$' -print0 \
|
2017-02-27 20:03:45 +01:00
|
|
|
| while IFS= read -r -d $'\0' f
|
|
|
|
do
|
|
|
|
if gzip -c -n "$f" > "$f".gz; then
|
|
|
|
rm "$f"
|
|
|
|
else
|
|
|
|
rm "$f".gz
|
2014-06-27 13:33:05 +02:00
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
2017-02-27 20:03:45 +01:00
|
|
|
# Point symlinks to compressed manpages.
|
2021-08-19 22:38:07 +02:00
|
|
|
find "$dir"/share/man/ -type l -a '!' -regex '.*\.\(bz2\|gz\|xz\)$' -print0 \
|
2020-12-03 20:03:20 +01:00
|
|
|
| sort -z \
|
2017-02-27 20:03:45 +01:00
|
|
|
| while IFS= read -r -d $'\0' f
|
|
|
|
do
|
|
|
|
local target
|
|
|
|
target="$(readlink -f "$f")"
|
|
|
|
if [ -f "$target".gz ]; then
|
|
|
|
ln -sf "$target".gz "$f".gz && rm "$f"
|
2014-06-27 13:33:05 +02:00
|
|
|
fi
|
|
|
|
done
|
|
|
|
}
|