aboutsummaryrefslogtreecommitdiff
path: root/man/meson_man_links.sh
blob: 17c21a998413ccbe65c979c681d9a8f3a54630a0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/bin/sh

get_links() {
	sed -e 's/ ,//g' \
		-e '/^\.Sh NAME$/,/\.Sh/ s/\.Nm //p' \
		-n ${MESON_SOURCE_ROOT}/man/${1}
}

MANDIR="$1"
shift
for man in $@; do
	prefix=${man%%.*}
	suffix=${man#*.}
	links=$(get_links ${man})
	for link in ${links}; do
		if [ "${link}" != "${prefix}" ]; then
			ln -sf ${man} ${MESON_INSTALL_DESTDIR_PREFIX}/${MANDIR}/man${suffix}/${link}.${suffix}
		fi
	done
done