commit 58f455514c323b7757fd9b64697b0ffaa7f4b255
parent 1d52641360299461307078a739dc37c625342d62
Author: Vincent Forest <vincent.forest@meso-star.com>
Date: Tue, 22 Feb 2022 12:35:08 +0100
art: full rewrite of the build process
Use POSIX shell/make
Diffstat:
| M | .gitignore | | | 9 | --------- |
| A | art/.gitignore | | | 7 | +++++++ |
| M | art/Makefile | | | 142 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-------------------- |
| D | art/art.sh | | | 131 | ------------------------------------------------------------------------------- |
| A | art/art_build.sh | | | 84 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
5 files changed, 197 insertions(+), 176 deletions(-)
diff --git a/.gitignore b/.gitignore
@@ -1,12 +1,3 @@
-art.html
-consortium*.html
-hr_ppart.html
-karine.html
-kdistribution.html
-ppart_lw.html
-ppart_sw.html
-kspectrum.html
-starter-pack.html
star-engine.html
star-engine-downloads.html
star-engine-release-notes.html.in
diff --git a/art/.gitignore b/art/.gitignore
@@ -0,0 +1,7 @@
+art.html
+hr_ppart.html
+karine.html
+kdistribution.html
+ppart_lw.html
+ppart_sw.html
+kspectrum.html
diff --git a/art/Makefile b/art/Makefile
@@ -12,41 +12,111 @@
#
# 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:
-KSPECTRUM-VERSION=1.3
-KDISTRIBUTION-VERSION=1.1.1
-KARINE-VERSION=3.5
-
-SRC = \
- art.html.in \
- kspectrum.html.in \
- kdistribution.html.in \
- hr_ppart.html.in \
- ppart_lw.html.in \
- ppart_sw.html.in \
- karine.html.in
-HTML-FILES=$(patsubst %.html.in,%.html,${SRC})
-
-IMG = \
- k001.svg \
- tau_cumulated_1180-1200.svg \
- emission_altitude_500-505.svg \
- Te_signal_500-505.svg \
- Tb.svg \
- si_flux.svg \
- pne_mls_cs.svg \
- pne_mls_ac.svg \
- venus_ner.svg
-
-.PHONY: all clean default publish
-default: all
-
-all: ${SRC} ${IMG}
- @bash art.sh ${KSPECTRUM-VERSION} ${KDISTRIBUTION-VERSION} ${KARINE-VERSION}
-
-clean:
- rm ${HTML-FILES} downloads/*.sig
-
-publish:
- rsync -arvz ${HTML-FILES} ${IMG} downloads ${REMOTE}/art/
+include ../config.mk
+KSPECTRUM_VERSION=1.3
+KDISTRIBUTION_VERSION=1.1.1
+KARINE_VERSION=3.5
+
+ART_PKG=\
+ downloads/kspectrum$(KSPECTRUM_VERSION).tgz\
+ downloads/kdistribution_light$(KDISTRIBUTION_VERSION).tgz\
+ downloads/hr_ppart.tgz\
+ downloads/ppart_lw.tgz\
+ downloads/ppart_sw.tgz\
+ downloads/karine$(KARINE_VERSION).tgz
+ART_SIG=$(ART_PKG:=.sig)
+
+ART_FILES=\
+ downloads/install_kspectrum$(KSPECTRUM_VERSION).bash\
+ downloads/kspectrum$(KSPECTRUM_VERSION)_manual.pdf\
+ downloads/install_kdistribution_light$(KDISTRIBUTION_VERSION).bash\
+ downloads/kdistribution_light$(KDISTRIBUTION_VERSION)_manual.pdf\
+ downloads/karine$(KARINE_VERSION)_manual.pdf
+
+KSPECTRUM_IMG=k001.svg tau_cumulated_1180-1200.svg
+HR_PPART_IMG=emission_altitude_500-505.svg Te_signal_500-505.svg
+KARINE_IMG=pne_mls_cs.svg pne_mls_ac.svg venus_ner.svg
+IMG=$(KSPECTRUM_IMG) $(HR_PPART_IMG) $(KARINE_IMG) Tb.svg si_flux.svg
+
+HTML=\
+ art.html\
+ kspectrum.html\
+ kdistribution.html\
+ hr_ppart.html\
+ ppart_lw.html\
+ ppart_sw.html\
+ karine.html
+
+build: .sig
+ @$(MAKE) -fMakefile -f .sig build_all
+
+build_all: $(ART_SIG) $(HTML)
+
+clean:
+ rm -f $(HTML) $(HTML:=.err)
+
+distclean: clean
+ rm -f $(ART_SIG)
+
+publish: build
+ rsync -avzrR --delete-after \
+ $(HTML) $(IMG) $(ART_FILES) $(ART_PKG) $(ART_SIG) $(REMOTE)/art/
+
+art_build.sh: ../meso-menu.sh
+ @touch art_build.sh
+
+################################################################################
+# html
+################################################################################
+art.html: art.html.in art_build.sh
+ @echo "Building $@"
+ @sh art_build.sh overview > $@
+
+kspectrum.html: kspectrum.html.in art_build.sh Makefile $(KSPECTRUM_IMG)
+ @echo "Building $@"
+ @sh art_build.sh kspectrum $(KSPECTRUM_VERSION) > $@
+
+kdistribution.html: kdistribution.html.in art_build.sh Makefile
+ @echo "Building $@"
+ @sh art_build.sh kdistribution $(KDISTRIBUTION_VERSION) > $@
+
+hr_ppart.html: hr_ppart.html.in art_build.sh $(HR_PPART_IMG)
+ @echo "Building $@"
+ @sh art_build.sh hr_ppart > $@
+
+ppart_lw.html: ppart_lw.html.in Tb.svg art_build.sh
+ @echo "Building $@"
+ @sh art_build.sh ppart_lw > $@
+
+ppart_sw.html: ppart_sw.html.in si_flux.svg art_build.sh
+ @echo "Building $@"
+ @sh art_build.sh ppart_sw > $@
+
+karine.html: karine.html.in art_build.sh Makefile $(KARINE_IMG)
+ @echo "Building $@"
+ @sh art_build.sh karine $(KARINE_VERSION) > $@
+
+################################################################################
+# Check files
+################################################################################
+check: build .chk
+ @$(MAKE) -fMakefile -f .chk check_all
+
+check_all: check_shells $(HTML:=.chk)
+
+check_shells:
+ @echo "Checking art_build.sh" && shellcheck -o all -x art_build.sh
+
+################################################################################
+# Miscellaneous targets
+################################################################################
+.sig: Makefile ../configure_targets.sh
+ @echo "Setup .sig"
+ @sh ../configure_targets.sh sig $(ART_PKG) > .sig
+
+.chk: Makefile ../configure_targets.sh
+ @echo "Setup .chk"
+ @sh ../configure_targets.sh chk $(HTML) > .chk
diff --git a/art/art.sh b/art/art.sh
@@ -1,131 +0,0 @@
-#!/bin/bash
-
-# 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/>.
-
-set -e
-
-source ../meso-menu.sh
-
-if [ $# -lt 3 ]; then
- echo "Usage: $0 KSPECTRUM-VERSION KDISTRIBUTION-VERSION KARINE-VERSION"
- exit 1
-fi
-
-required_files=(
- "./downloads/kspectrum$1.tgz"
- "./downloads/install_kspectrum$1.bash"
- "./downloads/kspectrum$1_manual.pdf"
- "./downloads/kdistribution_light$2.tgz"
- "./downloads/install_kdistribution_light$2.bash"
- "./downloads/kdistribution_light$2_manual.pdf"
- "./downloads/hr_ppart.tgz"
- "./downloads/ppart_lw.tgz"
- "./downloads/ppart_sw.tgz"
- "./downloads/karine$3.tgz"
- "./downloads/karine$3_manual.pdf"
-)
-
-# Check files
-for((i=0; i < ${#required_files[@]}; ++i)); do
- if [ ! -f "${required_files[$i]}" ]; then
- echo "$0:$LINENO: Cannot find ${required_files[$i]}"
- exit 1
- fi
-done
-
-################################################################################
-# Sign the tarballs
-################################################################################
-tput bold; echo ">>> A.R.T. tarballs"; tput sgr0
-
-archs=(
- "./downloads/kspectrum$1.tgz"
- "./downloads/kdistribution_light$2.tgz"
- "./downloads/hr_ppart.tgz"
- "./downloads/ppart_lw.tgz"
- "./downloads/ppart_sw.tgz"
- "./downloads/karine$3.tgz"
-)
-
-sign_something=0
-for((i=0; i < ${#archs[@]}; ++i)); do
- if [ ! -f "${archs[$i]}.sig" ]; then
- echo "Sign ${archs[$i]}"
- gpg -a -o ${archs[$i]}.sig --detach-sign ${archs[$i]}
- sign_something=1
- fi
-done
-
-if [ $sign_something == 0 ]; then
- echo "Nothing to do"
-fi
-
-echo ""
-
-################################################################################
-# Generate the Kspectrum page
-################################################################################
-tput bold; echo ">>> A.R.T. web pages"; tput sgr0
-
-echo "Write art.html"
-{
- print_header ART Overview
- cat art.html.in
- print_footer
-} > art.html
-
-echo "Write kspectrum.html"
-{
- print_header ART Kspectrum
- VERSION=$1 envsubst < kspectrum.html.in
- print_footer
-} > kspectrum.html
-
-echo "Write kdistribution.html"
-{
- print_header ART Kdistribution
- VERSION=$2 envsubst < kdistribution.html.in
- print_footer
-} > kdistribution.html
-
-echo "Write hr_ppart.html"
-{
- print_header ART HR_PPart
- cat hr_ppart.html.in
- print_footer
-} > hr_ppart.html
-
-echo "Write ppart_lw.html"
-{
- print_header ART PPart_LW
- cat ppart_lw.html.in
- print_footer
-} > ppart_lw.html
-
-echo "Write ppart_sw.html"
-{
- print_header ART PPart_SW
- cat ppart_sw.html.in
- print_footer
-} > ppart_sw.html
-
-echo "Write karine.html"
-{
- print_header ART Karine
- VERSION=$3 envsubst < karine.html.in
- print_footer
-} > karine.html
-
diff --git a/art/art_build.sh b/art/art_build.sh
@@ -0,0 +1,84 @@
+#!/bin/sh -e
+
+# Copyright (C) 2019-2021 |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
+
+overview()
+{
+ print_header ART Overview
+ cat art.html.in
+ print_footer
+}
+
+kspectrum()
+{
+ if [ $# -lt 1 ]; then
+ printf "Usage: %s kspectrum <version>\n" "$0" >&2
+ exit 1
+ fi
+
+ print_header ART Kspectrum
+ VERSION="$1" envsubst < kspectrum.html.in
+ print_footer
+}
+
+kdistribution()
+{
+ if [ $# -lt 1 ]; then
+ printf "Usage: %s kdistribution <version>\n" "$0" >&2
+ exit 1
+ fi
+
+ print_header ART Kdistribution
+ VERSION="$1" envsubst < kdistribution.html.in
+ print_footer
+}
+
+hr_ppart()
+{
+ print_header ART HR_PPart
+ cat hr_ppart.html.in
+ print_footer
+}
+
+ppart_lw()
+{
+ print_header ART PPart_LW
+ cat ppart_lw.html.in
+ print_footer
+}
+
+ppart_sw()
+{
+ print_header ART PPart_SW
+ cat ppart_sw.html.in
+ print_footer
+}
+
+karine()
+{
+ if [ $# -lt 1 ]; then
+ printf "Usage: %s karine <version>\n" "$0" >&2
+ exit 1
+ fi
+
+ print_header ART Karine
+ VERSION="$1" envsubst < karine.html.in
+ print_footer
+}
+
+"$@"