summaryrefslogtreecommitdiffstats
path: root/pkgs/build-support
diff options
context:
space:
mode:
authorVladimír Čunát <vcunat@gmail.com>2017-03-01 11:34:44 +0100
committerVladimír Čunát <vcunat@gmail.com>2017-03-01 11:34:44 +0100
commitb43614a6bb026de61c8c967504ece02e1e45f7e6 (patch)
treeed0e6cbdc9b92d225af88e85d555eb6defc3d60d /pkgs/build-support
parent150796d3b260a1800a3cd8f84d3c8657bad09dd9 (diff)
parent64d4bfd1397b48236199a660c49ad60f13188365 (diff)
Merge branch 'staging'
(Truly, this time :-)
Diffstat (limited to 'pkgs/build-support')
-rw-r--r--pkgs/build-support/setup-hooks/compress-man-pages.sh36
1 files changed, 20 insertions, 16 deletions
diff --git a/pkgs/build-support/setup-hooks/compress-man-pages.sh b/pkgs/build-support/setup-hooks/compress-man-pages.sh
index f1d9cf3a3696..d10a898d6e46 100644
--- a/pkgs/build-support/setup-hooks/compress-man-pages.sh
+++ b/pkgs/build-support/setup-hooks/compress-man-pages.sh
@@ -3,26 +3,30 @@ fixupOutputHooks+=('if [ -z "$dontGzipMan" ]; then compressManPages "$prefix"; f
compressManPages() {
local dir="$1"
- if [ ! -d "$dir/share/man" ]; then return; fi
- echo "gzipping man pages in $dir"
+ if [ -L "$dir"/share ] || [ -L "$dir"/share/man ] || [ ! -d "$dir/share/man" ]
+ then return
+ fi
+ echo "gzipping man pages under $dir/share/man/"
- GLOBIGNORE=.:..:*.gz:*.bz2
-
- for f in "$dir"/share/man/*/* "$dir"/share/man/*/*/*; do
- if [ -f "$f" -a ! -L "$f" ]; then
- if gzip -c -n "$f" > "$f".gz; then
- rm "$f"
- else
- rm "$f".gz
- fi
+ # Compress all uncompressed manpages. Don't follow symlinks, etc.
+ find "$dir"/share/man/ -type f -a '!' -regex '.*\.\(bz2\|gz\)$' -print0 \
+ | while IFS= read -r -d $'\0' f
+ do
+ if gzip -c -n "$f" > "$f".gz; then
+ rm "$f"
+ else
+ rm "$f".gz
fi
done
- for f in "$dir"/share/man/*/* "$dir"/share/man/*/*/*; do
- if [ -L "$f" -a -f `readlink -f "$f"`.gz ]; then
- ln -sf `readlink "$f"`.gz "$f".gz && rm "$f"
+ # Point symlinks to compressed manpages.
+ find "$dir"/share/man/ -type l -a '!' -regex '.*\.\(bz2\|gz\)$' -print0 \
+ | 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"
fi
done
-
- unset GLOBIGNORE
}