Annotation of embedaddon/libnet/doc/fixmanpages.in, revision 1.1
1.1 ! misho 1: #!@SHELL@
! 2:
! 3: # Doxygen's man page generation is unfortunately very rudimentary.
! 4: #
! 5: # So in addition to creating the libnet(3) man page from pod file, this
! 6: # script also tries to add a few "finishing touches" to man pages
! 7: # generated by Doxygen.
! 8: #
! 9: # It will run after building libnet and after Doxygen generated all its
! 10: # documentations. If you ever have to run it manually, you should do the same.
! 11: # Apart from a few widely available GNU utilities, you'll also need pod2man
! 12: # (aka libpod-latex-perl) to get it to work.
! 13:
! 14: MANPAGENOTE='.SH "SEE ALSO"\n\.IX Header "SEE ALSO"\nlibnet(3)\n.SH "AUTHORS"\n.IX Header "AUTHORS"\nThe original author of libnet is Mike D. Schiffman.\n.PP\nlibnet has been maintained and extensively enhanced since 2009 by Sam Roberts.\n.PP\nIt is maintained by the Libnet Developer Community at GitHub.\n.PP\n.Vb 1\n\& <https://github.com/libnet/libnet>\n.Ve\n.SH "BUGS"\n.IX Header "BUGS"\nSuggestions, bug reports/fixes, and pull requests, see:\n.PP\n.Vb 1\n\& <https://github.com/libnet/libnet/issues>\n.Ve\n.SH "COPYRIGHT"\n.IX Header "COPYRIGHT"\nlibnet is licensed under the 3\-Clause \s-1BSD\s0 License.'
! 15:
! 16: die() {
! 17: echo "$*" 1>&2
! 18: exit 1
! 19: }
! 20:
! 21: MANDIR=$1
! 22: if test x"$MANDIR" = x ; then
! 23: MANDIR=man/
! 24: fi
! 25:
! 26: test -d $MANDIR/man3 || die "Could not locate $MANDIR/man3 directory."
! 27:
! 28: # For now, I will let Doxygen still produces its useless and totally misleading
! 29: # man page for "libnet.h" and simply delete it now. That's mostly because not
! 30: # doing so will also remove all references to "libnet.h" in all documentations.
! 31: # And we wouldn't want that, would we?
! 32: find $MANDIR/man3/ -name "libnet.h.3" -exec sh -c 'rm -f "$1"' _ {} \;
! 33:
! 34: # Let's create libnet.3 before dealing with the rest.
! 35: # BTW: We're using this hideous date format because Doxygen generated man
! 36: # pages have them set like this and our date format shouldn't look different.
! 37:
! 38: pod2man -d "$(date +%a\ %b\ %d\ %C%y)" -n LIBNET -c "libnet Programmers Guide" -s 3 -r "@PACKAGE_NAME@-@PACKAGE_VERSION@" @top_srcdir@/doc/libnet.Pod man/man3/libnet.3 || die "Could not create libnet.3 in $MANDIR/man/man3."
! 39:
! 40: # pod2html --title="libnet Programmers Guide" --noindex --infile=libnet.Pod --outfile=libnet.html
! 41:
! 42: cd "$MANDIR/man3" || die "Could not cd into $MANDIR/man3"
! 43:
! 44: # A little housekeeping...
! 45: (find . -name "_*" -exec sh -c 'rm "$1"' _ {} \;) || die "could not remove all underscore-prefixed items"
! 46:
! 47: # renaming all man pages form "*.h.3" to just "*.3"
! 48: (find . -name "*.h.3" -exec sh -c 'mv "$1" "${1%.h.3}.3"' _ {} \;) || die "could not rename all .h.3-suffixed items"
! 49:
! 50: # Changing the name of the man pages to all UPPERCASE.
! 51: # FIXME make Doxygen properly generate docs for all other
! 52: # libnet-*.h files and add them here
! 53: sed -i -e '1!b;s/libnet\/libnet-functions\.h/LIBNET-FUNCTIONS/' libnet-functions.3
! 54: sed -i -e '1!b;s/libnet\/libnet-macros\.h/LIBNET-MACROS/' libnet-macros.3
! 55:
! 56: # Adjusting version string, changing the title, removing both the path and
! 57: # the ".h" extension from name section as well as adding a few more sections
! 58: # to the end.
! 59: for MAN in $(find . -name "libnet-*.3"); do
! 60: sed -i -e '1!b;s/Version\ /libnet-/' \
! 61: -e '1!b;s/"libnet"/"libnet\ Programmers \Guide"/' $MAN
! 62: sed -i -e '5 s/libnet\///' \
! 63: -e '/.SH "Author"/,/from the source code\&./c \nBe' $MAN
! 64: echo -e $MANPAGENOTE >> $MAN
! 65: done
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>