commit f12c1ec11ba9d1306ae9365ec473222cbe5b1f15
parent 760707f39d4ee1b8a7b810d3c29fbef0574d8515
Author: Vincent Forest <vincent.forest@meso-star.com>
Date: Thu, 17 Feb 2022 16:53:25 +0100
Generate the man page of solstice
Diffstat:
5 files changed, 114 insertions(+), 19 deletions(-)
diff --git a/.gitignore b/.gitignore
@@ -36,7 +36,8 @@ star-vx.html
*.sig
*.err
*~
-.sigs
.chks
+.mans
+.sigs
tags
man
diff --git a/convert_man.sh b/convert_man.sh
@@ -0,0 +1,70 @@
+#!/bin/sh -e
+
+# Copyright (C) 2017-2022 |Meso|Star> (contact@meso-star.com)
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+. meso-menu.sh
+
+if [ $# -lt 4 ]; then
+ echo "Usage: $0 <section> <input> <output> <version>" >&2
+ exit 1
+fi
+
+section="$1"
+input="$2"
+output="$3"
+version="$4"
+
+man_name=${input##*/}
+man_name=${man_name%.*}
+man_section=$(echo "${input}" \
+ | sed 's/.*man\([[:digit:]]\{1\}[[:alpha:]]\{0,1\}\)\/.*/\1/g')
+
+{
+ print_header "${section}" "man-${man_name}"
+ echo "<div style=\"font-variant: small-caps; float: right; color: #777777\">"
+ echo "${man_section} ${version}</div>";
+ echo "<header>"
+ echo " <h1>${man_name}(${man_section})</h1>";
+ echo "</header>"
+ man2html -r "${input}" \
+ | tail -n +10 \
+ | sed '/^<HR>$/,$d' \
+ | sed '/\ /d' \
+ | sed 's/<DL COMPACT>/<DL>/g'
+ print_footer
+} > "${output}"
+
+# Clean the html file generated by man2html and check it if necessary
+tidy --show-info no -m "${output}" > /dev/null 2>&1 || sh check_html.sh "${output}"
+
+# Remove hyperlink on csplit, feh, gnuplot, sed, mmap and mpirun commands
+sed -i 's/<B><A HREF="\.\.\/man1\/csplit\.1\.html">csplit<\/A><\/B>/csplit/g' "${output}"
+sed -i 's/<B><A HREF="\.\.\/man1\/feh\.1\.html">feh<\/A><\/B>/feh/g' "${output}"
+sed -i 's/<B><A HREF="\.\.\/man1\/gnuplot\.1\.html">gnuplot<\/A><\/B>/gnuplot/g' "${output}"
+sed -i 's/<B><A HREF="\.\.\/man1\/sed\.1\.html">sed<\/A><\/B>/sed/g' "${output}"
+sed -i 's/<B><A HREF="\.\.\/man1\/mpirun\.1\.html">mpirun<\/A><\/B>/mpirun/g' "${output}"
+sed -i 's/<B><A HREF="\.\.\/man2\/mmap\.2\.html">mmap<\/A><\/B>/mmap/g' "${output}"
+
+# Fix the hyperlink toward the GPLv3+ license
+sed -i 's/gpl\.html\.">\(.*\).<\/A>/gpl.html">\1<\/A>./g' "${output}"
+
+# Remove unexpected link on sqrt(2)
+sed -i 's/<A HREF="\.\.\/man2\/sqrt\.2\.html">sqrt<\/A>/sqrt/g' "${output}"
+
+# Fix the man2html issues that translates the ' char in cq
+sed -i "s/cq\([a-z]\)\>/'\1/g" "${output}"
+
+
diff --git a/meso-menu.sh b/meso-menu.sh
@@ -15,8 +15,6 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-set -e
-
export solstice_man_pages="\
solstice 1
solstice-input 5
diff --git a/solstice/Makefile b/solstice/Makefile
@@ -21,7 +21,8 @@ SOLSTICE_VERSION=0.9.1
SOLPP_VERSION=0.3.1
SOLSTICE=downloads/Solstice-$(SOLSTICE_VERSION)-GNU-Linux64.tar.gz
-SOLSTICE_README=Solstice-$(SOLSTICE_VERSION)-GNU-Linux64/share/doc/solstice/README.md
+SOLSTICE_DIR=Solstice-$(SOLSTICE_VERSION)-GNU-Linux64
+SOLSTICE_README=$(SOLSTICE_DIR)/share/doc/solstice/README.md
SOLPP=downloads/Solstice-PP-Sources-$(SOLPP_VERSION).tar.gz
SOLPP_README=Solstice-PP-Sources-$(SOLPP_VERSION)/README.md
@@ -60,16 +61,22 @@ SOLSTICE_PKG=\
./downloads/Solstice-0.4.0-GNU-Linux64.tar.gz
SOLSTICE_SIG=$(SOLSTICE_PKG:=.sig)
+MAN=\
+ $(SOLSTICE_DIR)/share/man/man1/solstice.1\
+ $(SOLSTICE_DIR)/share/man/man5/solstice-input.5\
+ $(SOLSTICE_DIR)/share/man/man5/solstice-output.5\
+ $(SOLSTICE_DIR)/share/man/man5/solstice-receiver.5
+
IMG=themis.png
HTML=\
solstice.html\
solstice-downloads.html\
solstice-resources.html
-build: .sigs
- @$(MAKE) -fMakefile -f .sigs build_all
+build: .sigs .mans
+ @$(MAKE) -fMakefile -f .sigs -f .mans build_all
-build_all: solstice.html solstice-downloads.html solstice-resources.html
+build_all: solstice.html solstice-downloads.html solstice-resources.html man
publish: build
rsync -avzr \
@@ -89,12 +96,13 @@ clean:
solstice-pp-release-notes.html.in \
$(HTML) \
$(HTML:=.err)
-
+
distclean: clean
rm -f \
downloads/*.sig \
+ $(MAN) \
+ $(SOLPP_README) \
$(SOLSTICE_README) \
- $(SOLPP_README)
################################################################################
# Overview web page
@@ -104,7 +112,7 @@ solstice.html: solstice.html.in themis.png solstice_build.sh ../meso-menu.sh
@sh solstice_build.sh overview $(SOLSTICE_VERSION)
################################################################################
-# Downloads web page
+# Downloads web page
################################################################################
solstice-downloads.html: $(SOLSTICE_SIG) \
solstice-release-notes.html.in \
@@ -118,7 +126,8 @@ solstice-release-notes.html.in: $(SOLSTICE_README)
| sed -n '/^<h2>Release notes<\/h2>/,/^<h2>License<\/h2>/p' | sed '$$d' > $@
$(SOLSTICE_README):
- @tar -xz -f $(SOLSTICE) -i $(README)
+ @echo "Extracting $@ from $(SOLSTICE)"
+ tar -xz -f $(SOLSTICE) -i $(SOLSTICE_README)
################################################################################
# Additional resources
@@ -138,13 +147,21 @@ solstice-pp-release-notes.html.in: $(SOLPP_README)
| sed -e '$$d' -e 's/\<h3\>/h4/g' > $@
$(SOLPP_README):
+ @echo "Extracting $@ from $(SOLPP)"
@tar -xz -f $(SOLPP) -i $(SOLPP_README)
################################################################################
+# Man pages
+################################################################################
+$(MAN):
+ @echo "Extracting $@ from $(SOLSTICE)"
+ @tar -xz -f $(SOLSTICE) -i $@
+
+################################################################################
# Check files
################################################################################
-check: .chks .sigs
- @$(MAKE) -fMakefile -f .chks -f .sigs check_all
+check: build .chks .sigs .mans
+ @$(MAKE) -fMakefile -f .chks -f .sigs -f .mans check_all
check_all: check_shells $(HTML:=.chk)
@@ -164,8 +181,20 @@ check_shells:
.chks: Makefile
@echo "Setup .chks"
- @{ for i in $(HTML); do \
- printf "%s.chk: %s\n" $${i} $${i}; \
+ @{ for i in $(HTML) $(MAN); do \
+ printf "%s.chk: %s\n" $${i} $${ceipage}; \
printf "\t@echo Checking %s\n" $${i}; \
- printf "\t@sh ../check_html.sh %s\n" $${i}; \
+ printf "\t@PATH+=:../ sh check_html.sh %s\n" $${i}; \
done } > .chks
+
+.mans: Makefile
+ @echo "Setup .mans"
+ @{ for i in $(MAN); do \
+ man=$${i##*share/}.html; \
+ printf "man: %s\n" $${man}; \
+ printf "%s: %s\n" $${man} $${i}; \
+ printf "\t@echo \"Building $${man}\"\n"; \
+ printf "\t@mkdir -p $${man%/*}\n"; \
+ printf "\t@PATH+=:../ sh convert_man.sh Solstice $${i} $${man} $(SOLSTICE_VERSION)\n"; \
+ done } > .mans
+
diff --git a/solstice/solstice.html.in b/solstice/solstice.html.in
@@ -12,9 +12,6 @@
<li>GNU/Linux:
<a href="downloads/Solstice-${VERSION}-GNU-Linux64.tar.gz">tarball</a> /
<a href="downloads/Solstice-${VERSION}-GNU-Linux64.tar.gz.sig">pgp</a></li>
- <li>Windows:
- <a href="downloads/Solstice-${VERSION}-Win64.zip">zip</a> /
- <a href="downloads/Solstice-${VERSION}-Win64.zip.sig">pgp</a></li>
</ul>
<ul>
<li>Sources: