From 584d7de232f349f1b388b383be66ac260077aefd Mon Sep 17 00:00:00 2001 From: "Tom G. Christensen" Date: Sat, 15 Apr 2006 12:12:16 +0000 Subject: [PATCH] Add function to convert .so style manpage linking to symlinks --- buildpkg.functions | 40 ++++++++++++++++++++++++++++++++++++++++ buildpkg.packaging.irix | 2 ++ 2 files changed, 42 insertions(+) diff --git a/buildpkg.functions b/buildpkg.functions index 0a07787..a829df3 100644 --- a/buildpkg.functions +++ b/buildpkg.functions @@ -119,6 +119,8 @@ name=$topdir # as will this ditto pkgdirdesig=${topinstalldir##/*/} # topinstalldir suffix # Functionality controls +symlinkman=0 # Don't replace .so linking with symlinks pr. default +symlinkman_verbose=0 # Be quiet catman=0 # Don't fix manpages pr. default gzman=0 # Don't gzip man pages pr. default compressman=0 # Don't compress(1) man pages pr. default @@ -417,6 +419,40 @@ do_autonuke() echo "Found nothing to nuke" fi } + +# symlink_man(): Convert .so style references to symlinks +# params: none +# Run from 'cwd' where 'cwd' contains manX subdirs +symlink_man() +{ + local i + local manpage + local solink + local linkdest + local OIFS + local manpages + + echo "Symlinking manpages" + for i in man? + do + if [ -d $i ]; then + OIFS="$IFS" + IFS=" + " + manpages="$(echo $i/*)" + for manpage in $manpages + do + solink="$($HEAD -1 $manpage)" + if [ "${solink:0:3}" = ".so" ]; then # .so style link to be converted + linkdest="${solink/#.so /}" + [ "$symlinkman_verbose" -eq 1 ] && echo "Symlinking $linkdest->$manpage" + $LN -sf "$linkdest" "$manpage" + fi + done + IFS="$OIFS" + fi + done +} # fix_man(): create compressed pre-formatted manpages from raw ones # params: none @@ -809,3 +845,7 @@ generic_pack_perl() $CAT $metadir/pkgdef.template $srcdir/$topsrcdir/filelist | $SED -e "s;^$prefix/;;g" > $metadir/pkgdef generic_pack "$@" } + +# vim: set filetype=sh : # +# vim: set sts=4 : # +# vim: set shiftwidth=4 : # diff --git a/buildpkg.packaging.irix b/buildpkg.packaging.irix index beae302..660e29c 100644 --- a/buildpkg.packaging.irix +++ b/buildpkg.packaging.irix @@ -27,6 +27,7 @@ hidefile=$metadir/hide showfilescache=/tmp/sf.cache # Preformat manpages since Irix is not likely to have nroff available +symlinkman=1 # resolve .so links or formatting/compressing will fail catman=1 # Compress manpages @@ -1172,6 +1173,7 @@ generic_pack() if [ -d ${stagedir}${prefix}/${_mandir} ]; then setdir "${stagedir}${prefix}/${_mandir}" + [ "$symlinkman" -eq 1 ] && symlink_man [ "$catman" -eq 1 ] && fix_man [ "$gzman" -eq 1 -o "$compressman" -eq 1 ] && compress_man fi