diff options
author | Duncan Roe <duncan_roe@optusnet.com.au> | 2021-08-28 13:35:03 +1000 |
---|---|---|
committer | Pablo Neira Ayuso <pablo@netfilter.org> | 2021-08-28 11:13:01 +0200 |
commit | 1e0aaf85fe38c7d8c524c6a8a8067a4ae8421bd3 (patch) | |
tree | a5c76e6bc3ab042c614b7463e4d60e1ec0af3494 | |
parent | bd7189f6fbe6648f5e61ca9aa1169ebaf846adde (diff) |
build: doc: Split off man pages script from Makefile.am
Split off shell script from within doxygen/Makefile.am into
doxygen/build_man.sh.
This patch by itself doesn't fix anything.
The patch is only for traceability, because diff patch format is not very good
at catching code updates and moving code together.
Therefore the script is exactly as it was; it still looks a bit different
because of having to un-double doubled-up $ signs, remove trailing ";/" and so
on.
Signed-off-by: Duncan Roe <duncan_roe@optusnet.com.au>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
-rw-r--r-- | doxygen/Makefile.am | 34 | ||||
-rwxr-xr-x | doxygen/build_man.sh | 29 |
2 files changed, 32 insertions, 31 deletions
diff --git a/doxygen/Makefile.am b/doxygen/Makefile.am index 29078de..5068544 100644 --- a/doxygen/Makefile.am +++ b/doxygen/Makefile.am @@ -16,37 +16,7 @@ doxyfile.stamp: $(doc_srcs) Makefile.am [ ! -d ../src.distcheck ] || \ { set -x; cd ..; rm src; mv src.distcheck src; } -# We need to use bash for its associative array facility -# (`bash -p` prevents import of functions from the environment). -# The command has to be a single line so the functions work -# and so `make` gives all lines to `bash -c` -# (hence ";\" at the end of every line but the last). - /bin/bash -p -c 'declare -A renamed_page;\ -main(){ set -e; cd man/man3; rm -f _*;\ - count_real_pages;\ - rename_real_pages;\ - make_symlinks;\ -};\ -count_real_pages(){ page_count=0;\ - for i in $$(ls -S);\ - do head -n1 $$i | grep -E -q '^\.so' && break;\ - page_count=$$(($$page_count + 1));\ - done;\ - first_link=$$(($$page_count + 1));\ -};\ -rename_real_pages(){ for i in $$(ls -S | head -n$$page_count);\ - do for j in $$(ls -S | tail -n+$$first_link);\ - do grep -E -q $$i$$ $$j && break;\ - done;\ - mv -f $$i $$j;\ - renamed_page[$$i]=$$j;\ - done;\ -};\ -make_symlinks(){ for j in $$(ls -S | tail -n+$$first_link);\ - do ln -sf $${renamed_page[$$(cat $$j | cut -f2 -d/)]} $$j;\ - done;\ -};\ -main' + $(abs_top_srcdir)/doxygen/build_man.sh touch doxyfile.stamp @@ -64,3 +34,5 @@ install-data-local: uninstall-local: rm -r $(DESTDIR)$(mandir) man html doxyfile.stamp endif + +EXTRA_DIST = build_man.sh diff --git a/doxygen/build_man.sh b/doxygen/build_man.sh new file mode 100755 index 0000000..304a305 --- /dev/null +++ b/doxygen/build_man.sh @@ -0,0 +1,29 @@ +#!/bin/bash -p +# We need to use bash for its associative array facility +# (`bash -p` prevents import of functions from the environment). +declare -A renamed_page +main(){ set -e; cd man/man3; rm -f _* + count_real_pages + rename_real_pages + make_symlinks +} +count_real_pages(){ page_count=0 + for i in $(ls -S) + do head -n1 $i | grep -E -q '^\.so' && break + page_count=$(($page_count + 1)) + done + first_link=$(($page_count + 1)) +} +rename_real_pages(){ for i in $(ls -S | head -n$page_count) + do for j in $(ls -S | tail -n+$first_link) + do grep -E -q $i$ $j && break + done + mv -f $i $j + renamed_page[$i]=$j + done +} +make_symlinks(){ for j in $(ls -S | tail -n+$first_link) + do ln -sf ${renamed_page[$(cat $j | cut -f2 -d/)]} $j + done +} +main |