From 1970906319eefa0bf48553e60ee67b5a75b9e1c5 Mon Sep 17 00:00:00 2001 From: Jens Georg Date: Wed, 16 Nov 2022 22:28:17 +0100 Subject: doc,build: Add manpage for sniffer --- doc/gssdp-device-sniffer.md | 30 ++++++++++++++++++ doc/gssdp.toml.in | 4 +++ doc/meson.build | 76 +++++++++++++++++++++++++++++---------------- doc/metadata.yml | 5 +++ meson.build | 4 +-- meson_options.txt | 1 + 6 files changed, 90 insertions(+), 30 deletions(-) create mode 100644 doc/gssdp-device-sniffer.md create mode 100644 doc/metadata.yml diff --git a/doc/gssdp-device-sniffer.md b/doc/gssdp-device-sniffer.md new file mode 100644 index 0000000..1c6dcc8 --- /dev/null +++ b/doc/gssdp-device-sniffer.md @@ -0,0 +1,30 @@ +--- +Title: Manpage for gssdp-device-sniffer +--- + +# NAME + +gssdp-device-sniffer - display SSDP packets on your network + +# SYNOPSIS + +**gssdp-device-sniffer** [**-i**] [**-6**] + +# DESCRIPTION + +gssdp-device-sniffer is a tool that will listen for SSDP announcements that happen +on your network. + +In addition to recording the SSDP packets and providing raw display, it will also +keep track of the devices it has seen. + +# OPTIONS + +**-h**, **--help** +: Display help + +**-i**, **--interface** +: Name of the network interface the sniffer will listen on + +**-6**, **--prefer-v6** +: Listen on IPv6 for SSDP announcements diff --git a/doc/gssdp.toml.in b/doc/gssdp.toml.in index d46edea..9b6076c 100644 --- a/doc/gssdp.toml.in +++ b/doc/gssdp.toml.in @@ -39,4 +39,8 @@ content_images = [ "images/gupnp-logo-short.svg" ] +content_files = [ + "gssdp-device-sniffer.md" +] + urlmap_file = "urlmap.js" diff --git a/doc/meson.build b/doc/meson.build index c091cd4..f8640ab 100644 --- a/doc/meson.build +++ b/doc/meson.build @@ -1,34 +1,56 @@ -entities = configuration_data() -entities.set('VERSION', meson.project_version()) +if get_option('gtk_doc') + entities = configuration_data() + entities.set('VERSION', meson.project_version()) -gidocgen = find_program('gi-docgen', required: true) + gidocgen = find_program('gi-docgen', required: true) -gssdp_toml = configure_file ( - input: 'gssdp.toml.in', - output: 'gssdp.toml', - configuration: entities -) + gssdp_toml = configure_file ( + input: 'gssdp.toml.in', + output: 'gssdp.toml', + configuration: entities + ) -docs_dir = join_paths(get_option('prefix'), get_option('datadir'), 'doc') + docs_dir = join_paths(get_option('prefix'), get_option('datadir'), 'doc') -custom_target( - 'gssdp-doc', - input: [ gssdp_toml, gir[0] ], - output: GSSDP_API_NAME, - command : [ - gidocgen, - 'generate', - '--quiet', - '--add-include-path=@0@'.format(meson.current_build_dir() / '../libgssdp'), - '--config', gssdp_toml, - '--output-dir=@OUTPUT@', - '--no-namespace-dir', - '--content-dir=@0@'.format(meson.current_source_dir()), - '@INPUT1@', + custom_target( + 'gssdp-doc', + input: [ gssdp_toml, gir[0] ], + output: GSSDP_API_NAME, + command : [ + gidocgen, + 'generate', + '--quiet', + '--add-include-path=@0@'.format(meson.current_build_dir() / '../libgssdp'), + '--config', gssdp_toml, + '--output-dir=@OUTPUT@', + '--no-namespace-dir', + '--content-dir=@0@'.format(meson.current_source_dir()), + '@INPUT1@', + ], + depend_files : [gssdp_toml, files('gssdp-device-sniffer.md')], + build_by_default: true, + install: true, + install_dir : docs_dir, + ) +endif + +if get_option('manpages') + pandoc = find_program('pandoc', required: true) + custom_target( + 'manpages', + input: files('gssdp-device-sniffer.md'), + output: 'gssdp-device-sniffer.1', + command: [ + pandoc, + '@INPUT@', + meson.current_source_dir() / 'metadata.yml', + '-s', + '-t', 'man', + '-o', '@OUTPUT@' ], - depend_files : gssdp_toml, + depend_files : files('gssdp-device-sniffer.md', 'metadata.yml'), build_by_default: true, install: true, - install_dir : docs_dir, -) - + install_dir: join_paths(get_option('prefix'), get_option('mandir'), 'man1'), + ) +endif diff --git a/doc/metadata.yml b/doc/metadata.yml new file mode 100644 index 0000000..a8d65fc --- /dev/null +++ b/doc/metadata.yml @@ -0,0 +1,5 @@ +--- +title: GSSDP-DEVICE-SNIFFER(1) +author: Jens Georg +date: November 2022 +--- diff --git a/meson.build b/meson.build index ad68ef0..ac24c17 100644 --- a/meson.build +++ b/meson.build @@ -97,9 +97,7 @@ gidocgen_dep = dependency('gi-docgen', version: '>= 2021.1', required: get_option('gtk_doc') and get_option('introspection') ) -if get_option('gtk_doc') - subdir('doc') -endif +subdir('doc') if get_option('examples') subdir('examples') diff --git a/meson_options.txt b/meson_options.txt index ab1f0bd..5f85187 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -3,3 +3,4 @@ option('sniffer', type: 'boolean', value: true, description: 'Compile graphical option('introspection', type: 'boolean', value : true, description: 'Enable or disable GObject Introspection') option('vapi', type: 'boolean', value: true, description: 'Enable or disable generation of Vala vapi file') option('examples', type: 'boolean', value: true, description : 'Enable or disable examples') +option('manpages', type: 'boolean', value: true, description : 'Generate man page for tools') -- cgit v1.2.1