All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH libnetfilter_queue] build: doc: "make" builds & installs a full set of man pages
@ 2020-02-08  1:28 Duncan Roe
  2020-02-23 22:27 ` Pablo Neira Ayuso
  0 siblings, 1 reply; 6+ messages in thread
From: Duncan Roe @ 2020-02-08  1:28 UTC (permalink / raw)
  To: pablo; +Cc: netfilter-devel

This enables one to enter "man <any nfq function>" and get the appropriate
group man page created by doxygen.

 - New makefile in doxygen directory. Rebuilds documentation if any sources
   change that contain doxygen comments, or if fixmanpages.sh changes
 - New shell script fixmanpages.sh which
   - Renames each group man page to the first function listed therein
   - Creates symlinks for subsequently listed functions (if any)
   - Deletes _* temp files
 - Update top-level makefile to visit new subdir doxygen
 - Update top-level configure to only build documentation if doxygen installed

Signed-off-by: Duncan Roe <duncan_roe@optusnet.com.au>
---
 Makefile.am         |  2 +-
 configure.ac        | 10 +++++++++
 doxygen/Makefile.am | 23 ++++++++++++++++++++
 fixmanpages.sh      | 62 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 96 insertions(+), 1 deletion(-)
 create mode 100644 doxygen/Makefile.am
 create mode 100755 fixmanpages.sh

diff --git a/Makefile.am b/Makefile.am
index 6b4ef77..a5b347b 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -2,7 +2,7 @@ ACLOCAL_AMFLAGS = -I m4
 
 EXTRA_DIST = $(man_MANS) include/linux
 
-SUBDIRS = src utils include examples
+SUBDIRS = src utils include examples doxygen
 
 man_MANS = #nfnetlink_queue.3 nfnetlink_queue.7
 
diff --git a/configure.ac b/configure.ac
index 0c08459..e99b07a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -33,5 +33,15 @@ dnl Output the makefiles
 AC_CONFIG_FILES([Makefile src/Makefile utils/Makefile examples/Makefile
         libnetfilter_queue.pc doxygen.cfg
 	include/Makefile include/libnetfilter_queue/Makefile
+	doxygen/Makefile
 	include/linux/Makefile include/linux/netfilter/Makefile])
 AC_OUTPUT
+
+dnl Only run doxygen Makefile if doxygen installed
+
+AC_CHECK_PROGS([DOXYGEN], [doxygen])
+if test -z "$DOXYGEN";
+	then AC_MSG_WARN([Doxygen not found - continuing without Doxygen support])
+fi
+
+ AM_CONDITIONAL([HAVE_DOXYGEN], [test -n "$DOXYGEN"])
diff --git a/doxygen/Makefile.am b/doxygen/Makefile.am
new file mode 100644
index 0000000..ef468e0
--- /dev/null
+++ b/doxygen/Makefile.am
@@ -0,0 +1,23 @@
+if HAVE_DOXYGEN
+doc_srcs = $(top_srcdir)/src/libnetfilter_queue.c  \
+           $(top_srcdir)/src/nlmsg.c               \
+           $(top_srcdir)/src/extra/checksum.c      \
+           $(top_srcdir)/src/extra/ipv6.c          \
+           $(top_srcdir)/src/extra/ipv4.c          \
+           $(top_srcdir)/src/extra/tcp.c           \
+           $(top_srcdir)/src/extra/udp.c           \
+           $(top_srcdir)/src/extra/pktbuff.c
+
+doxyfile.stamp: $(doc_srcs) $(top_srcdir)/fixmanpages.sh
+	rm -rf html man && cd .. && doxygen doxygen.cfg && ./fixmanpages.sh
+	touch doxyfile.stamp
+
+CLEANFILES = doxyfile.stamp
+
+all-local: doxyfile.stamp
+clean-local:
+	rm -rf $(top_srcdir)/doxygen/man $(top_srcdir)/doxygen/html
+install-data-local:
+	mkdir -p $(DESTDIR)$(mandir)/man3
+	cp --no-dereference --preserve=links,mode,timestamps man/man3/*.3 $(DESTDIR)$(mandir)/man3/
+endif
diff --git a/fixmanpages.sh b/fixmanpages.sh
new file mode 100755
index 0000000..897086b
--- /dev/null
+++ b/fixmanpages.sh
@@ -0,0 +1,62 @@
+#!/bin/bash -p
+#set -x
+function main
+{
+  set -e
+  cd doxygen/man/man3
+  rm -f _*
+  setgroup LibrarySetup nfq_open
+    add2group nfq_close nfq_bind_pf nfq_unbind_pf
+  setgroup Parsing nfq_get_msg_packet_hdr
+    add2group nfq_get_nfmark nfq_get_timestamp nfq_get_indev nfq_get_physindev
+    add2group nfq_get_outdev nfq_get_physoutdev nfq_get_indev_name
+    add2group nfq_get_physindev_name nfq_get_outdev_name
+    add2group nfq_get_physoutdev_name nfq_get_packet_hw nfq_get_uid
+    add2group nfq_get_gid nfq_get_secctx nfq_get_payload
+  setgroup Queue nfq_fd
+    add2group nfq_create_queue nfq_destroy_queue nfq_handle_packet nfq_set_mode
+    add2group nfq_set_queue_flags nfq_set_queue_maxlen nfq_set_verdict
+    add2group nfq_set_verdict2 nfq_set_verdict_batch
+    add2group nfq_set_verdict_batch2 nfq_set_verdict_mark
+  setgroup ipv4 nfq_ip_get_hdr
+    add2group nfq_ip_set_transport_header nfq_ip_mangle nfq_ip_snprintf
+    setgroup ip_internals nfq_ip_set_checksum
+  setgroup ipv6 nfq_ip6_get_hdr
+    add2group nfq_ip6_set_transport_header nfq_ip6_mangle nfq_ip6_snprintf
+  setgroup nfq_cfg nfq_nlmsg_cfg_put_cmd
+    add2group nfq_nlmsg_cfg_put_params nfq_nlmsg_cfg_put_qmaxlen
+  setgroup nfq_verd nfq_nlmsg_verdict_put
+    add2group nfq_nlmsg_verdict_put_mark nfq_nlmsg_verdict_put_pkt
+  setgroup nlmsg nfq_nlmsg_parse
+  setgroup pktbuff pktb_alloc
+    add2group pktb_data pktb_len pktb_mangle pktb_mangled
+    add2group pktb_free
+    setgroup otherfns pktb_tailroom
+      add2group pktb_mac_header pktb_network_header pktb_transport_header
+      setgroup uselessfns pktb_push
+        add2group pktb_pull pktb_put pktb_trim
+  setgroup tcp nfq_tcp_get_hdr
+    add2group nfq_tcp_get_payload nfq_tcp_get_payload_len
+    add2group nfq_tcp_snprintf nfq_tcp_mangle_ipv4 nfq_tcp_mangle_ipv6
+    setgroup tcp_internals nfq_tcp_compute_checksum_ipv4
+      add2group nfq_tcp_compute_checksum_ipv6
+  setgroup udp nfq_udp_get_hdr
+    add2group nfq_udp_get_payload nfq_udp_get_payload_len
+    add2group nfq_udp_mangle_ipv4 nfq_udp_mangle_ipv6 nfq_udp_snprintf
+    setgroup udp_internals nfq_udp_compute_checksum_ipv4
+      add2group nfq_udp_compute_checksum_ipv6
+  setgroup Printing nfq_snprintf_xml
+}
+function setgroup
+{
+  mv $1.3 $2.3
+  BASE=$2
+}
+function   add2group
+{
+  for i in $@
+  do
+    ln -sf $BASE.3 $i.3
+  done
+}
+main
-- 
2.14.5


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

* Re: [PATCH libnetfilter_queue] build: doc: "make" builds & installs a full set of man pages
  2020-02-08  1:28 [PATCH libnetfilter_queue] build: doc: "make" builds & installs a full set of man pages Duncan Roe
@ 2020-02-23 22:27 ` Pablo Neira Ayuso
  2020-02-23 22:35   ` Florian Westphal
  0 siblings, 1 reply; 6+ messages in thread
From: Pablo Neira Ayuso @ 2020-02-23 22:27 UTC (permalink / raw)
  To: Duncan Roe; +Cc: netfilter-devel

On Sat, Feb 08, 2020 at 12:28:44PM +1100, Duncan Roe wrote:
> This enables one to enter "man <any nfq function>" and get the appropriate
> group man page created by doxygen.
> 
>  - New makefile in doxygen directory. Rebuilds documentation if any sources
>    change that contain doxygen comments, or if fixmanpages.sh changes
>  - New shell script fixmanpages.sh which
>    - Renames each group man page to the first function listed therein
>    - Creates symlinks for subsequently listed functions (if any)
>    - Deletes _* temp files
>  - Update top-level makefile to visit new subdir doxygen
>  - Update top-level configure to only build documentation if doxygen installed

I'd prefer people to keep this infrastructure out of tree. Thanks.

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

* Re: [PATCH libnetfilter_queue] build: doc: "make" builds & installs a full set of man pages
  2020-02-23 22:27 ` Pablo Neira Ayuso
@ 2020-02-23 22:35   ` Florian Westphal
  2020-02-23 22:37     ` Pablo Neira Ayuso
  0 siblings, 1 reply; 6+ messages in thread
From: Florian Westphal @ 2020-02-23 22:35 UTC (permalink / raw)
  To: Pablo Neira Ayuso; +Cc: Duncan Roe, netfilter-devel

Pablo Neira Ayuso <pablo@netfilter.org> wrote:
> On Sat, Feb 08, 2020 at 12:28:44PM +1100, Duncan Roe wrote:
> > This enables one to enter "man <any nfq function>" and get the appropriate
> > group man page created by doxygen.
> > 
> >  - New makefile in doxygen directory. Rebuilds documentation if any sources
> >    change that contain doxygen comments, or if fixmanpages.sh changes
> >  - New shell script fixmanpages.sh which
> >    - Renames each group man page to the first function listed therein
> >    - Creates symlinks for subsequently listed functions (if any)
> >    - Deletes _* temp files
> >  - Update top-level makefile to visit new subdir doxygen
> >  - Update top-level configure to only build documentation if doxygen installed
> 
> I'd prefer people to keep this infrastructure out of tree. Thanks.

Hmm, why?

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

* Re: [PATCH libnetfilter_queue] build: doc: "make" builds & installs a full set of man pages
  2020-02-23 22:35   ` Florian Westphal
@ 2020-02-23 22:37     ` Pablo Neira Ayuso
  2020-02-23 22:54       ` Florian Westphal
  0 siblings, 1 reply; 6+ messages in thread
From: Pablo Neira Ayuso @ 2020-02-23 22:37 UTC (permalink / raw)
  To: Florian Westphal; +Cc: Duncan Roe, netfilter-devel

On Sun, Feb 23, 2020 at 11:35:14PM +0100, Florian Westphal wrote:
> Pablo Neira Ayuso <pablo@netfilter.org> wrote:
> > On Sat, Feb 08, 2020 at 12:28:44PM +1100, Duncan Roe wrote:
> > > This enables one to enter "man <any nfq function>" and get the appropriate
> > > group man page created by doxygen.
> > > 
> > >  - New makefile in doxygen directory. Rebuilds documentation if any sources
> > >    change that contain doxygen comments, or if fixmanpages.sh changes
> > >  - New shell script fixmanpages.sh which
> > >    - Renames each group man page to the first function listed therein
> > >    - Creates symlinks for subsequently listed functions (if any)
> > >    - Deletes _* temp files
> > >  - Update top-level makefile to visit new subdir doxygen
> > >  - Update top-level configure to only build documentation if doxygen installed
> > 
> > I'd prefer people to keep this infrastructure out of tree. Thanks.
> 
> Hmm, why?

Would you like to allow to generate manpage per function in the
library? We never had this so far.

Probably a single manpage in the style of libnftables(3)?

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

* Re: [PATCH libnetfilter_queue] build: doc: "make" builds & installs a full set of man pages
  2020-02-23 22:37     ` Pablo Neira Ayuso
@ 2020-02-23 22:54       ` Florian Westphal
  2020-02-23 23:15         ` Pablo Neira Ayuso
  0 siblings, 1 reply; 6+ messages in thread
From: Florian Westphal @ 2020-02-23 22:54 UTC (permalink / raw)
  To: Pablo Neira Ayuso, g; +Cc: Florian Westphal, Duncan Roe, netfilter-devel

Pablo Neira Ayuso <pablo@netfilter.org> wrote:
> On Sun, Feb 23, 2020 at 11:35:14PM +0100, Florian Westphal wrote:
> > Pablo Neira Ayuso <pablo@netfilter.org> wrote:
> > > On Sat, Feb 08, 2020 at 12:28:44PM +1100, Duncan Roe wrote:
> > > > This enables one to enter "man <any nfq function>" and get the appropriate
> > > > group man page created by doxygen.
> > > > 
> > > >  - New makefile in doxygen directory. Rebuilds documentation if any sources
> > > >    change that contain doxygen comments, or if fixmanpages.sh changes
> > > >  - New shell script fixmanpages.sh which
> > > >    - Renames each group man page to the first function listed therein
> > > >    - Creates symlinks for subsequently listed functions (if any)
> > > >    - Deletes _* temp files
> > > >  - Update top-level makefile to visit new subdir doxygen
> > > >  - Update top-level configure to only build documentation if doxygen installed
> > > 
> > > I'd prefer people to keep this infrastructure out of tree. Thanks.
> > 
> > Hmm, why?
> 
> Would you like to allow to generate manpage per function in the
> library? We never had this so far.
> 
> Probably a single manpage in the style of libnftables(3)?

I like it.  I mean, its up to distros to package this, I guess
most of them will place this into some extra doc sub-package.

$ man 3 ssl-<tab>
zsh: do you wish to see all 416 possibilities (70 lines)?

... so there are libraries that do this.
Also, from what I understand, there is not a single man-page per
function, the extra ones are just aliases.

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

* Re: [PATCH libnetfilter_queue] build: doc: "make" builds & installs a full set of man pages
  2020-02-23 22:54       ` Florian Westphal
@ 2020-02-23 23:15         ` Pablo Neira Ayuso
  0 siblings, 0 replies; 6+ messages in thread
From: Pablo Neira Ayuso @ 2020-02-23 23:15 UTC (permalink / raw)
  To: Florian Westphal; +Cc: Duncan Roe, netfilter-devel

Hi Florian,

On Sun, Feb 23, 2020 at 11:54:19PM +0100, Florian Westphal wrote:
> Pablo Neira Ayuso <pablo@netfilter.org> wrote:
> > On Sun, Feb 23, 2020 at 11:35:14PM +0100, Florian Westphal wrote:
> > > Pablo Neira Ayuso <pablo@netfilter.org> wrote:
> > > > On Sat, Feb 08, 2020 at 12:28:44PM +1100, Duncan Roe wrote:
> > > > > This enables one to enter "man <any nfq function>" and get the appropriate
> > > > > group man page created by doxygen.
> > > > > 
> > > > >  - New makefile in doxygen directory. Rebuilds documentation if any sources
> > > > >    change that contain doxygen comments, or if fixmanpages.sh changes
> > > > >  - New shell script fixmanpages.sh which
> > > > >    - Renames each group man page to the first function listed therein
> > > > >    - Creates symlinks for subsequently listed functions (if any)
> > > > >    - Deletes _* temp files
> > > > >  - Update top-level makefile to visit new subdir doxygen
> > > > >  - Update top-level configure to only build documentation if doxygen installed
> > > > 
> > > > I'd prefer people to keep this infrastructure out of tree. Thanks.
> > > 
> > > Hmm, why?
> > 
> > Would you like to allow to generate manpage per function in the
> > library? We never had this so far.
> > 
> > Probably a single manpage in the style of libnftables(3)?
> 
> I like it.  I mean, its up to distros to package this, I guess
> most of them will place this into some extra doc sub-package.
> 
> $ man 3 ssl-<tab>
> zsh: do you wish to see all 416 possibilities (70 lines)?
> 
> ... so there are libraries that do this.
> Also, from what I understand, there is not a single man-page per
> function, the extra ones are just aliases.

I was not familiar with this fine-grain manpage approach, thanks for
explaining.

Please, go ahead and apply this patch.

Thanks.

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

end of thread, other threads:[~2020-02-23 23:15 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-08  1:28 [PATCH libnetfilter_queue] build: doc: "make" builds & installs a full set of man pages Duncan Roe
2020-02-23 22:27 ` Pablo Neira Ayuso
2020-02-23 22:35   ` Florian Westphal
2020-02-23 22:37     ` Pablo Neira Ayuso
2020-02-23 22:54       ` Florian Westphal
2020-02-23 23:15         ` Pablo Neira Ayuso

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.