]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
meson: add build/man/man and build/man/html to build and display pages
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Thu, 9 May 2019 11:23:50 +0000 (13:23 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Thu, 9 May 2019 16:17:28 +0000 (18:17 +0200)
Man page generation is generally very slow. I prefer to use -Dman=false when
developing systemd, and only build specific pages when introducing changes.
Those two little helper tools make it easy:

$ build/man/man systemd.link
$ build/man/html systemd.link

will show systemd.link.8 and systemd.link.html from the build directory build/.

man/html.in [new file with mode: 0755]
man/man.in [new file with mode: 0755]
man/meson.build
meson.build

diff --git a/man/html.in b/man/html.in
new file mode 100755 (executable)
index 0000000..d4debcc
--- /dev/null
@@ -0,0 +1,12 @@
+#!/bin/sh
+set -e
+
+if [ -z "$1" ]; then
+    echo "Use: $0 page-name (with no section suffix)"
+    exit 1
+fi
+
+target="man/$1.html"
+ninja -C "@BUILD_ROOT@" "$target"
+set -x
+exec xdg-open build/"$target"
diff --git a/man/man.in b/man/man.in
new file mode 100755 (executable)
index 0000000..5700a64
--- /dev/null
@@ -0,0 +1,15 @@
+#!/bin/sh
+set -e
+
+if [ -z "$1" ]; then
+    echo "Use: $0 page-name (with no section suffix)"
+    exit 1
+fi
+
+target=$(ninja -C "@BUILD_ROOT@" -t query man/man | grep -E -m1 "man/$1\.[0-9]$" | awk '{print $2}')
+if [ -z "$target" ]; then
+    echo "Cannot find page $1"
+    exit 1
+fi
+ninja -C "@BUILD_ROOT@" "$target"
+exec man build/"$target"
index ae9c941fcdafe54b42286c4e4068f1dcf71204b0..f3992b28341698418be576efbaae07608be6174b 100644 (file)
@@ -204,3 +204,15 @@ if git.found()
                            'mv t @0@/rules/meson.build'.format(meson.current_source_dir())],
                 depend_files : custom_entities_ent)
 endif
+
+############################################################
+
+configure_file(
+        input : 'man.in',
+        output : 'man',
+        configuration : substs)
+
+configure_file(
+        input : 'html.in',
+        output : 'html',
+        configuration : substs)
index eaf0eddcb1a7ff16b6a099677a25144d40df236d..35f8992345aa75939c2b4e3839e0d29adc21b378 100644 (file)
@@ -283,6 +283,7 @@ substs.set('RC_LOCAL_SCRIPT_PATH_START',                      get_option('rc-loc
 substs.set('RC_LOCAL_SCRIPT_PATH_STOP',                       get_option('halt-local'))
 substs.set('MEMORY_ACCOUNTING_DEFAULT',                       memory_accounting_default ? 'yes' : 'no')
 substs.set('HIGH_RLIMIT_NOFILE',                              conf.get('HIGH_RLIMIT_NOFILE'))
+substs.set('BUILD_ROOT',                                      meson.current_build_dir())
 
 #####################################################################