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 1ad0147d28801fdd2a33e54793bc0aaef20409bc
parent d3a365e61e8030afb47cf7b7ff1790dce77fcda1
Author: Vincent Forest <vincent.forest@meso-star.com>
Date:   Tue, 22 Feb 2022 10:43:42 +0100

schiff: full rewrite of the build process

Use POSIX shell/make

Diffstat:
M.gitignore | 2--
Aschiff/.gitignore | 3+++
Mschiff/Makefile | 100++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++---------
Dschiff/schiff.sh | 134-------------------------------------------------------------------------------
Aschiff/schiff_build.sh | 50++++++++++++++++++++++++++++++++++++++++++++++++++
5 files changed, 142 insertions(+), 147 deletions(-)

diff --git a/.gitignore b/.gitignore @@ -6,8 +6,6 @@ kdistribution.html ppart_lw.html ppart_sw.html kspectrum.html -schiff.html -schiff-downloads.html about-en.html about-fr.html legal-en.html diff --git a/schiff/.gitignore b/schiff/.gitignore @@ -0,0 +1,3 @@ +schiff.html +schiff-downloads.html +Schiff-*-GNU-Linux64/ diff --git a/schiff/Makefile b/schiff/Makefile @@ -12,22 +12,100 @@ # # 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: -SCHIFF-VERSION=0.4.2 -SCHIFF-SCRIPTS=~/code/meso-star/schiff-scripts/src/ +include ../config.mk -SRC = schiff.html.in schiff.sh -IMG = particles.png +SCHIFF_VERSION=0.4.2 +SCHIFF_DIR=Schiff-$(SCHIFF_VERSION)-GNU-Linux64 +SCHIFF_ARCH=downloads/$(SCHIFF_DIR).tar.gz +SCHIFF_README=$(SCHIFF_DIR)/share/doc/schiff/README.md +SCHIFF_PKG=\ + downloads/Schiff-0.4.2-Sources.tar.gz\ + downloads/Schiff-0.4.2-GNU-Linux64.tar.gz\ + downloads/Schiff-0.4.1-Source.tar.gz\ + downloads/Schiff-0.4.1-GNU-Linux64.tar.gz\ + downloads/Schiff-0.4.0-Source.tar.gz\ + downloads/Schiff-0.4.0-GNU-Linux64.tar.gz\ + downloads/Schiff-0.3.1-Sources.tar.gz\ + downloads/Schiff-0.3.1-GNU-Linux64.tar.gz +SCHIFF_SIG=$(SCHIFF_PKG:=.sig) + +MAN=\ + $(SCHIFF_DIR)/share/man/man1/schiff.1\ + $(SCHIFF_DIR)/share/man/man5/schiff-geometry.5\ + $(SCHIFF_DIR)/share/man/man5/schiff-output.5 -.PHONY: all clean default publish -default: all +#SCHIFF-SCRIPTS=~/code/meso-star/schiff-scripts/src/ + +IMG = particles.png +HTML = schiff.html schiff-downloads.html -all: ${SRC} - @bash schiff.sh ${SCHIFF-VERSION} ${SCHIFF-SCRIPTS} +build: .sig .man + @$(MAKE) -fMakefile -f .sig -f .man build_all -publish: - rsync -avzr schiff.html schiff-downloads.html ${IMG} downloads man ${REMOTE}/schiff/ +build_all: $(HTML) man clean: - rm -rf schiff.html downloads/*.sig man + rm -rf man + rm -f .sig .chk .man $(HTML) + +distclean: clean + rm -f $(MAN) $(SCHIFF_README) $(SCHIFF_SIG) + +publish: build + rsync -avzrR --delete-after \ + downloads/schiff_pretty_results.sh\ + $(HTML)\ + $(IMG)\ + $$(find man -name "*.html")\ + $(SCHIFF_PKG)\ + $(SCHIFF_SIG)\ + $(REMOTE)/schiff/ + +schiff_build.sh: ../meso-menu.sh + @touch $@ + +################################################################################ +# Overview +################################################################################ +schiff.html: schiff.html.in $(IMG) schiff_build.sh + @echo "Building $@" + @sh schiff_build.sh overview $(SCHIFF_VERSION) > $@ + +################################################################################ +# Downloads +################################################################################ +schiff-downloads.html: $(SCHIFF_SIG) $(SCHIFF_README) schiff_build.sh + @echo "Building $@" + @sh schiff_build.sh downloads $(SCHIFF_README) > $@ + +$(SCHIFF_README) $(MAN): + @echo "Extracting data from $(SCHIFF_ARCH)" + @tar -xz -f $(SCHIFF_ARCH) $(SCHIFF_README) $(MAN) + +################################################################################ +# Check files +################################################################################ +check: build .chk .sig + @$(MAKE) -fMakefile -f .chk -f .sig check_all + +check_all: check_shells $(HTML:=.chk) + +check_shells: + @echo "Checking schiff_build.sh" && shellcheck -o all -x schiff_build.sh + +################################################################################ +# Miscellaneous +################################################################################ +.sig: Makefile ../configure_targets.sh + @echo "Setup .sig" + @sh ../configure_targets.sh sig $(SCHIFF_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 Schiff $(SCHIFF_VERSION) $(MAN) > .man diff --git a/schiff/schiff.sh b/schiff/schiff.sh @@ -1,134 +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 SCRIPTS-PATH" - exit 1 -fi - -if [ ! -f "./downloads/Schiff-$1-GNU-Linux64.tar.gz" ]; then - echo "Cannot find .//downloads/Schiff-$1-GNU-Linux64.tar.gz" - exit 1 -fi - -dir_curr=$(pwd) # Current directory -dir_temp=$(mktemp -d) # Working directory - -################################################################################ -# Sign the package -################################################################################ -tput bold; echo ">>> Schiff packages"; tput sgr0 -archs=$(find "./downloads" -regex "^.*/Schiff-[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 "" - -################################################################################ -# Extract the current archive -################################################################################ -cd $dir_temp -arch=Schiff-$1-GNU-Linux64 -cp "$dir_curr/downloads/$arch.tar.gz" . -tar xzf $arch.tar.gz -cd $dir_curr - -################################################################################ -# Generate the release note -################################################################################ -cd $dir_temp -release_notes=$($markdown $arch/share/doc/schiff/README.md \ - | sed '/^<h2>Release notes<\/h2>/,$!d' \ - | sed '/^<h2>License<\/h2>/,$d') -cd $dir_curr - -################################################################################ -# Copy the post-process script -################################################################################ -tput bold; echo ">>> Schiff Post-Processes"; tput sgr0 -do_something=0 -if [ ! -f "./downloads/schiff_pretty_results.sh" ]; then - echo "RSync $2/schiff_pretty_results.sh" - if [ ! -f "$2/schiff_pretty_results.sh" ]; then - echo "Cannot found $2/schiff_pretty_results.sh script." - exit 1 - fi - rsync $2/schiff_pretty_results.sh "./downloads/" -fi - -if [ $do_something == 0 ]; then - echo "Nothing to do" -fi - -echo "" - -################################################################################ -# Generate the overview page -################################################################################ -tput bold; echo ">>> Schiff web pages"; tput sgr0 -echo "Write schiff.html" -{ - print_header Schiff Overview - VERSION=$1 RELEASE_NOTES="$release_notes" envsubst < schiff.html.in; - print_footer -} > schiff.html - -# Generate the Downloads page -################################################################################ -echo "Write schiff-downloads.html" -{ - print_header Schiff Downloads; - echo '<header><h1>Download Schiff</h1></header>'; - - print_downloads Schiff "Linux"; - echo $release_notes - print_footer; -} > schiff-downloads.html; - - -################################################################################ -# Generate the reference documentation -################################################################################ -cd $dir_temp -arch=Schiff-$1-GNU-Linux64 -cp "$dir_curr/downloads/$arch.tar.gz" . -tar xzf $arch.tar.gz -cd $dir_curr - -for((i=0; i<${#schiff_man_pages[@]}; ++i)); do - entry=(${schiff_man_pages[$i]}) - man_name=${entry[0]} - man_num=${entry[1]} - man_path="$dir_temp/$arch/share/man/man${entry[1]}/$man_name.$man_num" - output="man/man${entry[1]}/$man_name.$man_num.html" - convert_man_page Schiff "$man_path" "$output" $1 -done diff --git a/schiff/schiff_build.sh b/schiff/schiff_build.sh @@ -0,0 +1,50 @@ +#!/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" >&2 + exit 1 + fi + + print_header Schiff Overview + VERSION=$1 envsubst < schiff.html.in + print_footer +} + +downloads() +{ + if [ $# -lt 1 ]; then + printf "Usage: %s downloads <readme>\n" "$0" >&2 + exit 1 + fi + + release_notes=$(${markdown} "$1" \ + | sed -n '/^<h2>Release notes<\/h2>/,/^<h2>License<\/h2>/p' | sed '$d') + + print_header Schiff Downloads + echo "<header><h1>Download Schiff</h1></header>" + + print_downloads Schiff "Linux" + echo "${release_notes}" + print_footer +} + +"$@"