commit e7300715171b5b327785e5d94a1b47b8e059f8f1
parent ccae20d62fcc4e033956fc56e7d44c4ea635134c
Author: Vincent Forest <vincent.forest@meso-star.com>
Date: Fri, 18 Feb 2022 15:58:44 +0100
stardis: full rewrite of the build process
Use POSIX make/shell
Diffstat:
4 files changed, 355 insertions(+), 32 deletions(-)
diff --git a/stardis/.gitignore b/stardis/.gitignore
@@ -0,0 +1,8 @@
+stardis.html
+stardis-downloads.html
+starter-pack.html
+stardis-release-notes.html.in
+stardis-solver-release-notes.html.in
+stardis-green-release-notes.html.in
+Stardis-*-GNU-Linux64/
+Stardis-Starter-Pack-*/
diff --git a/stardis/Makefile b/stardis/Makefile
@@ -1,4 +1,4 @@
-# Copyright (C) 2017-2021 |Meso|Star> (contact@meso-star.com)
+# Copyright (C) 2019-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
@@ -12,36 +12,192 @@
#
# 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:
-STARDIS-VERSION=0.12.3
-STARDIS-STARTER-PACK-VERSION=0.1.0
-
-SRC = stardis.html.in
-IMG = \
- city.jpg \
- edf_logo.svg \
- foam.jpg \
- foam_path.jpg \
- heatsink.jpg \
- heatsinkx50.jpg \
- heatsink_anim.gif \
- heatsink_anim_thumb.gif \
- IR_animation_1080x720x32x128.gif \
- IR_animation_1080x720x32x128_thumb.gif \
- IR_city_640x480x1024_273-275.png \
- IR_rendering_1080x720x128.jpg \
- pulse.svg \
- sin.svg \
- step.svg
-
-.PHONY: all clean default publish
-default: all
-
-all: ${SRC}
- @bash stardis.sh ${STARDIS-VERSION} ${STARDIS-STARTER-PACK-VERSION}
+include ../config.mk
+
+STARDIS_VERSION=0.12.3
+STARTER_PACK_VERSION=0.1.0
+
+STARDIS_DIR=Stardis-$(STARDIS_VERSION)-GNU-Linux64
+STARDIS_ARCH=downloads/$(STARDIS_DIR).tar.gz
+STARDIS_README=$(STARDIS_DIR)/share/doc/stardis/README.md
+STARDIS_GREEN_README=$(STARDIS_DIR)/share/doc/sgreen/README.md
+STARDIS_SOLVER_README=$(STARDIS_DIR)/share/doc/stardis-solver/README.md
+STARDIS_PKG=\
+ ./downloads/Stardis-0.11.0-r1-Sources.tar.gz\
+ ./downloads/Stardis-0.11.0-r1-GNU-Linux64.tar.gz\
+ ./downloads/Stardis-0.12.3-Sources.tar.gz\
+ ./downloads/Stardis-0.12.3-GNU-Linux64.tar.gz
+STARDIS_SIG=$(STARDIS_PKG:=.sig)
+
+STARTER_PACK_DIR=Stardis-Starter-Pack-$(STARTER_PACK_VERSION)
+STARTER_PACK_ARCH=downloads/$(STARTER_PACK_DIR).tar.gz
+STARTER_PACK_README=$(STARTER_PACK_DIR)/README.md
+STARTER_PACK_PKG=\
+ ./downloads/Stardis-Starter-Pack-0.1.0.tar.gz\
+ ./downloads/Stardis-Starter-Pack-0.0.0.tar.gz
+STARTER_PACK_SIG=$(STARTER_PACK_PKG:=.sig)
+
+MAN=\
+ $(STARDIS_DIR)/share/man/man1/stardis.1\
+ $(STARDIS_DIR)/share/man/man5/stardis-input.5\
+ $(STARDIS_DIR)/share/man/man5/stardis-output.5\
+ $(STARDIS_DIR)/share/man/man1/sgreen.1\
+ $(STARDIS_DIR)/share/man/man5/sgreen-input.5\
+ $(STARDIS_DIR)/share/man/man5/sgreen-output.5
+STARDIS_ARCH_FILES=\
+ $(STARDIS_README)\
+ $(STARDIS_GREEN_README)\
+ $(STARDIS_SOLVER_README)\
+ $(MAN)
+
+OVERVIEW_IMG=\
+ foam_path.jpg\
+ heatsink_anim.gif\
+ heatsink_anim_thumb.gif\
+ pulse.svg\
+ sin.svg\
+ step.svg
+
+STARTER_PACK_IMG=\
+ city.jpg\
+ foam.jpg\
+ heatsink.jpg\
+ heatsinkx50.jpg\
+ IR_rendering_1080x720x128.jpg\
+ IR_animation_1080x720x32x128.gif\
+ IR_animation_1080x720x32x128_thumb.gif\
+ IR_city_640x480x1024_273.png
+
+HTML=\
+ consortium-fr.html\
+ consortium-en.html\
+ stardis.html\
+ stardis-downloads.html\
+ starter-pack.html
+
+build: .sig .man
+ @$(MAKE) -fMakefile -f .sig -f .man build_all
+
+build_all: $(HTML) man
clean:
- rm stardis.html
+ rm -rf man \
+ rm -f .sig .man .chk \
+ stardis-release-notes.html.in \
+ stardis-green-release-notes.html.in \
+ stardis-solver-release-notes.html.in \
+ $(HTML) \
+ $(HTML:=.err)
publish:
- rsync -avz consortium-*.html stardis.html stardis-downloads.html starter-pack.html ${IMG} downloads man ${REMOTE}/stardis/
+ rsync -avzr \
+ $(HTML) \
+ $(OVERVIEW_IMG) \
+ $(STARTER_PACK_IMG) \
+ downloads \
+ man \
+ $(REMOTE)/stardis/
+
+distclean: clean
+ rm -f \
+ $(STARDIS_SIG)\
+ $(STARTER_PACK_SIG) \
+ $(STARDIS_ARCH_FILES) \
+ $(STARTER_PACK_README)
+
+################################################################################
+# Stardis web page
+################################################################################
+stardis.html: \
+ stardis.html.in \
+ $(OVERVIEW_IMG) \
+ stardis_build.sh \
+ ../meso-menu.sh \
+ Makefile
+ @echo "Building $@"
+ @sh stardis_build.sh overview $(STARDIS_VERSION)
+
+################################################################################
+# Consortium web pages
+################################################################################
+consortium-fr.html: consortium-fr.html.in edf_logo.svg stardis_build.sh
+ @echo "Building $@"
+ @sh stardis_build.sh consortium fr
+
+consortium-en.html: consortium-en.html.in edf_logo.svg stardis_build.sh
+ @echo "Building $@"
+ @sh stardis_build.sh consortium en
+
+################################################################################
+# Download web pages
+################################################################################
+stardis-downloads.html: $(STARDIS_SIG)\
+ stardis-release-notes.html.in \
+ stardis-green-release-notes.html.in \
+ stardis-solver-release-notes.html.in \
+ stardis_build.sh \
+ ../meso-menu.sh
+ @echo "Building $@"
+ @sh stardis_build.sh downloads
+
+stardis-release-notes.html.in: $(STARDIS_README)
+ @$(MARKDOWN) $(STARDIS_README) \
+ | sed -n '/^<h2>Release notes<\/h2>/,/^<h2>License<\/h2>/p' \
+ | sed -e '1d' -e '$$d' > $@
+
+stardis-green-release-notes.html.in: $(STARDIS_GREEN_README)
+ @$(MARKDOWN) $(STARDIS_GREEN_README) \
+ | sed -n '/^<h2>Release notes<\/h2>/,/^<h2>License<\/h2>/p' \
+ | sed -e '1d' -e '$$d' > $@
+
+stardis-solver-release-notes.html.in: $(STARDIS_SOLVER_README)
+ @$(MARKDOWN) $(STARDIS_SOLVER_README) \
+ | sed -n '/^<h2>Release notes<\/h2>/,/^<h2>License<\/h2>/p' \
+ | sed -e '1d' -e '$$d' > $@
+
+$(STARDIS_ARCH_FILES):
+ @echo "Extracting data from $(STARDIS_ARCH)"
+ @tar -xz -f $(STARDIS_ARCH) $(STARDIS_ARCH_FILES)
+
+################################################################################
+# Starter pack web pages
+################################################################################
+starter-pack.html: $(STARTER_PACK_SIG)\
+ $(STARTER_PACK_README)\
+ stardis_build.sh\
+ ../meso-menu.sh\
+ Makefile
+ @echo "Building $@"
+ @sh stardis_build.sh starter_pack $(STARTER_PACK_README) $(STARTER_PACK_VERSION)
+
+$(STARTER_PACK_README):
+ @echo "Extracting data from $(STARTER_PACK_ARCH)"
+ @tar -xz -f $(STARTER_PACK_ARCH) $(STARTER_PACK_README)
+
+################################################################################
+# Check files
+################################################################################
+check: build .chk .sig .man
+ @$(MAKE) -fMakefile -f .chk -f .sig -f .man check_all
+
+check_all: check_shells $(HTML:=.chk)
+
+check_shells:
+ @echo "Checking stardis_build.sh" && shellcheck -o all -x stardis_build.sh
+
+################################################################################
+# Miscellaneous targets
+################################################################################
+.sig: Makefile ../configure_targets.sh
+ @echo "Setup .sig"
+ @sh ../configure_targets.sh sig $(STARDIS_PKG) $(STARTER_PACK_PKG) > .sig
+
+.chk: Makefile ../configure_targets.sh
+ @echo "Setup .chk"
+ @sh ../configure_targets.sh chk $(HTML) > .chk
+
+.man: Makefile ../configure_targets.sh
+ @echo "Setup .man"
+ @sh ../configure_targets.sh man Stardis $(STARDIS_VERSION) $(MAN) > .man
diff --git a/stardis/stardis.html.in b/stardis/stardis.html.in
@@ -48,7 +48,7 @@ the complete source code according to their needs.</p>
<p>Despite its specific advantages, Stardis is not meant to fully replace
already well established and highly validated thermal simulation tools.
Instead, it can be seen as an additional tool that can be useful for various
-purposes:<p>
+purposes:</p>
<ul>
<li><b>Probe computation</b>: Stardis will <u>not</u> compute the full
@@ -96,7 +96,7 @@ href="#cli">Stardis application</a>, a command line tool that can be seen as a
reference implementation of a complete workflow relying on Stardis-Solver, from
input data describing the system to simulate (geometry, thermal properties,
limit conditions, <i>etc.</i>) to heat transfer simulation and results
-post-processing. See below for more information on each of these components.<p>
+post-processing. See below for more information on each of these components.</p>
<h2 id="solver">Stardis-Solver</h2>
@@ -118,7 +118,7 @@ the thermal properties and the limit/boundary conditions, only the geometry
defining the contours of the objects is necessary.</p>
<p>The Stardis-Solver library is currently used in the two following
-projects:<p>
+projects:</p>
<ul>
<li><a href="#cli">Stardis application</a> is the reference implementation of a
diff --git a/stardis/stardis_build.sh b/stardis/stardis_build.sh
@@ -0,0 +1,159 @@
+#!/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
+
+overview()
+{
+ if [ $# -lt 1 ]; then
+ printf "Usage: %s overview <version>\n" "$0" >&2
+ exit 1
+ fi
+
+ {
+ print_header Stardis Overview
+ VERSION=$1 envsubst < stardis.html.in
+ print_footer
+ } > stardis.html
+}
+
+consortium()
+{
+ if [ $# -lt 1 ]; then
+ printf "Usage: %s consortium <fr|en>\n" "$0" >&2
+ exit 1
+ fi
+
+ {
+ print_header Stardis Consortium "$1"
+ cat "consortium-$1.html.in"
+ print_footer
+ } > "consortium-$1.html"
+}
+
+downloads()
+{
+ {
+ print_header Stardis Downloads
+ echo '<header><h1>Download Stardis</h1></header>'
+
+ echo "<p>The proposed archives contain precompiled version of the <a"
+ echo "href=\"https://gitlab.com/meso-star/stardis-solver.git\">Stardis-Solver</a>"
+ echo "library and of the <a href=\"./man/man1/stardis.1.html\">stardis</a>"
+ echo "and <a href=\"./man/man1/sgreen.1.html\">sgreen</a> command line"
+ echo "tools. Refer below for their associated release notes. The version of"
+ echo "the archive corresponds to the version number of the Stardis-Solver"
+ echo "library packaged into the archive.</p>"
+
+ print_downloads Stardis "Linux"
+ echo "<h2>Stardis-Solver Library release notes</h2>"
+ cat stardis-solver-release-notes.html.in
+ echo "<h2>Stardis CLI release notes</h2>"
+ cat stardis-release-notes.html.in
+ echo "<h2>Stardis-Green CLI release notes</h2>"
+ cat stardis-green-release-notes.html.in
+ print_footer
+} > stardis-downloads.html
+}
+
+starter_pack()
+{
+ if [ $# -lt 1 ]; then
+ printf "Usage: %s starter_pack <README> <VERSION>\n" "$0" >&2
+ exit 1
+ fi
+
+ readme=$(${markdown} "$1")
+ intro=$(echo "${readme}" \
+ | sed '/^<h2>Content<\/h2>/,$d' \
+ | sed '1d')
+ content1=$(echo "${readme}" \
+ | sed -n '/^<h2>Content<\/h2>/,/^<h3>The porous medium<\/h3>/p' \
+ | sed -e '1d' -e '$d')
+ content2=$(echo "${readme}" \
+ | sed -n '/^<h3>The porous medium<\/h3>/,/^<h2>Copyright notice<\/h2>/p' \
+ | sed '$d')
+ license=$(echo "${readme}" \
+ | sed -n '/^<h2>Copyright notice<\/h2>/,$p' \
+ | sed 's/opyright (C)/opyright \©/g')
+
+ {
+ print_header Stardis Starter-Pack
+
+ echo "<header>"
+ echo " <h1>Stardis: Starter Pack</h1>"
+ echo "</header>"
+ echo "<div class=\"news\">"
+ echo " <p><b>Stardis: Starter Pack $2</b></p>"
+ echo " <ul>"
+ echo " <li><a href=\"downloads/Stardis-Starter-Pack-$2.tar.gz\">tarball</a> /"
+ echo " <a href=\"downloads/Stardis-Starter-Pack-$2.tar.gz.sig\">pgp</a></li>"
+ echo " </ul>"
+ echo "</div>"
+
+ echo "${intro}"
+
+ echo "<h2>Content</h2>"
+ echo "<div class=\"img\" style=\"padding-top:3em; width: 17em\">"
+ echo " <a href=\"heatsink.jpg\"><img src=\"heatsink.jpg\" alt=\"heatsink\"></a>"
+ echo " <a href=\"heatsinkx50.jpg\"><img src=\"heatsinkx50.jpg\" alt=\"heatsinkx50\"></a>"
+ echo " <a href=\"foam.jpg\"><img src=\"foam.jpg\" alt=\"foam\"></a>"
+ echo " <a href=\"city.jpg\"><img src=\"city.jpg\" alt=\"city\"></a>"
+ echo " <div class=\"caption\">"
+ echo " Geometries of the heatsink, the multiple heatsinks, the foam, and the city"
+ echo " provided by the Starter Pack and used in its examples."
+ echo " </div>"
+ echo "</div>"
+
+ echo "${content1}"
+
+ echo "<div class=\"img\" style=\"padding-top:3em; width: 16em\">"
+ echo " <a href=\"IR_rendering_1080x720x128.jpg\">"
+ echo " <img src=\"IR_rendering_1080x720x128.jpg\" alt=\"foam_ir\">"
+ echo " </a>"
+ echo " <a href=\"IR_animation_1080x720x32x128.gif\">"
+ echo " <img src=\"IR_animation_1080x720x32x128_thumb.gif\" alt=\"foam_anim\">"
+ echo " </a>"
+ echo " <div class=\"caption\">"
+ echo " Illustration of the infrared rendering of the porous example. The"
+ echo " color map displays the temperature in Kelvin."
+ echo " The bottom animation was produced by a simple"
+ echo " rotation of the camera around the center of the foam."
+ echo " Each one of the 32 frames is a full image produced by"
+ echo " a Stardis run."
+ echo " </div>"
+ echo "</div>"
+
+ echo "<div class=\"img\" style=\"padding-top:3em; width: 16em\">"
+ echo " <a href=\"IR_city_640x480x1024_273-275.png\">"
+ echo " <img src=\"IR_city_640x480x1024_273-275.png\" alt=\"city_ir\">"
+ echo " </a>"
+ echo " <div class=\"caption\">"
+ echo " The infrared rendering of the city example. The color map displays the"
+ echo " temperature in Kelvin. The image consists of 640x480 independent"
+ echo " Monte-Carlo estimates (one per pixel, 1024 paths each)."
+ echo " </div>"
+ echo "</div>"
+
+ echo "${content2}"
+ echo "${license}"
+
+ print_footer
+ } > starter-pack.html
+}
+
+"$@"