Skip to content

Commit e9bbff1

Browse files
committed
meson: add build/man/man and build/man/html to build and display pages
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/.
1 parent da35a1c commit e9bbff1

File tree

4 files changed

+40
-0
lines changed

4 files changed

+40
-0
lines changed

man/html.in

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/bin/sh
2+
set -e
3+
4+
if [ -z "$1" ]; then
5+
echo "Use: $0 page-name (with no section suffix)"
6+
exit 1
7+
fi
8+
9+
target="man/$1.html"
10+
ninja -C "@BUILD_ROOT@" "$target"
11+
set -x
12+
exec xdg-open build/"$target"

man/man.in

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/bin/sh
2+
set -e
3+
4+
if [ -z "$1" ]; then
5+
echo "Use: $0 page-name (with no section suffix)"
6+
exit 1
7+
fi
8+
9+
target=$(ninja -C "@BUILD_ROOT@" -t query man/man | grep -E -m1 "man/$1\.[0-9]$" | awk '{print $2}')
10+
if [ -z "$target" ]; then
11+
echo "Cannot find page $1"
12+
exit 1
13+
fi
14+
ninja -C "@BUILD_ROOT@" "$target"
15+
exec man build/"$target"

man/meson.build

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,3 +204,15 @@ if git.found()
204204
'mv t @0@/rules/meson.build'.format(meson.current_source_dir())],
205205
depend_files : custom_entities_ent)
206206
endif
207+
208+
############################################################
209+
210+
configure_file(
211+
input : 'man.in',
212+
output : 'man',
213+
configuration : substs)
214+
215+
configure_file(
216+
input : 'html.in',
217+
output : 'html',
218+
configuration : substs)

meson.build

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,7 @@ substs.set('RC_LOCAL_SCRIPT_PATH_START', get_option('rc-loc
283283
substs.set('RC_LOCAL_SCRIPT_PATH_STOP', get_option('halt-local'))
284284
substs.set('MEMORY_ACCOUNTING_DEFAULT', memory_accounting_default ? 'yes' : 'no')
285285
substs.set('HIGH_RLIMIT_NOFILE', conf.get('HIGH_RLIMIT_NOFILE'))
286+
substs.set('BUILD_ROOT', meson.current_build_dir())
286287

287288
#####################################################################
288289

0 commit comments

Comments
 (0)