All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH libnetfilter_queue v2] build: doc: Fix NAME entry in man pages
@ 2021-08-10  2:40 Duncan Roe
  2021-08-15 12:15 ` Pablo Neira Ayuso
  0 siblings, 1 reply; 9+ messages in thread
From: Duncan Roe @ 2021-08-10  2:40 UTC (permalink / raw)
  To: pablo; +Cc: netfilter-devel

Make the NAME line list the functions defined, like other man pages do.
Also:
- If there is a "Modules" section, delete it
- If "Detailed Description" is empty, delete "Detailed Description" line
- Reposition SYNOPSIS (with headers that we inserted) to start of page,
  integrating with defined functions to look like other man pages
- Delete all "Definition at line nnn" lines
- Delete lines that make older versions of man o/p an unwanted blank line
- Insert spacers and comments so Makefile.am is more readable

Signed-off-by: Duncan Roe <duncan_roe@optusnet.com.au>
---
v2: Delete lines that make older versions of man o/p an unwanted blank line
 doxygen/Makefile.am | 172 ++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 172 insertions(+)

diff --git a/doxygen/Makefile.am b/doxygen/Makefile.am
index 29078de..5bcef61 100644
--- a/doxygen/Makefile.am
+++ b/doxygen/Makefile.am
@@ -21,19 +21,32 @@ doxyfile.stamp: $(doc_srcs) Makefile.am
 # The command has to be a single line so the functions work
 # and so `make` gives all lines to `bash -c`
 # (hence ";\" at the end of every line but the last).
+# automake (run by autogen.sh) allows comments starting ## after continuations
+# but not blank lines
+
 	/bin/bash -p -c 'declare -A renamed_page;\
+##
 main(){ set -e; cd man/man3; rm -f _*;\
   count_real_pages;\
   rename_real_pages;\
   make_symlinks;\
+  post_process;\
 };\
+##
 count_real_pages(){ page_count=0;\
+  ##
+  ## Count "real" man pages (i.e. not generated by MAN_LINKS)
+  ## MAN_LINKS pages are 1-liners starting .so
+  ## Method: list files in descending order of size,
+  ## looking for the first 1-liner
+  ##
   for i in $$(ls -S);\
   do head -n1 $$i | grep -E -q '^\.so' && break;\
     page_count=$$(($$page_count + 1));\
   done;\
   first_link=$$(($$page_count + 1));\
 };\
+##
 rename_real_pages(){ for i in $$(ls -S | head -n$$page_count);\
   do for j in $$(ls -S | tail -n+$$first_link);\
     do grep -E -q $$i$$ $$j && break;\
@@ -42,10 +55,169 @@ rename_real_pages(){ for i in $$(ls -S | head -n$$page_count);\
     renamed_page[$$i]=$$j;\
   done;\
 };\
+##
 make_symlinks(){ for j in $$(ls -S | tail -n+$$first_link);\
   do ln -sf $${renamed_page[$$(cat $$j | cut -f2 -d/)]} $$j;\
   done;\
 };\
+##
+post_process(){ make_temp_files;\
+  ##
+  ## DIAGNOSTIC / DEVELOPMENT CODE
+  ## set -x and restrict processing to keep_me: un-comment to activate
+  ## Change keep_me as required
+  ##
+  ##keep_me=nfq_icmp_get_hdr.3;\
+  ##do_diagnostics;\
+  ##
+  ## Work through the "real" man pages
+  for target in $$(ls -S | head -n$$page_count);\
+  do mygrep "^\\.SH \"Function Documentation" $$target;\
+    ## Next file if this isn't a function page
+    [ $$linnum -ne 0 ] || continue;\
+    ##
+    del_modules;\
+    del_bogus_synopsis;\
+    fix_name_line;\
+    move_synopsis;\
+    del_empty_det_desc;\
+    del_def_at_lines;\
+    fix_double_blanks;\
+  done;\
+  ##
+  remove_temp_files;\
+};\
+##
+fix_double_blanks(){ linnum=1;\
+  ##
+  ## Older versions of man display a blank line on encountering "\fB\fP";
+  ## newer versions of man do not.
+  ## doxygen emits "\fB\fP" on seeing "\par" on a line by itself.
+  ## "\par" gives us double-spacing in the web doc, which we want, but double-
+  ## spacing looks odd in a man page so remove "\fB\fP".
+  ##
+  while [ $$linnum -ne 0 ];\
+  do mygrep \\\\fB\\\\fP $$target;\
+    [ $$linnum -eq 0 ] || delete_lines $$linnum $$linnum;\
+  done;\
+};\
+##
+del_def_at_lines(){ linnum=1;\
+  while [ $$linnum -ne 0 ];\
+  do mygrep "^Definition at line [[:digit:]]* of file" $$target;\
+    [ $$linnum -eq 0 ] || delete_lines $$(($$linnum - 1)) $$linnum;\
+  done;\
+};\
+##
+## Only invoked if you un-comment the 2 diagnostic / development lines above
+do_diagnostics(){ mv $$keep_me xxx;\
+  rm *.3;\
+  mv xxx $$keep_me;\
+  page_count=1;\
+  set -x;\
+};\
+##
+del_empty_det_desc(){ mygrep "^\\.SH \"Function Documentation" $$target;\
+  i=$$linnum;\
+  mygrep "^\\.SH \"Detailed Description" $$target;\
+  [ $$linnum -ne 0  ] || return 0;\
+  [ $$(($$i - $$linnum)) -eq 3 ] || return 0;\
+  delete_lines $$linnum $$(($$i -1));\
+};\
+##
+move_synopsis(){ mygrep "SH SYNOPSIS" $$target;\
+  [ $$linnum -ne 0  ] || return 0;\
+  i=$$linnum;\
+  ## If this is a doxygen-created synopsis, leave it.
+  ## (We haven't inserted our own one in the source yet)
+  mygrep "^\\.SS \"Functions" $$target;\
+  [ $$i -gt $$linnum ] || return 0;\
+  ##
+  mygrep "^\\.SH \"Function Documentation" $$target;\
+  j=$$(($$linnum - 1));\
+  head -n$$(($$j - 1)) $$target | tail -n$$(($$linnum - $$i - 1)) >$$fileC;\
+  delete_lines $$i $$j;\
+  mygrep "^\\.SS \"Functions" $$target;\
+  head -n$$(($$linnum - 1)) $$target >$$fileA;\
+  tail -n+$$(($$linnum + 1)) $$target >$$fileB;\
+  cat $$fileA $$fileC $$fileB >$$target;\
+};\
+##
+fix_name_line(){ all_funcs="";\
+  ##
+  ## Search a shortened version of the page in case there are .RI lines later
+  mygrep "^\\.SH \"Function Documentation" $$target;\
+  head -n$$linnum $$target >$$fileC;\
+  ##
+  while :;\
+  do mygrep ^\\.RI $$fileC;\
+    [ $$linnum -ne 0 ] || break;\
+    ## Discard this entry
+    tail -n+$$(($$linnum + 1)) $$fileC >$$fileB;\
+    cp $$fileB $$fileC;\
+    ##
+    func=$$(cat $$fileG | cut -f2 -d\\ | cut -c3-);\
+    [ -z "$$all_funcs" ] && all_funcs=$$func ||\
+      all_funcs="$$all_funcs, $$func";\
+  done;\
+  ## For now, assume name is at line 5
+  head -n4 $$target >$$fileA;\
+  desc=$$(head -n5 $$target | tail -n1 | cut -f3- -d" ");\
+  tail -n+6 $$target >$$fileB;\
+  cat $$fileA >$$target;\
+  echo "$$all_funcs \\- $$desc" >>$$target;\
+  cat $$fileB >>$$target;\
+};\
+##
+del_modules(){ mygrep "^\.SS \"Modules" $$target;\
+  [ $$linnum -ne 0  ] || return 0;\
+  i=$$linnum;\
+  mygrep "^\\.SS \"Functions" $$target;\
+  delete_lines $$i $$(($$linnum - 1));\
+};\
+##
+del_bogus_synopsis(){ mygrep "SH SYNOPSIS" $$target;\
+  ##
+  ## doxygen 1.8.20 inserts its own SYNOPSIS line but there is no mention
+  ## in the documentation or git log what to do with it.
+  ## So get rid of it
+  ##
+  [ $$linnum -ne 0  ] || return 0;\
+  i=$$linnum;\
+  ## Look for the next one
+  tail -n+$$(($$i + 1)) $$target >$$fileC;\
+  mygrep "SH SYNOPSIS" $$fileC;\
+  [ $$linnum -ne 0  ] || return 0;\
+  ##
+  mygrep "^\\.SS \"Functions" $$target;\
+  delete_lines $$i $$(($$linnum - 1));\
+};\
+##
+## Delete lines $1 through $2 from $target
+delete_lines(){ head -n$$(($$1 - 1)) $$target >$$fileA;\
+  tail -n+$$(($$2 +1)) $$target >$$fileB;\
+  cat $$fileA $$fileB >$$target;\
+};\
+##
+mygrep(){ set +e;\
+  grep -En "$$1" $$2 2>/dev/null >$$fileH;\
+  [ $$? -ne 0 ] && linnum=0 ||\
+    { head -n1 $$fileH >$$fileG; linnum=$$(cat $$fileG | cut -f1 -d:); };\
+  set -e;\
+};\
+##
+make_temp_files(){ temps="A B C G H";\
+  for i in $$temps;\
+  do declare -g file$$i=$$(mktemp);\
+  done;\
+};\
+##
+remove_temp_files(){ for i in $$temps;\
+  do j=file$$i;\
+    rm $${!j};\
+  done;\
+};\
+##
 main'
 
 	touch doxyfile.stamp
-- 
2.17.5


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH libnetfilter_queue v2] build: doc: Fix NAME entry in man pages
  2021-08-10  2:40 [PATCH libnetfilter_queue v2] build: doc: Fix NAME entry in man pages Duncan Roe
@ 2021-08-15 12:15 ` Pablo Neira Ayuso
  2021-08-16  4:22   ` Duncan Roe
  2021-08-24  1:43   ` Duncan Roe
  0 siblings, 2 replies; 9+ messages in thread
From: Pablo Neira Ayuso @ 2021-08-15 12:15 UTC (permalink / raw)
  To: Duncan Roe; +Cc: netfilter-devel

On Tue, Aug 10, 2021 at 12:40:01PM +1000, Duncan Roe wrote:
> Make the NAME line list the functions defined, like other man pages do.
> Also:
> - If there is a "Modules" section, delete it
> - If "Detailed Description" is empty, delete "Detailed Description" line
> - Reposition SYNOPSIS (with headers that we inserted) to start of page,
>   integrating with defined functions to look like other man pages
> - Delete all "Definition at line nnn" lines
> - Delete lines that make older versions of man o/p an unwanted blank line
> - Insert spacers and comments so Makefile.am is more readable
> 
> Signed-off-by: Duncan Roe <duncan_roe@optusnet.com.au>
> ---
> v2: Delete lines that make older versions of man o/p an unwanted blank line
>  doxygen/Makefile.am | 172 ++++++++++++++++++++++++++++++++++++++++++++

Time to add this to an independent fixup shell script for
doxygen-based manpages that Makefile.am could call instead?

This script could be imported by other libraries too, so it only needs to
be downloaded from somewhere to be refreshed to keep it in sync with
latest.

The git tree could cache a copy of this script.

Could you have a look into this?

Thanks.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH libnetfilter_queue v2] build: doc: Fix NAME entry in man pages
  2021-08-15 12:15 ` Pablo Neira Ayuso
@ 2021-08-16  4:22   ` Duncan Roe
  2021-08-24  1:43   ` Duncan Roe
  1 sibling, 0 replies; 9+ messages in thread
From: Duncan Roe @ 2021-08-16  4:22 UTC (permalink / raw)
  To: Pablo Neira Ayuso; +Cc: Netfilter Development

On Sun, Aug 15, 2021 at 02:15:09PM +0200, Pablo Neira Ayuso wrote:
> On Tue, Aug 10, 2021 at 12:40:01PM +1000, Duncan Roe wrote:
> > Make the NAME line list the functions defined, like other man pages do.
> > Also:
> > - If there is a "Modules" section, delete it
> > - If "Detailed Description" is empty, delete "Detailed Description" line
> > - Reposition SYNOPSIS (with headers that we inserted) to start of page,
> >   integrating with defined functions to look like other man pages
> > - Delete all "Definition at line nnn" lines
> > - Delete lines that make older versions of man o/p an unwanted blank line
> > - Insert spacers and comments so Makefile.am is more readable
> >
> > Signed-off-by: Duncan Roe <duncan_roe@optusnet.com.au>
> > ---
> > v2: Delete lines that make older versions of man o/p an unwanted blank line
> >  doxygen/Makefile.am | 172 ++++++++++++++++++++++++++++++++++++++++++++
>
> Time to add this to an independent fixup shell script for
> doxygen-based manpages that Makefile.am could call instead?
>
> This script could be imported by other libraries too, so it only needs to
> be downloaded from somewhere to be refreshed to keep it in sync with
> latest.
>
> The git tree could cache a copy of this script.
>
> Could you have a look into this?
>
> Thanks.

At the moment, libmnl and libnetfilter_queue share an identical
doxygen/Makefile.am.

So, you could declare libnetfilter_queue to be the master and copy from there.

The files' staying identical will depend at least on configure.ac in other libs
tracking libnfq. Currently configure.ac supplies HAVE_DOXYGEN but I am working
on a patch where there will also be BUILD_HTML and BUILD_MAN.

I had to move fixmanpages.sh inside Makefile.am to get `make distcheck` to
pass. So I'll need to be careful about introducing new files (e.g. to include).

Will keep investigating,

Cheers ... Duncan.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH libnetfilter_queue v2] build: doc: Fix NAME entry in man pages
  2021-08-15 12:15 ` Pablo Neira Ayuso
  2021-08-16  4:22   ` Duncan Roe
@ 2021-08-24  1:43   ` Duncan Roe
  2021-08-27 20:01     ` Duncan Roe
  1 sibling, 1 reply; 9+ messages in thread
From: Duncan Roe @ 2021-08-24  1:43 UTC (permalink / raw)
  To: Pablo Neira Ayuso; +Cc: Netfilter Development

On Sun, Aug 15, 2021 at 02:15:09PM +0200, Pablo Neira Ayuso wrote:
> On Tue, Aug 10, 2021 at 12:40:01PM +1000, Duncan Roe wrote:
> > Make the NAME line list the functions defined, like other man pages do.
> > Also:
> > - If there is a "Modules" section, delete it
> > - If "Detailed Description" is empty, delete "Detailed Description" line
> > - Reposition SYNOPSIS (with headers that we inserted) to start of page,
> >   integrating with defined functions to look like other man pages
> > - Delete all "Definition at line nnn" lines
> > - Delete lines that make older versions of man o/p an unwanted blank line
> > - Insert spacers and comments so Makefile.am is more readable
> >
> > Signed-off-by: Duncan Roe <duncan_roe@optusnet.com.au>
> > ---
> > v2: Delete lines that make older versions of man o/p an unwanted blank line
> >  doxygen/Makefile.am | 172 ++++++++++++++++++++++++++++++++++++++++++++
>
> Time to add this to an independent fixup shell script for
> doxygen-based manpages that Makefile.am could call instead?

There is an independent fixup shell script at v4
>
> This script could be imported by other libraries too, so it only needs to
> be downloaded from somewhere to be refreshed to keep it in sync with
> latest.

Please do not wait for this to happen. As I gain familiarity with autotools,
there will be more and more incremental updates.

So you can review them easily, I'll try to keep each patch doing just one thing.
But that means more patches, so can you just apply one of the patch series so we
don't get too far behind?
>
> The git tree could cache a copy of this script.

Here's a possible mechanism, but it needs there to be a new netfilter git
project: how would you be with that?

 - autogen.sh does `git clone libnetfilter_doc`
 - autogen.sh distributes the files(*) in libnetfilter_doc to wherever they go
   in the current source tree
 - autogen.sh deletes libnetfilter_doc/

This approach has the advantage that `make distcheck` tarballs are complete,
i.e. don't require a working network to build.

For best results, update doxygen comments in the source to contain SYNOPSIS
sections.

(*) as well as build_man.sh, most of configure.ac is boilerplate and could be
encapsulated in 1 or more m4 macros to reside in libnetfilter_doc. Also most of
doxygen.cfg.in could go there, with local variations in doxygen.cfg.local (at
least EXCLUDE_SYMBOLS, maybe nothing else).

Cheers ... Duncan.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH libnetfilter_queue v2] build: doc: Fix NAME entry in man pages
  2021-08-24  1:43   ` Duncan Roe
@ 2021-08-27 20:01     ` Duncan Roe
  2021-08-28  9:23       ` Pablo Neira Ayuso
  0 siblings, 1 reply; 9+ messages in thread
From: Duncan Roe @ 2021-08-27 20:01 UTC (permalink / raw)
  To: Pablo Neira Ayuso; +Cc: Netfilter Development

On Tue, Aug 24, 2021 at 11:43:42AM +1000, Duncan Roe wrote:
> On Sun, Aug 15, 2021 at 02:15:09PM +0200, Pablo Neira Ayuso wrote:
> > On Tue, Aug 10, 2021 at 12:40:01PM +1000, Duncan Roe wrote:
> > > Make the NAME line list the functions defined, like other man pages do.
> > > Also:
> > > - If there is a "Modules" section, delete it
> > > - If "Detailed Description" is empty, delete "Detailed Description" line
> > > - Reposition SYNOPSIS (with headers that we inserted) to start of page,
> > >   integrating with defined functions to look like other man pages
> > > - Delete all "Definition at line nnn" lines
> > > - Delete lines that make older versions of man o/p an unwanted blank line
> > > - Insert spacers and comments so Makefile.am is more readable
> > >
> > > Signed-off-by: Duncan Roe <duncan_roe@optusnet.com.au>
> > > ---
> > > v2: Delete lines that make older versions of man o/p an unwanted blank line
> > >  doxygen/Makefile.am | 172 ++++++++++++++++++++++++++++++++++++++++++++
> >
> > Time to add this to an independent fixup shell script for
> > doxygen-based manpages that Makefile.am could call instead?
>
> There is an independent fixup shell script at v4
> >
> > This script could be imported by other libraries too, so it only needs to
> > be downloaded from somewhere to be refreshed to keep it in sync with
> > latest.
>
> Please do not wait for this to happen. As I gain familiarity with autotools,
> there will be more and more incremental updates.
>
> So you can review them easily, I'll try to keep each patch doing just one thing.
> But that means more patches, so can you just apply one of the patch series so we
> don't get too far behind?
> >
> > The git tree could cache a copy of this script.
>
> Here's a possible mechanism, but it needs there to be a new netfilter git
> project: how would you be with that?
>
>  - autogen.sh does `git clone libnetfilter_doc`
>  - autogen.sh distributes the files(*) in libnetfilter_doc to wherever they go
>    in the current source tree
>  - autogen.sh deletes libnetfilter_doc/
>
> This approach has the advantage that `make distcheck` tarballs are complete,
> i.e. don't require a working network to build.
>
> For best results, update doxygen comments in the source to contain SYNOPSIS
> sections.
>
> (*) as well as build_man.sh, most of configure.ac is boilerplate and could be
> encapsulated in 1 or more m4 macros to reside in libnetfilter_doc. Also most of
> doxygen.cfg.in could go there, with local variations in doxygen.cfg.local (at
> least EXCLUDE_SYMBOLS, maybe nothing else).


No need for a new git project. curl can fetch files from libnfq. E.g.
> curl https://git.netfilter.org/libnetfilter_queue/plain/doxygen/Makefile.am
fetches Makefile.am.

Same for doxygen/build_man.sh, once the patches are applied. autogen.sh would
run the curl commands.

Cheers ... Duncan.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH libnetfilter_queue v2] build: doc: Fix NAME entry in man pages
  2021-08-27 20:01     ` Duncan Roe
@ 2021-08-28  9:23       ` Pablo Neira Ayuso
  2021-08-28  9:43         ` Pablo Neira Ayuso
  2021-09-01  3:50         ` Duncan Roe
  0 siblings, 2 replies; 9+ messages in thread
From: Pablo Neira Ayuso @ 2021-08-28  9:23 UTC (permalink / raw)
  To: Netfilter Development

On Sat, Aug 28, 2021 at 06:01:44AM +1000, Duncan Roe wrote:
> On Tue, Aug 24, 2021 at 11:43:42AM +1000, Duncan Roe wrote:
> > On Sun, Aug 15, 2021 at 02:15:09PM +0200, Pablo Neira Ayuso wrote:
> > > On Tue, Aug 10, 2021 at 12:40:01PM +1000, Duncan Roe wrote:
> > > > Make the NAME line list the functions defined, like other man pages do.
> > > > Also:
> > > > - If there is a "Modules" section, delete it
> > > > - If "Detailed Description" is empty, delete "Detailed Description" line
> > > > - Reposition SYNOPSIS (with headers that we inserted) to start of page,
> > > >   integrating with defined functions to look like other man pages
> > > > - Delete all "Definition at line nnn" lines
> > > > - Delete lines that make older versions of man o/p an unwanted blank line
> > > > - Insert spacers and comments so Makefile.am is more readable
> > > >
> > > > Signed-off-by: Duncan Roe <duncan_roe@optusnet.com.au>
> > > > ---
> > > > v2: Delete lines that make older versions of man o/p an unwanted blank line
> > > >  doxygen/Makefile.am | 172 ++++++++++++++++++++++++++++++++++++++++++++
> > >
> > > Time to add this to an independent fixup shell script for
> > > doxygen-based manpages that Makefile.am could call instead?
> >
> > There is an independent fixup shell script at v4
> > >
> > > This script could be imported by other libraries too, so it only needs to
> > > be downloaded from somewhere to be refreshed to keep it in sync with
> > > latest.
> >
> > Please do not wait for this to happen. As I gain familiarity with autotools,
> > there will be more and more incremental updates.
> >
> > So you can review them easily, I'll try to keep each patch doing just one thing.
> > But that means more patches, so can you just apply one of the patch series so we
> > don't get too far behind?
> > >
> > > The git tree could cache a copy of this script.
> >
> > Here's a possible mechanism, but it needs there to be a new netfilter git
> > project: how would you be with that?
> >
> >  - autogen.sh does `git clone libnetfilter_doc`
> >  - autogen.sh distributes the files(*) in libnetfilter_doc to wherever they go
> >    in the current source tree
> >  - autogen.sh deletes libnetfilter_doc/
> >
> > This approach has the advantage that `make distcheck` tarballs are complete,
> > i.e. don't require a working network to build.
> >
> > For best results, update doxygen comments in the source to contain SYNOPSIS
> > sections.
> >
> > (*) as well as build_man.sh, most of configure.ac is boilerplate and could be
> > encapsulated in 1 or more m4 macros to reside in libnetfilter_doc. Also most of
> > doxygen.cfg.in could go there, with local variations in doxygen.cfg.local (at
> > least EXCLUDE_SYMBOLS, maybe nothing else).
> 
> 
> No need for a new git project. curl can fetch files from libnfq. E.g.
> > curl https://git.netfilter.org/libnetfilter_queue/plain/doxygen/Makefile.am
> fetches Makefile.am.
> 
> Same for doxygen/build_man.sh, once the patches are applied. autogen.sh would
> run the curl commands.

autogen.sh to resync this script should be fine.

Did you consider to send some feedback to doxygen developers? Probably
enhancing \manonly including sections (ie. \manonly{synopsis}) would
be the way to go? I guess that would be more work upstream, but
everyone would benefit from this.

Anyway, your build_man.sh script is starting to look nicer, thanks.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH libnetfilter_queue v2] build: doc: Fix NAME entry in man pages
  2021-08-28  9:23       ` Pablo Neira Ayuso
@ 2021-08-28  9:43         ` Pablo Neira Ayuso
  2021-09-01  3:23           ` Duncan Roe
  2021-09-01  3:50         ` Duncan Roe
  1 sibling, 1 reply; 9+ messages in thread
From: Pablo Neira Ayuso @ 2021-08-28  9:43 UTC (permalink / raw)
  To: Netfilter Development

On Sat, Aug 28, 2021 at 11:23:03AM +0200, Pablo Neira Ayuso wrote:
> On Sat, Aug 28, 2021 at 06:01:44AM +1000, Duncan Roe wrote:
> > On Tue, Aug 24, 2021 at 11:43:42AM +1000, Duncan Roe wrote:
> > > On Sun, Aug 15, 2021 at 02:15:09PM +0200, Pablo Neira Ayuso wrote:
> > > > On Tue, Aug 10, 2021 at 12:40:01PM +1000, Duncan Roe wrote:
> > > > > Make the NAME line list the functions defined, like other man pages do.
> > > > > Also:
> > > > > - If there is a "Modules" section, delete it
> > > > > - If "Detailed Description" is empty, delete "Detailed Description" line
> > > > > - Reposition SYNOPSIS (with headers that we inserted) to start of page,
> > > > >   integrating with defined functions to look like other man pages
> > > > > - Delete all "Definition at line nnn" lines
> > > > > - Delete lines that make older versions of man o/p an unwanted blank line
> > > > > - Insert spacers and comments so Makefile.am is more readable
> > > > >
> > > > > Signed-off-by: Duncan Roe <duncan_roe@optusnet.com.au>
> > > > > ---
> > > > > v2: Delete lines that make older versions of man o/p an unwanted blank line
> > > > >  doxygen/Makefile.am | 172 ++++++++++++++++++++++++++++++++++++++++++++
> > > >
> > > > Time to add this to an independent fixup shell script for
> > > > doxygen-based manpages that Makefile.am could call instead?
> > >
> > > There is an independent fixup shell script at v4
> > > >
> > > > This script could be imported by other libraries too, so it only needs to
> > > > be downloaded from somewhere to be refreshed to keep it in sync with
> > > > latest.
> > >
> > > Please do not wait for this to happen. As I gain familiarity with autotools,
> > > there will be more and more incremental updates.
> > >
> > > So you can review them easily, I'll try to keep each patch doing just one thing.
> > > But that means more patches, so can you just apply one of the patch series so we
> > > don't get too far behind?
> > > >
> > > > The git tree could cache a copy of this script.
> > >
> > > Here's a possible mechanism, but it needs there to be a new netfilter git
> > > project: how would you be with that?
> > >
> > >  - autogen.sh does `git clone libnetfilter_doc`
> > >  - autogen.sh distributes the files(*) in libnetfilter_doc to wherever they go
> > >    in the current source tree
> > >  - autogen.sh deletes libnetfilter_doc/
> > >
> > > This approach has the advantage that `make distcheck` tarballs are complete,
> > > i.e. don't require a working network to build.
> > >
> > > For best results, update doxygen comments in the source to contain SYNOPSIS
> > > sections.
> > >
> > > (*) as well as build_man.sh, most of configure.ac is boilerplate and could be
> > > encapsulated in 1 or more m4 macros to reside in libnetfilter_doc. Also most of
> > > doxygen.cfg.in could go there, with local variations in doxygen.cfg.local (at
> > > least EXCLUDE_SYMBOLS, maybe nothing else).
> > 
> > 
> > No need for a new git project. curl can fetch files from libnfq. E.g.
> > > curl https://git.netfilter.org/libnetfilter_queue/plain/doxygen/Makefile.am
> > fetches Makefile.am.
> > 
> > Same for doxygen/build_man.sh, once the patches are applied. autogen.sh would
> > run the curl commands.
> 
> autogen.sh to resync this script should be fine.
> 
> Did you consider to send some feedback to doxygen developers? Probably
> enhancing \manonly including sections (ie. \manonly{synopsis}) would
> be the way to go? I guess that would be more work upstream, but
> everyone would benefit from this.
> 
> Anyway, your build_man.sh script is starting to look nicer, thanks.

I mean: the output of the man pages is looking better than the ones
that doxygen is autogenerating, is it that doxygen manpage support is
"basic" as it look without your script?

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH libnetfilter_queue v2] build: doc: Fix NAME entry in man pages
  2021-08-28  9:43         ` Pablo Neira Ayuso
@ 2021-09-01  3:23           ` Duncan Roe
  0 siblings, 0 replies; 9+ messages in thread
From: Duncan Roe @ 2021-09-01  3:23 UTC (permalink / raw)
  To: Pablo Neira Ayuso; +Cc: Netfilter Development

On Sat, Aug 28, 2021 at 11:43:05AM +0200, Pablo Neira Ayuso wrote:
>
> I mean: the output of the man pages is looking better than the ones
> that doxygen is autogenerating, is it that doxygen manpage support is
> "basic" as it look without your script?

Essentially ... yes.  Unix man pages are at the end of the list of generated
output formats. HTML and Latex are the headline formats.

Cheers ... Duncan.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH libnetfilter_queue v2] build: doc: Fix NAME entry in man pages
  2021-08-28  9:23       ` Pablo Neira Ayuso
  2021-08-28  9:43         ` Pablo Neira Ayuso
@ 2021-09-01  3:50         ` Duncan Roe
  1 sibling, 0 replies; 9+ messages in thread
From: Duncan Roe @ 2021-09-01  3:50 UTC (permalink / raw)
  To: Pablo Neira Ayuso; +Cc: Netfilter Development

On Sat, Aug 28, 2021 at 11:23:03AM +0200, Pablo Neira Ayuso wrote: [...]
>
> Did you consider to send some feedback to doxygen developers? Probably
> enhancing \manonly including sections (ie. \manonly{synopsis}) would
> be the way to go? I guess that would be more work upstream, but
> everyone would benefit from this.

\manonly is defined as
> Starts a block of text that only will be verbatim included in the generated
> MAN documentation
and as such looks kind-of frozen.

I have found that putting the right headers in the synopsis is very much a
manual task. I write a nonsense application that calls all the functions in a
man page and see what headers it takes for a clean compile. I see no way to
automate this process.

My contact with developers in the past has been bug reports with (rejected)
patches (the rejects are not surprising - they know their sysem way better than
I do). But the bugs have been fixed.

I have posted a couple of comments to Chris Miceli's blog titled "Integrating
Doxygen with Autotools". The posts talk about fixmanpages.sh and how it was
integrated into Makefile.am so are a bit old already.

Looking at the main website https://www.doxygen.nl/index.html, there is a
doxygen-projects mailing list that might be appropriate. I think one post
regarding Autotools integration and another post regarding man page enhancement
would be appropriate. How does that sound?

Cheers ... Duncan.

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2021-09-01  3:50 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-10  2:40 [PATCH libnetfilter_queue v2] build: doc: Fix NAME entry in man pages Duncan Roe
2021-08-15 12:15 ` Pablo Neira Ayuso
2021-08-16  4:22   ` Duncan Roe
2021-08-24  1:43   ` Duncan Roe
2021-08-27 20:01     ` Duncan Roe
2021-08-28  9:23       ` Pablo Neira Ayuso
2021-08-28  9:43         ` Pablo Neira Ayuso
2021-09-01  3:23           ` Duncan Roe
2021-09-01  3:50         ` Duncan Roe

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.