]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
meson: fix build/man/{man,html} to support page redirects
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Fri, 7 Aug 2020 16:42:22 +0000 (18:42 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Thu, 20 Aug 2020 15:42:13 +0000 (17:42 +0200)
Commands like build/man/man journald.conf.d would show the installed
man page (or an error if the page cannot be found in the global search
path), and not the one in the build directory. If the man page is
a redirect, or the .html is a symlink, resolve it, build the target,
and show that.

man/html.in
man/man.in

index b7e79841d080f47ef61d32e367987f80cc0888a1..23b77ebbb068bfe703d6a99ad49cbb450c2df6fc 100755 (executable)
@@ -11,5 +11,14 @@ ninja -C "@BUILD_ROOT@" version.h
 
 target="man/$1.html"
 ninja -C "@BUILD_ROOT@" "$target"
+
+fullname="@BUILD_ROOT@/$target"
+redirect="$(readlink "$fullname" 2>/dev/null)"
+if [ -n "$redirect" ]; then
+    ninja -C "@BUILD_ROOT@" "man/$redirect"
+
+    fullname="@BUILD_ROOT@/man/$redirect"
+fi
+
 set -x
-exec xdg-open "@BUILD_ROOT@/$target"
+exec xdg-open "$fullname"
index fa6164b8ded36e17066039ed07852ecf0718346c..12eb332ee00c911454b1c793d3190ae79c51e274 100755 (executable)
@@ -16,4 +16,13 @@ if [ -z "$target" ]; then
     exit 1
 fi
 ninja -C "@BUILD_ROOT@" "$target"
-exec man "@BUILD_ROOT@/$target"
+
+fullname="@BUILD_ROOT@/$target"
+redirect="$(sed -n -r '1 s|^\.so man[0-9]/(.*)|\1|p' "$fullname")"
+if [ -n "$redirect" ]; then
+    ninja -C "@BUILD_ROOT@" "man/$redirect"
+
+    fullname="@BUILD_ROOT@/man/$redirect"
+fi
+
+exec man "$fullname"