meso-web

Sources of the |Méso|Star> website
git clone git://git.meso-star.fr/meso-web.git
Log | Files | Refs | README | LICENSE

commit c4f0eeedbfb21f932e271f08545cee86c4b561ab
parent 16ac0f05fd661f0a7e2fa4d3f0c68ba7123d058f
Author: Vincent Forest <vincent.forest@meso-star.com>
Date:   Wed, 23 Feb 2022 11:27:00 +0100

star-engine: full rewrite of the build process

Use POSIX shell/make

Diffstat:
M.gitignore | 10----------
Astar-engine/.gitignore | 11+++++++++++
Mstar-engine/Makefile | 238+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------------
Dstar-engine/star-engine.sh | 163-------------------------------------------------------------------------------
Mstar-engine/star-vx.html.in | 2+-
Astar-engine/star_engine_build.sh | 118+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
6 files changed, 334 insertions(+), 208 deletions(-)

diff --git a/.gitignore b/.gitignore @@ -1,13 +1,3 @@ -star-engine.html -star-engine-downloads.html -star-engine-release-notes.html.in -star-2d.html -star-3d.html -star-geom.html -star-sf.html -star-sp.html -star-uvm.html -star-vx.html .htaccess *.sw[po] *.[ao] diff --git a/star-engine/.gitignore b/star-engine/.gitignore @@ -0,0 +1,11 @@ +star-engine.html +star-engine-downloads.html +star-engine-release-notes.html.in +star-2d.html +star-3d.html +star-geom.html +star-sf.html +star-sp.html +star-uvm.html +star-vx.html +Star-Engine-*-GNU-Linux64/ diff --git a/star-engine/Makefile b/star-engine/Makefile @@ -12,41 +12,211 @@ # # 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: -STAR-ENGINE-VERSION=0.14.0 -STAR-ENGINE-README=~/code/star-engine/README.md - -SRC = star-engine.sh star-engine.html.in - -.PHONY: all clean default publish -default: all - -all: ${SRC} - @bash star-engine.sh $(STAR-ENGINE-VERSION) $(STAR-ENGINE-README) - -publish: - rsync -avzr \ - star-engine.html \ - star-engine-downloads.html \ - star-2d.html \ - star-3d.html \ - star-geom.html \ - star-sf.html \ - star-sp.html \ - star-uvm.html \ - star-vx.html \ - downloads \ - octree.jpg \ - polar.svg \ - cumulative.svg \ - super_shape.jpg \ - foam.jpg \ - ${REMOTE}/star-engine/ +include ../config.mk + +STAR_ENGINE_VERSION=0.14.0 +STAR_ENGINE_DIR=Star-Engine-$(STAR_ENGINE_VERSION)-GNU-Linux64 +STAR_ENGINE_ARCH=downloads/$(STAR_ENGINE_DIR).tar.gz + +STAR_2D_HEADER=$(STAR_ENGINE_DIR)/include/star/s2d_version.h +STAR_3D_HEADER=$(STAR_ENGINE_DIR)/include/star/s3d_version.h +STAR_SP_HEADER=$(STAR_ENGINE_DIR)/include/star/ssp_version.h +STAR_SF_HEADER=$(STAR_ENGINE_DIR)/include/star/ssf_version.h +STAR_VX_HEADER=$(STAR_ENGINE_DIR)/include/star/svx_version.h +STAR_UVM_HEADER=$(STAR_ENGINE_DIR)/include/star/suvm_version.h +STAR_GEOM_HEADER=\ + $(STAR_ENGINE_DIR)/include/aw_version.h\ + $(STAR_ENGINE_DIR)/include/star/s3daw_version.h\ + $(STAR_ENGINE_DIR)/include/star/s3dstl_version.h\ + $(STAR_ENGINE_DIR)/include/star/s3dut_version.h\ + $(STAR_ENGINE_DIR)/include/star/sstl_version.h +STAR_ENGINE_HEADERS=\ + $(STAR_2D_HEADER)\ + $(STAR_3D_HEADER)\ + $(STAR_SP_HEADER)\ + $(STAR_SF_HEADER)\ + $(STAR_VX_HEADER)\ + $(STAR_UVM_HEADER)\ + $(STAR_GEOM_HEADER) + +STAR_2D_README=$(STAR_ENGINE_DIR)/share/doc/star-2d/README.md +STAR_3D_README=$(STAR_ENGINE_DIR)/share/doc/star-3d/README.md +STAR_SP_README=$(STAR_ENGINE_DIR)/share/doc/star-sp/README.md +STAR_SF_README=$(STAR_ENGINE_DIR)/share/doc/star-sf/README.md +STAR_VX_README=$(STAR_ENGINE_DIR)/share/doc/star-vx/README.md +STAR_UVM_README=$(STAR_ENGINE_DIR)/share/doc/star-uvm/README.md +STAR_ENGINE_READMES=\ + $(STAR_2D_README)\ + $(STAR_3D_README)\ + $(STAR_SP_README)\ + $(STAR_SF_README)\ + $(STAR_VX_README)\ + $(STAR_UVM_README) + +STAR_ENGINE_PKG=\ + downloads/Star-Engine-0.14.0-Sources.zip\ + downloads/Star-Engine-0.14.0-GNU-Linux64.tar.gz\ + downloads/Star-Engine-0.13.0-Sources.zip\ + downloads/Star-Engine-0.13.0-GNU-Linux64.tar.gz\ + downloads/Star-Engine-0.12.0-Sources.zip\ + downloads/Star-Engine-0.12.0-GNU-Linux64.tar.gz\ + downloads/Star-Engine-0.11.0-Sources.zip\ + downloads/Star-Engine-0.11.0-GNU-Linux64.tar.gz\ + downloads/Star-Engine-0.10.0-Sources.zip\ + downloads/Star-Engine-0.10.0-GNU-Linux64.tar.gz\ + downloads/Star-Engine-0.9.0-Sources.zip\ + downloads/Star-Engine-0.9.0-GNU-Linux64.tar.gz\ + downloads/Star-Engine-0.8.1-Win64.zip\ + downloads/Star-Engine-0.8.1-Sources.zip\ + downloads/Star-Engine-0.8.1-GNU-Linux64.tar.gz\ + downloads/Star-Engine-0.8.0-Win64.zip\ + downloads/Star-Engine-0.8.0-Sources.zip\ + downloads/Star-Engine-0.8.0-GNU-Linux64.tar.gz\ + downloads/Star-Engine-0.7.0-Sources.zip\ + downloads/Star-Engine-0.7.0-GNU-Linux64.tar.gz\ + downloads/Star-Engine-0.6.0-Win64.zip\ + downloads/Star-Engine-0.6.0-Sources.zip\ + downloads/Star-Engine-0.6.0-GNU-Linux64.tar.gz\ + downloads/Star-Engine-0.5.1-Win64.zip\ + downloads/Star-Engine-0.5.1-Sources.zip\ + downloads/Star-Engine-0.5.1-GNU-Linux64.tar.gz +STAR_ENGINE_SIG=$(STAR_ENGINE_PKG:=.sig) + +IMG=\ + foam.jpg\ + cumulative.svg\ + polar.svg\ + octree.jpg\ + super_shape.jpg + +HTML=\ + star-engine.html\ + star-engine-downloads.html\ + star-2d.html\ + star-3d.html\ + star-sp.html\ + star-sf.html\ + star-vx.html\ + star-uvm.html\ + star-geom.html + +build: .sig + @$(MAKE) -fMakefile -f .sig build_all + +build_all: $(HTML) clean: - rm \ - star-engine.html \ - star-engine-downloads.html \ - star-engine-release-notes.html.in \ - downloads/*.sig + rm -f $(HTML) $(HTML:=.err) + +distclean: clean + rm -f $(STAR_ENGINE_SIG) + +publish: build + rsync -avzrR --delete-after \ + $(HTML)\ + $(IMG)\ + $(STAR_ENGINE_PKG)\ + $(STAR_ENGINE_SIG)\ + $(REMOTE)/star-engine/ + +star_engine_build.sh: ../meso-menu.sh + @touch "$@" + +################################################################################ +# html +################################################################################ +star-engine.html: star-engine.html.in star_engine_build.sh Makefile + @echo "Building $@" + @sh star_engine_build.sh overview $(STAR_ENGINE_VERSION) > $@ + +star-engine-downloads.html: $(STAR_ENGINE_SIG) star_engine_build.sh + @echo "Building $@" + @sh star_engine_build.sh downloads > $@ + +star-2d.html:\ + star-2d.html.in\ + $(STAR_2D_HEADER)\ + $(STAR_2D_README)\ + star_engine_build.sh + @echo "Building $@" + @sh star_engine_build.sh component Star-2D $(STAR_2D_README) $(STAR_2D_HEADER) > $@ + +star-3d.html:\ + star-3d.html.in\ + $(STAR_3D_HEADER)\ + $(STAR_3D_README)\ + star_engine_build.sh\ + foam.jpg + @echo "Building $@" + @sh star_engine_build.sh component Star-3D $(STAR_3D_README) $(STAR_3D_HEADER) > $@ + +star-sp.html:\ + star-sp.html.in\ + $(STAR_SP_HEADER)\ + $(STAR_SP_README)\ + star_engine_build.sh \ + cumulative.svg + @echo "Building $@" + @sh star_engine_build.sh component Star-SP $(STAR_SP_README) $(STAR_SP_HEADER) > $@ + +star-sf.html:\ + star-sf.html.in\ + $(STAR_SF_HEADER)\ + $(STAR_SF_README)\ + star_engine_build.sh\ + polar.svg + @echo "Building $@" + @sh star_engine_build.sh component Star-SF $(STAR_SF_README) $(STAR_SF_HEADER) > $@ + +star-vx.html:\ + star-vx.html.in\ + $(STAR_VX_HEADER)\ + $(STAR_VX_README)\ + star_engine_build.sh\ + octree.jpg + @echo "Building $@" + @sh star_engine_build.sh component Star-VX $(STAR_VX_README) $(STAR_VX_HEADER) > $@ + +star-uvm.html:\ + star-uvm.html.in\ + $(STAR_UVM_HEADER)\ + $(STAR_2D_README)\ + star_engine_build.sh + @echo "Building $@" + @sh star_engine_build.sh component Star-UVM $(STAR_UVM_README) $(STAR_UVM_HEADER) > $@ + +star-geom.html:\ + star-geom.html.in\ + $(STAR_GEOM_HEADER)\ + star_engine_build.sh\ + super_shape.jpg + @echo "Building $@" + @sh star_engine_build.sh star_geom $(STAR_GEOM_HEADER) > $@ + +$(STAR_ENGINE_HEADERS) $(STAR_ENGINE_READMES): + @echo "Extracting data from $(STAR_ENGINE_ARCH)" + @tar -xz -f $(STAR_ENGINE_ARCH) $(STAR_ENGINE_HEADERS) $(STAR_ENGINE_READMES) + +################################################################################ +# Check files +################################################################################ +check: build .chk + @$(MAKE) -fMakefile -f .chk check_all + +check_all: check_shells $(HTML:=.chk) + +check_shells: + @echo "Checking star_engine_build.sh" && shellcheck -o all -x star_engine_build.sh + +################################################################################ +# Miscellaneous targets +################################################################################ +.sig: Makefile ../configure_targets.sh + @echo "Setup .sig" + @sh ../configure_targets.sh sig $(STAR_ENGINE_PKG) > .sig +.chk: Makefile ../configure_targets.sh + @echo "Setup .chk" + @sh ../configure_targets.sh chk $(HTML) > .chk diff --git a/star-engine/star-engine.sh b/star-engine/star-engine.sh @@ -1,163 +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 2 ]; then - echo "Usage: $0 VERSION STAR-ENGINE-README" - exit 1 -fi - -if [ ! -f "./downloads/Star-Engine-$1-GNU-Linux64.tar.gz" ]; then - echo "Cannot find Star-Engine-$1-GNU-Linux64.tar.gz" - exit 1 -fi - -if [ ! -f "$2" ]; then - echo "Cannot find $2" - exit 1 -fi - -dir_curr=$(pwd) # Current directory -dir_temp=$(mktemp -d) # Working directory - -################################################################################ -# Sign the package -################################################################################ -tput bold; echo ">>> Star-Engine packages"; tput sgr0 -archs=$(find downloads -regex "^.*/Star-Engine-[0-9]+\.[0-9]+\.[0-9]+-.*zip" \ - -o -regex "^.*/Star-Engine-[0-9]+\.[0-9]+\.[0-9]+-.*tar.gz") - -sign_something=0 -for arch in $archs; do - if [ ! -f $arch.sig ]; then - echo "Sign $arch" - gpg -a -o $arch.sig --detach-sign $arch - sign_something=1 - fi -done - -if [ $sign_something == 0 ]; then - echo "Nothing to do" -fi - -echo "" - -################################################################################ -# Genrate the HTML code of the star-engine release notes -################################################################################ -tput bold; echo ">>> Star-Engine web pages"; tput sgr0 -echo "Generate the release notes" -$markdown $2 \ - | sed '/^<h2>Release notes<\/h2>/,$!d' \ - | sed '/^<h2>Licenses<\/h2>/,$d' \ - > star-engine-release-notes.html.in - -################################################################################ -# Extract the current archive -################################################################################ -cd $dir_temp -arch=Star-Engine-$1-GNU-Linux64 -cp "$dir_curr/downloads/$arch.tar.gz" . -tar xzf $arch.tar.gz -cd $dir_curr - -################################################################################ -# Generate the overview page -################################################################################ -unset win -if [ -f downloads/Star-Engine-$1-Win64.zip ]; then - win="<li>Windows: \ -<a href="downloads/Star-Engine-$1-Win64.zip">zip</a> / \ -<a href="downloads/Star-Engine-$1-Win64.zip.sig">pgp</a></li></ul><ul>" -fi - -echo "Write star-engine.html" -{ - print_header Star-Engine Overview - WINDOWS=$(echo $win) VERSION=$1 envsubst < star-engine.html.in - print_footer -} > star-engine.html - -################################################################################ -# Generate the components pages -################################################################################ -components=( - "Star-2D star/s2d_version.h" - "Star-3D star/s3d_version.h" - "Star-SP star/ssp_version.h" - "Star-SF star/ssf_version.h" - "Star-UVM star/suvm_version.h" - "Star-VX star/svx_version.h") - -print_version() { - local header=$1 - local major=$(cat $dir_temp/$arch/include/$header | sed -n 's/.*MAJOR \(.*\)$/\1/1p') - local minor=$(cat $dir_temp/$arch/include/$header | sed -n 's/.*MINOR \(.*\)$/\1/1p') - local patch=$(cat $dir_temp/$arch/include/$header | sed -n 's/.*PATCH \(.*\)$/\1/1p') - [[ $patch == "0" ]] && echo $major.$minor || echo $major.$minor.$patch -} - -for ((i=0; i< ${#components[@]}; ++i)); do - entry=(${components[$i]}) - entry_low=$(echo ${entry[0]} | tr '[:upper:]' '[:lower:]') - - release_notes=$($markdown $dir_temp/$arch/share/doc/$entry_low/README.md \ - | sed '/^<h2>Release notes<\/h2>/,$!d' \ - | sed 's/opyright (C)/opyright \&#169;/g') - version=$(print_version ${entry[1]}) - - echo "Write $entry_low.html" - { - print_header Star-Engine ${entry[0]} - VERSION=$version RELEASE_NOTES="$release_notes" LICENSE='$licence' envsubst < $entry_low.html.in; - print_footer - } > $entry_low.html -done - - -aw_version=$(print_version aw_version.h) -s3daw_version=$(print_version star/s3daw_version.h) -s3dstl_version=$(print_version star/s3dstl_version.h) -s3dut_version=$(print_version star/s3dut_version.h) -sstl_version=$(print_version star/sstl_version.h) - -echo "Write star-geom.html" -{ - print_header Star-Engine Star-Geom - AW_VERSION=$aw_version \ - S3DAW_VERSION=$s3daw_version \ - S3DSTL_VERSION=$s3dstl_version \ - S3DUT_VERSION=$s3dut_version \ - SSTL_VERSION=$sstl_version \ - envsubst < star-geom.html.in; - print_footer -} > star-geom.html - -################################################################################ -# Generate the Downloads page -################################################################################ -echo "Write star-engine-downloads.html" -{ - print_header Star-Engine Downloads; - echo '<header><h1>Download Star-Engine</h1></header>'; - print_downloads Star-Engine; - cat star-engine-release-notes.html.in; - print_footer; -} > star-engine-downloads.html; diff --git a/star-engine/star-vx.html.in b/star-engine/star-vx.html.in @@ -37,7 +37,7 @@ the leaf (the user data) to the root of the tree. </div> -The policies used to merge input data as well as the merge operator itself are +<p>The policies used to merge input data as well as the merge operator itself are defined by the caller; Star-VoXel settles for building the hierarchical structure only.</p> diff --git a/star-engine/star_engine_build.sh b/star-engine/star_engine_build.sh @@ -0,0 +1,118 @@ +#!/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() +{ + if [ $# -lt 1 ]; then + printf "Usage: %s overview <version>\n" "$0" + exit 1 + fi + + unset win + if [ -f "downloads/Star-Engine-$1-Win64.zip" ]; then + win="<li>Windows: \ + <a href=\"downloads/Star-Engine-$1-Win64.zip\">zip</a> / \ + <a href=\"downloads/Star-Engine-$1-Win64.zip.sig\">pgp</a></li></ul><ul>" + fi + + print_header Star-Engine Overview + WINDOWS="${win}" VERSION="$1" envsubst < star-engine.html.in + print_footer +} + +downloads() +{ + print_header Star-Engine Downloads; + echo '<header><h1>Download Star-Engine</h1></header>'; + print_downloads Star-Engine + print_footer +} + +header_version() +{ + header=$1 + major=$(sed -n 's/.*MAJOR \(.*\)$/\1/1p' < "${header}") + minor=$(sed -n 's/.*MINOR \(.*\)$/\1/1p' < "${header}") + patch=$(sed -n 's/.*PATCH \(.*\)$/\1/1p' < "${header}") + [ "${patch}" = "0" ] && echo "${major}.${minor}" || echo "${major}.${minor}.${patch}" +} + +component() +{ + if [ $# -lt 3 ]; then + printf "Usage: %s component <section> <readme> <header>\n" "$0" + exit 1 + fi + + section_lower=$(echo "$1" | tr "[:upper:]" "[:lower:]") + + release_notes=$(${markdown} "$2" \ + | sed -n '/^<h2>Release notes<\/h2>/,$p' \ + | sed 's/opyright (C)/opyright \&#169;/g') + + print_header Star-Engine "$1" + + VERSION=$(header_version "$3") \ + RELEASE_NOTES="${release_notes}" \ + envsubst < "${section_lower}.html.in" + + print_footer +} + +star_geom() +{ + if [ $# -lt 5 ]; then + printf "Usage: %s star_geom <aw_version.h> <s3daw_version.h> \ + <s3dstl_version.h> <s3dut_version.h> <sstl_version.h>\n" "$0" + exit 1 + fi + + unset aw_version s3daw_version s3dstl_version s3dut_version sstl_version + for i in "$@"; do + case "${i}" in + *s3daw_version\.h) s3daw_version=$(header_version "${i}") ;; + *aw_version\.h) aw_version=$(header_version "${i}") ;; + *s3dstl_version\.h) s3dstl_version=$(header_version "${i}") ;; + *s3dut_version\.h) s3dut_version=$(header_version "${i}") ;; + *sstl_version\.h) sstl_version=$(header_version "${i}") ;; + *) printf "%s:star_geom: invalid argument \"%s\"" "$0" "${i}" >&2 ;; + esac + done + + if [ -z "${aw_version}" ] \ + || [ -z "${s3daw_version}" ] \ + || [ -z "${s3dstl_version}" ] \ + || [ -z "${s3dut_version}" ] \ + || [ -z "${sstl_version}" ]; then + printf "%s:star_geom: some submitted headers are invalid " "${0}" + echo "$@" + exit 1 + fi + + print_header Star-Engine Star-Geom + AW_VERSION="${aw_version}" \ + S3DAW_VERSION="${s3daw_version}" \ + S3DSTL_VERSION="${s3dstl_version}" \ + S3DUT_VERSION="${s3dut_version}" \ + SSTL_VERSION="${sstl_version}" \ + envsubst < star-geom.html.in; + print_footer +} + +"$@"