commit 11c97f9febdc4372d08cefcd6ef672ca545998dc
parent b9123708f07d2b6278425a22d9ded3529c1f5114
Author: Vincent Forest <vincent.forest@meso-star.com>
Date: Thu, 21 Aug 2025 13:57:56 +0200
Start of deployment of the new compilation procedure
The main Makefile becomes the only one. It has been rewritten from the
prototype developed for the A.R.T. section. The “list.sh” script has
been added to facilitate its writing by providing a simple way to list
the HTML files to be generated or the signatures of the archives to be
generated.
To test this new infrastructure, this validation adds the misc section
as a valid entry in the menu.tsv file. It also contains the index.tsv
file, which defines its indexed content.
Diffstat:
| M | Makefile | | | 101 | +++++++++++++++++++++++++++++++++++++++++-------------------------------------- |
| D | art/Makefile | | | 71 | ----------------------------------------------------------------------- |
| M | generate_header.sh | | | 13 | ++----------- |
| A | list.sh | | | 105 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
| M | menu.tsv | | | 2 | +- |
| A | meso-web.sh | | | 27 | +++++++++++++++++++++++++++ |
| D | misc/Makefile | | | 76 | ---------------------------------------------------------------------------- |
| A | misc/index.tsv | | | 2 | ++ |
| D | misc/misc_build.sh | | | 44 | -------------------------------------------- |
9 files changed, 190 insertions(+), 251 deletions(-)
diff --git a/Makefile b/Makefile
@@ -12,56 +12,61 @@
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
.POSIX:
+.SUFFIXES: .md .html .sh .lint .shlint
include config.mk
-SUBDIRS=art htrdr misc schiff solstice stardis
-
-SCRIPTS=\
- build_htaccess.sh\
- lint_html.sh\
- configure.sh\
- configure_targets.sh\
- convert_man.sh\
- convert_mdoc.sh\
- meso-menu.sh
-
-build:
- @for subdir in $(SUBDIRS); do \
- printf "\e[1m>>> %s\e[0m\n" $$subdir; \
- $(MAKE) -C $${subdir}; echo ""; done
-
-distclean:
- @echo "Removing .htaccess"
- @rm -f .htaccess && echo ""
- @for subdir in $(SUBDIRS); do \
- printf "\e[1m>>> %s\e[0m\n" $$subdir; \
- $(MAKE) -C $${subdir} $@; echo ""; done
-
-clean:
- @echo "Removing .htaccess"
- @rm -f .htaccess && echo ""
- @for subdir in $(SUBDIRS); do \
- printf "\e[1m>>> %s\e[0m\n" $$subdir; \
- $(MAKE) -C $${subdir} $@; echo ""; done
-
-lint:
- @for i in $(SCRIPTS); do \
- printf "Linting %s\n" "$${i}"; \
- shellcheck -o all -x "$${i}"; done
- @echo ""
- @for subdir in $(SUBDIRS); do \
- printf "\e[1m>>> %s\e[0m\n" $$subdir; \
- $(MAKE) -C $${subdir} $@; echo ""; done
-
-install: htaccess
- @for subdir in $(SUBDIRS); do \
- printf "\e[1m>>> %s\e[0m\n" $$subdir; \
- $(MAKE) -C $$subdir $@; echo ""; done
- @rsync -avzrR --delete-after --progress\
- solstice.html .htaccess fonts meso.css ${PREFIX}
-
-htaccess:
+LINT=$(HTML:.html=.lint) $(SH:.sh=.shlint)
+
+default: build
+
+build clean distclean lint install:
+ @$(MAKE) -fMakefile $@__ \
+ HTML="$$($(SHELL) ./list.sh html | tr '\n' ' ')" \
+ SIG="$$( $(SHELL) ./list.sh sig | tr '\n' ' ')" \
+ SH="$$( $(SHELL) ./list.sh shell | tr '\n' ' ')"
+
+build__: $(HTML) $(SIG)
+
+clean__:
+ rm -f $(HTML)
+
+distclean__: clean__
+ rm -f $(SIG)
+
+install__: $(HTML) $(SIG)
+ @rsync --mkpath -avzrR --delete-after --progress \
+ meso.css $(HTML) $$($(SHELL) ./list.sh subdir) $(PREFIX)
+
+################################################################################
+# Generate content
+################################################################################
+$(HTML): generate_header.sh
+
+$(SIG): $(@:.sig=)
+ gpg --yes -a -o $@ --detach-sign $(@:.sig=)
+
+.sh.md:
+ @cd -- "$$(dirname "$<")"; \
+ $(SHELL) ./"$$(basename "$<")" > "$$(basename "$@")"
+
+.md.html:
@echo "Building $@"
- @$(SHELL) build_htaccess.sh /$$(basename "$(PREFIX)") > .htaccess
+ @{ \
+ $(SHELL) generate_header.sh $${PWD}/$@; \
+ $(MD2HTML) $<; \
+ cat footer.html; \
+ } > $@
+
+################################################################################
+# Check files
+################################################################################
+.html.lint:
+ tidy --show-info no -qe $<
+
+.sh.shlint:
+ shellcheck -o all -x $<
+
+lint__: $(LINT)
diff --git a/art/Makefile b/art/Makefile
@@ -1,71 +0,0 @@
-# Copyright (C) 2017-2025 |Méso|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/>.
-
-.POSIX:
-.SUFFIXES: .md .html .sh .lint
-
-include ../config.mk
-
-LINT=$(HTML:.html=.lint)
-
-default: build
-
-build clean lint install:
- @$(MAKE) -fMakefile $@__ \
- HTML="$$(find . ! -path . -type d -prune -o \
- \( \
- -name "*.md" \
- -o -name "*.sh" \
- \) -exec sh -c 'printf "%s.html " "$${1%.*}"' -- {} \;)" \
- SIG="$$(find ./downloads -type f ! -name "*.sig" \
- -exec sh -c 'printf "%s.sig " "$$1"' -- {} \;)"
-
-build__: $(HTML) $(SIG)
-
-clean__:
- rm -f $(HTML)
- rm -f $(SIG)
-
-install__: $(HTML) $(SIG)
- @rsync --mkpath -avzrR --delete-after --progress \
- $(HTML) images downloads $(PREFIX)/art/
-
-################################################################################
-# Generate content
-################################################################################
-$(HTML): ../generate_header.sh
-
-$(SIG): $(@:.sig=)
- gpg --yes -a -o $@ --detach-sign $(@:.sig=)
-
-.sh.md:
- @$(SHELL) ./$< > $@
-
-.md.html:
- @echo "Building $@"
- @{ \
- $(SHELL) ../generate_header.sh $${PWD}/$@; \
- $(MD2HTML) $<; \
- cat ../footer.html; \
- } > $@
-
-################################################################################
-# Check files
-################################################################################
-.html.lint:
- tidy --show-info no -qe $<
-
-lint__: $(HTML) $(LINT)
- shellcheck -o all -x *.sh
diff --git a/generate_header.sh b/generate_header.sh
@@ -17,6 +17,8 @@
set -e
+. "./meso-web.sh"
+
########################################################################
# Helper functions
########################################################################
@@ -27,17 +29,6 @@ absdir() # file
cd "${OLDPWD}"
}
-# Delete irrelevant data
-strip_dummy() # stdin
-{
- # - Remove comments
- # - Remove empty lines
- # - Remove heading an trailing spaces
- sed 's/#.\{0,\}$//g' \
- | sed '/^[[:space:]]\{0,\}$/d' \
- | sed -e 's/^[[:space:]]\{1,\}//g' -e 's/[[:space:]]\{1,\}$//g'
-}
-
# List the indexed content in TSV format. Each line contains the index
# label, followed by the indexed content, and possibly an indicator of
# the language used.
diff --git a/list.sh b/list.sh
@@ -0,0 +1,105 @@
+#!/bin/sh
+
+# Copyright (C) 2017-2025 |Méso|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-web.sh"
+
+set -e
+
+if [ "$#" -lt 1 ]; then
+ >&2 printf 'usage: %s <html|shell|sig>\n' "${0##*/}"
+ exit 1
+fi
+
+########################################################################
+# Helper functions
+########################################################################
+# List of HTML files to generate from Markdown files or shell scripts
+# stored in each section
+html()
+{
+ _find_args="$(\
+ printf '%s\n' "${sections}" \
+ | sed -e 's/^/! -path /' \
+ | tr '\n' ' ')"
+
+ eval "exec find ${search_dirs} ${_find_args} -type d -prune -o \
+ \( \
+ -name \"*.md\" \
+ -o -name \"*.sh\" \
+ \) -exec sh -c 'printf \"%s.html\n\" \"\${1%.*}\"' -- {} \; \
+ | sort"
+}
+
+# List of signatures to be performed, i.e. the signature of each
+# archive stored in the "downloads" subdirectory of each section
+sig()
+{
+ _find_args="$(printf '%s\n' "${sections}" \
+ | sed -e 's/^/-path "/;s/$/\/downloads\/*" -o/' \
+ | tr '\n' ' ' \
+ | sed 's/ -o $//')"
+
+ eval "exec find ${search_dirs} ${_find_args} -type f \
+ \( \
+ -name \"*.tgz\" \
+ -o -name \"*.tar.gz\" \
+ -o -name \"*.tar\" \
+ \) -exec sh -c 'printf \"%s.sig\n\" \"\$1\"' -- {} \; \
+ | sort"
+}
+
+# List the shell scripts relevant to the compilation system, i.e. the
+# shell script at the root of the working tree and those in each section
+# used to generate HTML pages.
+shell()
+{
+ _find_args="$(\
+ printf '%s\n' "${sections}" \
+ | sed -e 's/^/! -path /' \
+ | tr '\n' ' ')"
+
+ eval "exec find . ${search_dirs} \
+ ! -path . ${_find_args} -type d -prune -o -name \"*.sh\" -print \
+ | sort"
+}
+
+subdir()
+{
+ downloads="-path \1/downloads"
+ images="-path \1/images -o -path \1/thumbs"
+
+ _find_args="$(\
+ printf '%s\n' "${sections}" \
+ | sed "s;^\(.\{0,\}\)$;${downloads} -o ${images} -o;" \
+ | tr '\n' ' ' \
+ | sed 's/ -o $//')"
+
+ eval "exec find ${search_dirs} ${_find_args} -type d | sort"
+}
+
+########################################################################
+# Script
+########################################################################
+# List of sections to be dealt with
+sections="$(\
+ strip_dummy < menu.tsv \
+ | cut -d' ' -f2 \
+ | sed -e 's/[[:space:]]/\ /g')"
+
+search_dirs="$(printf '%s\n' "${sections}" | tr '\n' ' ')"
+
+"$@"
diff --git a/menu.tsv b/menu.tsv
@@ -1,4 +1,4 @@
-#Home misc
+Home misc
A.R.T art
#htrdr htrdr
#Schiff schiff
diff --git a/meso-web.sh b/meso-web.sh
@@ -0,0 +1,27 @@
+#!/bin/sh
+
+# Copyright (C) 2017-2025 |Méso|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/>.
+
+# Delete irrelevant data
+strip_dummy() # stdin
+{
+ # - Remove comments
+ # - Remove empty lines
+ # - Remove heading an trailing spaces
+ sed 's/#.\{0,\}$//g' \
+ | sed '/^[[:space:]]\{0,\}$/d' \
+ | sed -e 's/^[[:space:]]\{1,\}//g' -e 's/[[:space:]]\{1,\}$//g'
+}
diff --git a/misc/Makefile b/misc/Makefile
@@ -1,76 +0,0 @@
-# Copyright (C) 2017-2025 |Méso|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/>.
-.POSIX:
-
-include ../config.mk
-
-HTML=\
- about-en.html\
- about-fr.html\
- legal-en.html\
- legal-fr.html
-
-build: $(HTML)
-
-clean:
- @echo "Cleaning generated files"
- @rm -f .lint\
- about-en.html\
- about-fr.html\
- legal-en.html\
- legal-fr.html\
- $(HTML:=.err)
-
-distclean: clean
-
-install: build
- @rsync -avzrR --delete-after --progress $(HTML) $(PREFIX)/misc/
-
-misc_build.sh: ../meso-menu.sh
- @touch $@
-
-################################################################################
-# html
-################################################################################
-about-en.html: about-en.md misc_build.sh
- @echo "Building $@"
- @$(SHELL) misc_build.sh about en > $@
-
-about-fr.html: about-fr.md misc_build.sh
- @echo "Building $@"
- @$(SHELL) misc_build.sh about fr > $@
-
-legal-en.html: legal-en.md misc_build.sh
- @echo "Building $@"
- @$(SHELL) misc_build.sh legal en > $@
-
-legal-fr.html: legal-fr.md misc_build.sh
- @echo "Building $@"
- @$(SHELL) misc_build.sh legal fr > $@
-
-################################################################################
-# Check files
-################################################################################
-lint: build .lint
- @$(MAKE) -fMakefile -f .lint lint_all
-
-lint_all: lint_shells $(HTML:=.lint)
-
-lint_shells:
- @echo "Linting misc_build.sh" && shellcheck -o all -x misc_build.sh
-
-.lint: Makefile ../configure_targets.sh
- @echo "Setup .lint"
- @$(SHELL) ../configure_targets.sh lint $(HTML) > .lint
diff --git a/misc/index.tsv b/misc/index.tsv
@@ -0,0 +1,2 @@
+Home about-@LANG@.html fr:en
+Legal notices legal-@LANG@.html fr:en
diff --git a/misc/misc_build.sh b/misc/misc_build.sh
@@ -1,44 +0,0 @@
-#!/bin/sh -e
-
-# Copyright (C) 2017-2025 |Méso|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
-
-about()
-{
- if [ $# -lt 1 ]; then
- printf "Usage: %s about <fr|en>\n" "$0" >&2
- exit 1
- fi
-
- print_header -s Home -n About -l "$1" -r ../
- md2html about-"$1".md
- print_footer
-}
-
-legal()
-{
- if [ $# -lt 1 ]; then
- printf "Usage: %s lang <fr|en>\n" "$0" >&2
- exit 1
- fi
-
- print_header -s Home -n Legal -l "$1" -r ../
- md2html legal-"$1".md
- print_footer
-}
-
-"$@"