From fa2bd44253148ae8dc0e7145ffd2d0f04bfac1ab Mon Sep 17 00:00:00 2001 From: Rohan Kumar Date: Mon, 26 Oct 2020 13:56:51 -0700 Subject: [PATCH] Add manpage --- meson.build | 29 ++++++++++++++++++++++++++- meson_options.txt | 1 + wlsunset.1.scd | 50 +++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 79 insertions(+), 1 deletion(-) create mode 100644 meson_options.txt create mode 100644 wlsunset.1.scd diff --git a/meson.build b/meson.build index e78b203..585d895 100644 --- a/meson.build +++ b/meson.build @@ -51,5 +51,32 @@ executable( 'wlsunset', ['main.c', 'color_math.c'], dependencies: [protocols_dep, m, rt], - install: true + install: true, ) + +scdoc = dependency('scdoc', required: get_option('man-pages'), version: '>= 1.9.7') + +if scdoc.found() + sh = find_program('sh') + + man_pages = ['wlsunset.1.scd'] + + mandir = get_option('mandir') + + foreach src : man_pages + topic = src.split('.')[0] + section = src.split('.')[1] + output = '@0@.@1@'.format(topic, section) + + custom_target( + output, + input: src, + output: output, + command: [ + sh, '-c', '@0@ < @INPUT@ > @1@'.format(scdoc.get_pkgconfig_variable('scdoc'), output) + ], + install: true, + install_dir: '@0@/man@1@'.format(mandir, section) + ) + endforeach +endif diff --git a/meson_options.txt b/meson_options.txt new file mode 100644 index 0000000..e40a23d --- /dev/null +++ b/meson_options.txt @@ -0,0 +1 @@ +option('man-pages', type: 'feature', value: 'auto', description: 'Generate and install man pages') diff --git a/wlsunset.1.scd b/wlsunset.1.scd new file mode 100644 index 0000000..ab53726 --- /dev/null +++ b/wlsunset.1.scd @@ -0,0 +1,50 @@ +wlsunset(1) + +# NAME + +wlsunet - Day/night gamma adjustments for Wayland compositors supporting wlr-gamma-control-unstable-v1 + +# SYNOPSIS + +*wlsunset* [options...] + +# OPTIONS + +*-h* + show this help message + +*-T* + set high temperature (default: 6500) + +*-t* + set low temperature (default: 4000) + +*-l* + set latitude (e.g. 39.9) + +*-L* + set longitude (e.g. 116.3) + +*-s* + set manual start time (e.g. 06:30) + +*-S* + set manual stop time (e.g. 19:30) + +*-g* + set gamma (default: 1.0) + +# EXAMPLE + +``` +# Beijing lat/long. +wlsunset -l 39.9 -L 116.3 +``` + +Greater precision than one decimal place serves no purpose +(https://xkcd.com/2170/) other than padding the command-line. + +# AUTHORS + +Maintained by Kenny Levinsen . For more information about +wlsunset development, see https://sr.ht/~kennylevinsen/wlsunset.