star-build

Automation tool for project installation
git clone git://git.meso-star.fr/star-build.git
Log | Files | Refs | README | LICENSE

commit 23479c9081913e03fec6b29ead8ae91072f01402
parent 59452cd431a8619deea02b34e0f1a3f36ab37a9c
Author: Vincent Forest <vincent.forest@meso-star.com>
Date:   Tue, 25 Jul 2023 10:12:35 +0200

Extensive refactoring and rewrite

Each project has its own script, which is in fact a build file in
itself. As a result, each project can be installed using the usual
star-build procedure. For example, to install noweb, you can directly
run "make BUILD=src/noweb_<VERSION>.sh" instead of juggling with the sgs
compilation targets, which also declare a noweb build.

All the sources has been moved to the "src" directory. Some projects
were also added since the last commit, such as a the star-engine that
currently only build a very small subset of its projects

Each build file can be suffixed with the project version. This means
that several build files from the same project can coexist. Files
without this suffix are not versioned and should be treated with
caution: they are likely to follow a development branch that may be
updated at any time, which, in the worst case, could completely break
the compilation of the project.

The dependencies of a build are simply managed by using the dot utility
to include the scripts on which the compilation depends. One of the
advantages of this architecture is that the build directives for a
project can be shared with all the builds that depend on it. In this
way, 'meta-build' projects such as sgs or star-engine are reduced to the
inclusion directives of the projects to be built. Note that specific
shell directives are added to the scripts' headers to ensure that they
are only included once per build. This is the shell translation of the C
language trick of using macros to protect headers from being included
several times in the same compilation unit.

The way build requirements are handled has also been completely
rewritten in light of previous changes, to ensure that the build's
Makefile reflects the latest updates. The prereq.sh script generates the
Makefile directive which, for an input shell script (i.e. a build file),
lists its prerequisites by recursively following the files included by
the dot utility. In other words, it does for a POSIX shell script what
GCC's '-M' option does for C files. Also, the build files explicitly
print additional prerequisites that cannot be automatically inferred by
the prereq.sh script, such as the template files on which they are
based.

Finally, the lint.mk file includes shellcheck commands that check the
syntax of shell scripts, whether they are build files or utility
scripts. It will define a large number of shellcheck commands, in fact
at least one per version of projects to be built, a list that will have
to grow. We therefore place them in a separate file to prevent the
Makefile from swelling over time.

Diffstat:
M.gitignore | 4+++-
MMakefile | 42+++++++++++++++++++++++++++---------------
Dbuild.sh | 66------------------------------------------------------------------
Mconfig.mk | 2+-
Alint.mk | 31+++++++++++++++++++++++++++++++
Dnoweb.mk | 67-------------------------------------------------------------------
Dprofile.mk.in | 16----------------
Dsgs.sh | 73-------------------------------------------------------------------------
Dsleef.mk | 67-------------------------------------------------------------------
Asrc/aw.sh | 32++++++++++++++++++++++++++++++++
Rbuild.profile.in -> src/build.profile.in | 0
Asrc/build.sh | 81+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Asrc/embree_4.0.1.sh | 25+++++++++++++++++++++++++
Rgit.mk.in -> src/git.mk.in | 0
Asrc/noweb.mk.in | 67+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Asrc/noweb_2.13rc3.sh | 27+++++++++++++++++++++++++++
Asrc/polygon.sh | 32++++++++++++++++++++++++++++++++
Asrc/prereq.sh | 50++++++++++++++++++++++++++++++++++++++++++++++++++
Asrc/profile.mk.in | 16++++++++++++++++
Asrc/random123_1.14.0.sh | 25+++++++++++++++++++++++++
Asrc/rsimd.sh | 33+++++++++++++++++++++++++++++++++
Asrc/rsys.sh | 30++++++++++++++++++++++++++++++
Asrc/sgs.sh | 32++++++++++++++++++++++++++++++++
Asrc/sleef.mk.in | 67+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Asrc/sleef_3.5.2-r0.sh | 27+++++++++++++++++++++++++++
Rspkg.mk.in -> src/spkg.mk.in | 0
Asrc/star-3d.sh | 33+++++++++++++++++++++++++++++++++
Asrc/star-engine.sh | 24++++++++++++++++++++++++
Asrc/star-mc.sh | 30++++++++++++++++++++++++++++++
Asrc/star-sp.sh | 30++++++++++++++++++++++++++++++
30 files changed, 723 insertions(+), 306 deletions(-)

diff --git a/.gitignore b/.gitignore @@ -7,4 +7,6 @@ build.mk local */ -sgs.mk +!src/ +*.sh.mk +*.sh.d diff --git a/Makefile b/Makefile @@ -18,28 +18,40 @@ include config.mk -MK = $(BUILD:.sh=.mk) +MK = $(BUILD).mk +DEP = $(BUILD).d -install: $(MK) - @$(MAKE) -f $(MK) -f Makefile install_all +install: $(MK) $(DEP) + @$(MAKE) -f $(DEP) -f $(MK) -f Makefile install_all -clean: $(MK) - @$(MAKE) -f $(MK) -f Makefile clean_all - rm -rf .prefix $(MK) +clean: $(MK) $(DEP) + @$(MAKE) -f $(DEP) -f $(MK) -f Makefile clean_all + rm -rf .prefix $(MK) $(DEP) -distclean: $(MK) - @$(MAKE) -f $(MK) -f Makefile distclean_all - rm -rf .prefix $(MK) +distclean: $(MK) $(DEP) + @$(MAKE) -f $(DEP) -f $(MK) -f Makefile distclean_all + rm -rf .prefix src/*.sh.d src/*.sh.mk -uninstall: $(MK) - @$(MAKE) -f $(MK) -f Makefile uninstall_all +uninstall: $(MK) $(DEP) + @$(MAKE) -f $(DEP) -f $(MK) -f Makefile uninstall_all -$(MK): $(BUILD) build.sh build.profile.in spkg.mk.in git.mk.in noweb.mk - @$(SHELL) $(BUILD) > $@ +# Generate the dependencies target of the build +$(DEP): $(BUILD) src/prereq.sh + @echo "Setup $@" + @PATH="src:$${PATH}" $(SHELL) src/prereq.sh "$(MK) $(DEP)" $(BUILD) > $@ + +# Generate the Makefile of the build +$(MK): $(BUILD) src/build.sh + @echo "Setup $@" + @PATH="src:$${PATH}" $(SHELL) $(BUILD) > $@ + +# Update the build timestamp to force regeneration of its Makefile when its +# prerequistes are updated +$(BUILD): + @touch $(BUILD) prefix: @# store in .prefix the absolute prefix path @(p=$$(echo $(PREFIX)) && mkdir -p -- "$${p}" && cd -- "$${p}" && pwd) > .prefix -lint: - shellcheck -o all build.sh $(BUILD) +include lint.mk diff --git a/build.sh b/build.sh @@ -1,66 +0,0 @@ -#!/bin/sh -e - -# Copyright (C) 2023 |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/>. - -# Generate the targets for a git repository. The input variables are: -# - name : the name of the target (required) -# - url : the URL of the git repository (required) -# - tag : the tag/branch/commit to use (required) -# - dep : name of the targets on which this build depends (optional) -# - opt : the options passed when invoking make (optional) -git_repo() -{ - sed\ - -e "s#@NAME@#${name}#g"\ - -e "s#@URL@#${url}#g"\ - -e "s#@TAG@#${tag}#g"\ - -e "s#@DEP@#${dep}#g"\ - -e "s#@OPT@#${opt}#g"\ - git.mk.in - - # Reset variables - name="" - url="" - tag="" - dep="" - opt="" -} - -# Generate the targets for a Star-PKG binary. The input variables are: -# - name: the name of the target (required) -# - url: the URL of the package (required) -bin_spkg() -{ - arch="${url##*/}" - arch="${arch%.*}" - path="${url%/*}" - - sed\ - -e "s#@NAME@#${name}#g"\ - -e "s#@ARCH@#${arch}#g"\ - -e "s#@PATH@#${path}#g"\ - spkg.mk.in - - # Reset variables - name="" - url="" -} - -# Generate the targets of a profile -profile() -{ - sed -e "s#@NAME@#$1#g" profile.mk.in -} diff --git a/config.mk b/config.mk @@ -22,4 +22,4 @@ REPO_BIN = https://www.meso-star.com/packages/v0.4/ REPO_VAPLV = https://gitlab.com/vaplv # Build configuration -BUILD = sgs.sh +BUILD = src/sgs.sh diff --git a/lint.mk b/lint.mk @@ -0,0 +1,31 @@ +# Copyright (C) 2023 |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/>. + +lint: + shellcheck -o all -x -P src src/aw.sh + shellcheck -o all -x -P src src/build.sh + shellcheck -o all -x -P src src/embree_4.0.1.sh + shellcheck -o all -x -P src src/noweb_2.13rc3.sh + shellcheck -o all -x -P src src/polygon.sh + shellcheck -o all -x -P src src/prereq.sh + shellcheck -o all -x -P src src/random123_1.14.0.sh + shellcheck -o all -x -P src src/rsimd.sh + shellcheck -o all -x -P src src/rsys.sh + shellcheck -o all -x -P src src/sgs.sh + shellcheck -o all -x -P src src/sleef_3.5.2-r0.sh + shellcheck -o all -x -P src src/star-3d.sh + shellcheck -o all -x -P src src/star-engine.sh + shellcheck -o all -x -P src src/star-mc.sh + shellcheck -o all -x -P src src/star-sp.sh diff --git a/noweb.mk b/noweb.mk @@ -1,67 +0,0 @@ -# Copyright (C) 2023 |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/>. - -# Configuration macros -NOWEB_TAG=092ecb7 -NOWEB_URL=https://github.com/nrnrnr/noweb - -# Helper macros -NOWEB_DIR=noweb/$(NOWEB_TAG) -NOWEB_MAKE=$(MAKE)\ - BIN="$${prefix}/bin"\ - LIB="$${prefix}/lib"\ - MAN="$${prefix}/share/man"\ - TEXINPUTS="$${prefix}/share/tex/"\ - ELISP=/dev/null - -noweb: build_noweb - @prefix=$$(cat .prefix) &&\ - cd -- "$(NOWEB_DIR)/src" &&\ - $(NOWEB_MAKE) install - -build_noweb: fetch_noweb prefix - @prefix=$$(cat .prefix) &&\ - cd -- "$(NOWEB_DIR)/src" &&\ - ./awkname awk &&\ - $(NOWEB_MAKE) boot &&\ - $(NOWEB_MAKE) all - -$(NOWEB_DIR): - @git clone $(NOWEB_URL) "$@" - -fetch_noweb: $(NOWEB_DIR) - @cd -- "$(NOWEB_DIR)" &&\ - git fetch origin &&\ - git checkout -B star-build &&\ - git reset --hard $(NOWEB_TAG) - -clean_noweb: - if [ -d "$(NOWEB_DIR)/src" ]; then\ - cd -- "$(NOWEB_DIR)/src" && make clean;\ - fi - -uninstall_noweb: fetch_noweb prefix - @prefix=$$(cat .prefix) &&\ - cd -- "$(NOWEB_DIR)/src" &&\ - $(NOWEB_MAKE) uninstall &&\ - rm -f "$${prefix}/lib/nwmktemp" - -distclean_noweb: - rm -rf noweb - -clean_all: clean_noweb -distclean_all: distclean_noweb -install_all: noweb -uninstall_all: uninstall_noweb diff --git a/profile.mk.in b/profile.mk.in @@ -1,16 +0,0 @@ -@NAME@: build.profile.in prefix - sed "s#@PREFIX@#$$(cat .prefix)#g" build.profile.in > $@ - -install_@NAME@: @NAME@ - mkdir -p "$$(cat .prefix)/etc" - cp @NAME@ "$$(cat .prefix)/etc" - -uninstall_@NAME@: prefix - rm -f "$$(cat .prefix)/etc/@NAME@" - -clean_@NAME@: - rm -f @NAME@ - -clean_all: clean_@NAME@ -install_all: install_@NAME@ -uninstall_all: uninstall_@NAME@ diff --git a/sgs.sh b/sgs.sh @@ -1,73 +0,0 @@ -#!/bin/sh -e - -# Copyright (C) 2023 |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/>. - -. "./build.sh" - -# Build for the dependencies of the Star Geometric Sensitivity project - -[ -z "${BUILD_TYPE}" ] && BUILD_TYPE="RELEASE" - -################################################################################ -# Setup make directives for git repositories -################################################################################ -name="rsys" -url="$\(REPO_VAPLV\)/rsys.git" -tag="origin/feature_posix_make" -opt="BUILD_TYPE=${BUILD_TYPE}" -git_repo - -name="star-3d" -url="$\(REPO\)/star-3d.git" -tag="origin/feature_posix_make" -dep="rsys embree4" -opt="BUILD_TYPE=${BUILD_TYPE}" -git_repo - -name="star-sp" -url="$\(REPO\)/star-sp.git" -tag="origin/feature_posix_make" -dep="random123 rsys" -opt="BUILD_TYPE=${BUILD_TYPE}" -git_repo - -name="star-mc" -url="$\(REPO\)/star-mc.git" -tag="origin/feature_posix_make" -dep="star-sp rsys" -opt="BUILD_TYPE=${BUILD_TYPE}" -git_repo - -################################################################################ -# Setup build directives for Star-PKG binaries -################################################################################ -name="embree4" -url="$\(REPO_BIN\)/embree_4.0.1_gnu_linux64.tgz" -bin_spkg - -name="random123" -url="$\(REPO_BIN\)/Random123_1.14.0_gnu_linux64.tgz" -bin_spkg - -################################################################################ -# Concatenate additionnal Makefiles -################################################################################ -cat noweb.mk - -################################################################################ -# Setup make directives for the profile file -################################################################################ -profile sgs.profile diff --git a/sleef.mk b/sleef.mk @@ -1,67 +0,0 @@ -# Copyright (C) 2023 |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/>. - -# Configuration macros -SLEEF_TAG = 85440a5e87dae36ca1b891de14bc83b441ae7c43 -SLEEF_URL = https://github.com/shibatch/sleef - -# Helper macros -SLEEF_DIR = sleef/$(SLEEF_TAG) -SLEEF_CMAKE_OPTIONS =\ - -G "Unix Makefiles"\ - -DBUILD_TESTS=OFF\ - -DCMAKE_BUILD_TYPE=Release\ - -DCMAKE_INSTALL_LIBDIR=lib - -sleef: build_sleef prefix - @prefix=$$(cat .prefix) &&\ - cd -- "$(SLEEF_DIR)/build" &&\ - cmake -DCMAKE_INSTALL_PREFIX="$${prefix}" .. > /dev/null 2>&1 &&\ - make install - -build_sleef: fetch_sleef - @cd -- "$(SLEEF_DIR)/build" &&\ - cmake $(SLEEF_CMAKE_OPTIONS) .. &&\ - make - -$(SLEEF_DIR): - @git clone $(SLEEF_URL) "$@" - @mkdir -p "$@/build" - -fetch_sleef: $(SLEEF_DIR) - @cd -- "$(SLEEF_DIR)" &&\ - git fetch origin &&\ - git checkout -B star-build &&\ - git reset --hard $(SLEEF_TAG) - -clean_sleef: - if [ -d "$(SLEEF_DIR)/build" ]; then\ - cd -- "$(SLEEF_DIR)/build" && make clean;\ - fi - -uninstall_sleef: fetch_sleef prefix - @prefix=$$(cat .prefix) &&\ - cd -- "$(SLEEF_DIR)/build" &&\ - cmake -DCMAKE_INSTALL_PREFIX="$${prefix}" .. &&\ - make install - xargs rm -f < $(SLEEF_DIR)/build/install_manifest.txt - -distclean_sleef: - rm -rf sleef - -clean_all: clean_sleef -distclean_all: distclean_sleef -install_all: sleef -uninstall_all: uninstall_sleef diff --git a/src/aw.sh b/src/aw.sh @@ -0,0 +1,32 @@ +#!/bin/sh -e + +# Copyright (C) 2023 |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/>. + +[ -n "${AW_SH}" ] && return +export AW_SH=1 + +. "build.sh" +. "rsys.sh" + +[ -z "${BUILD_TYPE}" ] && BUILD_TYPE="RELEASE" +[ -z "${LIB_TYPE}" ] && LIB_TYPE="SHARED" + +name="aw" +url="$\(REPO_VAPLV\)/loader_aw.git" +tag="origin/feature_posix_make" +dep="rsys" +opt="BUILD_TYPE=${BUILD_TYPE} LIB_TYPE=${LIB_TYPE}" +git_repo diff --git a/build.profile.in b/src/build.profile.in diff --git a/src/build.sh b/src/build.sh @@ -0,0 +1,81 @@ +#!/bin/sh -e + +# Copyright (C) 2023 |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/>. + +[ -n "${BUILD_SH}" ] && return +export BUILD_SH=1 + +# Generate the targets for a git repository. The input variables are: +# - name : the name of the target (required) +# - url : the URL of the git repository (required) +# - tag : the tag/branch/commit to use (required) +# - dep : name of the targets on which this build depends (optional) +# - opt : the options passed when invoking make (optional) +git_repo() +{ + sed \ + -e "s#@NAME@#${name}#g" \ + -e "s#@URL@#${url}#g" \ + -e "s#@TAG@#${tag}#g" \ + -e "s#@DEP@#${dep}#g" \ + -e "s#@OPT@#${opt}#g" \ + "src/git.mk.in" + + # Add the template file as a prerequisite for the script invoked + # i.e. the build file + printf "%s: src/git.mk.in\n" "$0" + + # Reset variables + name="" + url="" + tag="" + dep="" + opt="" +} + +# Generate the targets for a Star-PKG binary. The input variables are: +# - name: the name of the target (required) +# - url: the URL of the package (required) +bin_spkg() +{ + arch="${url##*/}" + arch="${arch%.*}" + path="${url%/*}" + + sed \ + -e "s#@NAME@#${name}#g" \ + -e "s#@ARCH@#${arch}#g" \ + -e "s#@PATH@#${path}#g" \ + "src/spkg.mk.in" + + # Add the template file as a prerequisite for the script invoked + # i.e. the build file + printf "%s: src/spkg.mk.in\n" "$0" + + # Reset variables + name="" + url="" +} + +# Generate the targets of a profile +profile() +{ + sed -e "s#@NAME@#$1#g" "src/profile.mk.in" + + # Add the template file as a prerequisite for the script invoked + # i.e. the build file + printf "%s: src/profile.mk.in\n" "$0" +} diff --git a/src/embree_4.0.1.sh b/src/embree_4.0.1.sh @@ -0,0 +1,25 @@ +#!/bin/sh -e + +# Copyright (C) 2023 |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/>. + +[ -n "${EMBREE_SH}" ] && return +export EMBREE_SH=1 + +. "build.sh" + +name="embree4" +url="$\(REPO_BIN\)/embree_4.0.1_gnu_linux64.tgz" +bin_spkg diff --git a/git.mk.in b/src/git.mk.in diff --git a/src/noweb.mk.in b/src/noweb.mk.in @@ -0,0 +1,67 @@ +# Copyright (C) 2023 |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/>. + +# Configuration macros +NOWEB_TAG=@TAG@ +NOWEB_URL=https://github.com/nrnrnr/noweb + +# Helper macros +NOWEB_DIR=noweb/$(NOWEB_TAG) +NOWEB_MAKE=$(MAKE)\ + BIN="$${prefix}/bin"\ + LIB="$${prefix}/lib"\ + MAN="$${prefix}/share/man"\ + TEXINPUTS="$${prefix}/share/tex/"\ + ELISP=/dev/null + +noweb: build_noweb + @prefix=$$(cat .prefix) &&\ + cd -- "$(NOWEB_DIR)/src" &&\ + $(NOWEB_MAKE) install + +build_noweb: fetch_noweb prefix + @prefix=$$(cat .prefix) &&\ + cd -- "$(NOWEB_DIR)/src" &&\ + ./awkname awk &&\ + $(NOWEB_MAKE) boot &&\ + $(NOWEB_MAKE) all + +$(NOWEB_DIR): + @git clone $(NOWEB_URL) "$@" + +fetch_noweb: $(NOWEB_DIR) + @cd -- "$(NOWEB_DIR)" &&\ + git fetch origin &&\ + git checkout -B star-build &&\ + git reset --hard $(NOWEB_TAG) + +clean_noweb: + if [ -d "$(NOWEB_DIR)/src" ]; then\ + cd -- "$(NOWEB_DIR)/src" && make clean;\ + fi + +uninstall_noweb: fetch_noweb prefix + @prefix=$$(cat .prefix) &&\ + cd -- "$(NOWEB_DIR)/src" &&\ + $(NOWEB_MAKE) uninstall &&\ + rm -f "$${prefix}/lib/nwmktemp" + +distclean_noweb: + rm -rf noweb + +clean_all: clean_noweb +distclean_all: distclean_noweb +install_all: noweb +uninstall_all: uninstall_noweb diff --git a/src/noweb_2.13rc3.sh b/src/noweb_2.13rc3.sh @@ -0,0 +1,27 @@ +#!/bin/sh -e + +# Copyright (C) 2023 |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/>. + +[ -n "${NOWEB_SH}" ] && return +export NOWEB_SH=1 + +tag=v2_13rc3 + +sed "s/@TAG@/${tag}/" "src/noweb.mk.in" + +# Add the template file as a prerequisite for the script invoked +# i.e. the build file +printf "%s: src/noweb.mk.in\n" "$0" diff --git a/src/polygon.sh b/src/polygon.sh @@ -0,0 +1,32 @@ +#!/bin/sh -e + +# Copyright (C) 2023 |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/>. + +[ -n "${POLYGON_SH}" ] && return +export POLYGON_SH=1 + +. "build.sh" +. "rsys.sh" + +[ -z "${BUILD_TYPE}" ] && BUILD_TYPE="RELEASE" +[ -z "${LIB_TYPE}" ] && LIB_TYPE="SHARED" + +name="polygon" +url="$\(REPO_VAPLV\)/polygon.git" +tag="origin/feature_posix_make" +dep="rsys" +opt="BUILD_TYPE=${BUILD_TYPE} LIB_TYPE=${LIB_TYPE}" +git_repo diff --git a/src/prereq.sh b/src/prereq.sh @@ -0,0 +1,50 @@ +#!/bin/sh -e + +# Copyright (C) 2023 |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/>. + +# Print the prerequisites of a shell submitted as argument. The scripts +# recursively looks for "dot" files and print their filename to standard +# output. +prereq() +{ + # The input shell is a prerequisite + printf ' %s \\\n' "$1" + + sed -n 's/^[[:space:]]\{0,\}\.[[:space:]]\{1,\}\([^[:space:]#]\)/\1/p' "$1" | \ + tr -d '"' | \ + while read -r i; do + paths=$(echo "${PATH}" | tr -s ":" " ") + + # Search for the "dot" file in PATH directories + # shellcheck disable=SC2086 + file=$(find ${paths} -name "${i}") + if [ -z "${file}" ]; then + >&2 printf "%s: file not found\n" "${i}" + exit 1 + fi + + printf ' %s \\\n' "${file}" + prereq "${file}" + done +} + +# Print the targets and add the shell file as their first prerequisite +printf '%s: \\\n' "$1" + +# Find the "dot" files, print them out once and clean up the unnecessary +# characters on the last line, such as the backslash and the spaces that +# precede it. +prereq "$2" | sort | uniq | sed '$s/[[:space:]]\{1,\}\\$//' diff --git a/src/profile.mk.in b/src/profile.mk.in @@ -0,0 +1,16 @@ +@NAME@: src/build.profile.in prefix + sed "s#@PREFIX@#$$(cat .prefix)#g" src/build.profile.in > $@ + +install_@NAME@: @NAME@ + mkdir -p "$$(cat .prefix)/etc" + cp @NAME@ "$$(cat .prefix)/etc" + +uninstall_@NAME@: prefix + rm -f "$$(cat .prefix)/etc/@NAME@" + +clean_@NAME@: + rm -f @NAME@ + +clean_all: clean_@NAME@ +install_all: install_@NAME@ +uninstall_all: uninstall_@NAME@ diff --git a/src/random123_1.14.0.sh b/src/random123_1.14.0.sh @@ -0,0 +1,25 @@ +#!/bin/sh -e + +# Copyright (C) 2023 |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/>. + +[ -n "${RANDOM1233_SH}" ] && return +export RANDOM123_SH=1 + +. "build.sh" + +name="random123" +url="$\(REPO_BIN\)/Random123_1.14.0_gnu_linux64.tgz" +bin_spkg diff --git a/src/rsimd.sh b/src/rsimd.sh @@ -0,0 +1,33 @@ +#!/bin/sh -e + +# Copyright (C) 2023 |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/>. + +[ -n "${RSIMD_SH}" ] && return +export RSIMD_SH=1 + +. "build.sh" +. "rsys.sh" +. "sleef_3.5.2-r0.sh" + +[ -z "${BUILD_TYPE}" ] && BUILD_TYPE="RELEASE" +[ -z "${LIB_TYPE}" ] && LIB_TYPE="SHARED" + +name="rsimd" +url="$\(REPO_VAPLV\)/rsimd.git" +tag="origin/feature_posix_make" +dep="rsys sleef" +opt="BUILD_TYPE=${BUILD_TYPE} LIB_TYPE=${LIB_TYPE}" +git_repo diff --git a/src/rsys.sh b/src/rsys.sh @@ -0,0 +1,30 @@ +#!/bin/sh -e + +# Copyright (C) 2023 |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/>. + +[ -n "${RSYS_SH}" ] && return +export RSYS_SH=1 + +. "build.sh" + +[ -z "${BUILD_TYPE}" ] && BUILD_TYPE="RELEASE" +[ -z "${LIB_TYPE}" ] && LIB_TYPE="SHARED" + +name="rsys" +url="$\(REPO_VAPLV\)/rsys.git" +tag="origin/feature_posix_make" +opt="BUILD_TYPE=${BUILD_TYPE} LIB_TYPE=${LIB_TYPE}" +git_repo diff --git a/src/sgs.sh b/src/sgs.sh @@ -0,0 +1,32 @@ +#!/bin/sh -e + +# Copyright (C) 2023 |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/>. + +# Build for the dependencies of the Star Geometric Sensitivity project + +[ -n "${SGS_SH}" ] && return +export SGS_SH=1 + +. "build.sh" + +. "noweb_2.13rc3.sh" +. "rsys.sh" +. "star-3d.sh" +. "star-sp.sh" +. "star-mc.sh" + +# Setup make directives for the profile file +profile sgs.profile diff --git a/src/sleef.mk.in b/src/sleef.mk.in @@ -0,0 +1,67 @@ +# Copyright (C) 2023 |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/>. + +# Configuration macros +SLEEF_TAG = @TAG@ +SLEEF_URL = https://github.com/shibatch/sleef + +# Helper macros +SLEEF_DIR = sleef/$(SLEEF_TAG) +SLEEF_CMAKE_OPTIONS =\ + -G "Unix Makefiles"\ + -DBUILD_TESTS=OFF\ + -DCMAKE_BUILD_TYPE=Release\ + -DCMAKE_INSTALL_LIBDIR=lib + +sleef: build_sleef prefix + @prefix=$$(cat .prefix) &&\ + cd -- "$(SLEEF_DIR)/build" &&\ + cmake -DCMAKE_INSTALL_PREFIX="$${prefix}" .. > /dev/null 2>&1 &&\ + make install + +build_sleef: fetch_sleef + @cd -- "$(SLEEF_DIR)/build" &&\ + cmake $(SLEEF_CMAKE_OPTIONS) .. &&\ + make + +$(SLEEF_DIR): + @git clone $(SLEEF_URL) "$@" + @mkdir -p "$@/build" + +fetch_sleef: $(SLEEF_DIR) + @cd -- "$(SLEEF_DIR)" &&\ + git fetch origin &&\ + git checkout -B star-build &&\ + git reset --hard $(SLEEF_TAG) + +clean_sleef: + if [ -d "$(SLEEF_DIR)/build" ]; then\ + cd -- "$(SLEEF_DIR)/build" && make clean;\ + fi + +uninstall_sleef: fetch_sleef prefix + @prefix=$$(cat .prefix) &&\ + cd -- "$(SLEEF_DIR)/build" &&\ + cmake -DCMAKE_INSTALL_PREFIX="$${prefix}" .. &&\ + make install + xargs rm -f < $(SLEEF_DIR)/build/install_manifest.txt + +distclean_sleef: + rm -rf sleef + +clean_all: clean_sleef +distclean_all: distclean_sleef +install_all: sleef +uninstall_all: uninstall_sleef diff --git a/src/sleef_3.5.2-r0.sh b/src/sleef_3.5.2-r0.sh @@ -0,0 +1,27 @@ +#!/bin/sh -e + +# Copyright (C) 2023 |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/>. + +[ -n "${SLEEF_SH}" ] && return +export SLEEF_SH=1 + +tag=85440a5e87dae36ca1b891de14bc83b441ae7c43 + +sed "s/@TAG@/${tag}/" "src/sleef.mk.in" + +# Add the template file as a prerequisite for the script invoked +# i.e. the build file +printf "%s: src/sleef.mk.in\n" "$0" diff --git a/spkg.mk.in b/src/spkg.mk.in diff --git a/src/star-3d.sh b/src/star-3d.sh @@ -0,0 +1,33 @@ +#!/bin/sh -e + +# Copyright (C) 2023 |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/>. + +[ -n "${STAR_3D_SH}" ] && return +export STAR_3D_SH=1 + +. "build.sh" +. "embree_4.0.1.sh" +. "rsys.sh" + +[ -z "${BUILD_TYPE}" ] && BUILD_TYPE="RELEASE" +[ -z "${LIB_TYPE}" ] && LIB_TYPE="SHARED" + +name="star-3d" +url="$\(REPO\)/star-3d.git" +tag="origin/feature_posix_make" +dep="rsys embree4" +opt="BUILD_TYPE=${BUILD_TYPE} LIB_TYPE=${LIB_TYPE}" +git_repo diff --git a/src/star-engine.sh b/src/star-engine.sh @@ -0,0 +1,24 @@ +#!/bin/sh -e + +# Copyright (C) 2023 |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/>. + +[ -n "${STAR_ENGINE_SH}" ] && return +export STAR_ENGINE_SH=1 + +. "aw.sh" +. "polygon.sh" +. "rsimd.sh" +. "rsys.sh" diff --git a/src/star-mc.sh b/src/star-mc.sh @@ -0,0 +1,30 @@ +#!/bin/sh -e + +# Copyright (C) 2023 |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/>. + +[ -n "${STAR_MC_SH}" ] && return +export STAR_MC_SH=1 + +. "build.sh" +. "rsys.sh" +. "star-sp.sh" + +name="star-mc" +url="$\(REPO\)/star-mc.git" +tag="origin/feature_posix_make" +dep="star-sp rsys" +opt="BUILD_TYPE=${BUILD_TYPE}" +git_repo diff --git a/src/star-sp.sh b/src/star-sp.sh @@ -0,0 +1,30 @@ +#!/bin/sh -e + +# Copyright (C) 2023 |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/>. + +[ -n "${STAR_SP_SH}" ] && return +export STAR_SP_SH=1 + +. "build.sh" +. "random123_1.14.0.sh" +. "rsys.sh" + +name="star-sp" +url="$\(REPO\)/star-sp.git" +tag="origin/feature_posix_make" +dep="random123 rsys" +opt="BUILD_TYPE=${BUILD_TYPE}" +git_repo