star-build

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

commit 44aa105bd30d5af2c1404d413c65d6568e5c73e7
parent e00e5729661ab9d81fc9cc7c96075f8441da1289
Author: Vincent Forest <vincent.forest@meso-star.com>
Date:   Tue, 30 Jul 2024 14:49:20 +0200

Add the tbb 2021.13.0 build script

Make Embree dependent on this handmade TBB when installed from source,
so that TBB is no longer a system prerequisite for compiling Embree
locally.

Diffstat:
Mlint.mk | 1+
Msrc/embree4.mk.in | 7++++---
Msrc/embree_4.0.1.sh | 2++
Asrc/tbb.mk.in | 75+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Asrc/tbb_2021.13.0.sh | 26++++++++++++++++++++++++++
5 files changed, 108 insertions(+), 3 deletions(-)

diff --git a/lint.mk b/lint.mk @@ -74,3 +74,4 @@ lint: shellcheck -o all -x -P src src/stardis-green_0.5.1.sh shellcheck -o all -x -P src src/stardis-solver_0.15.2.sh shellcheck -o all -x -P src src/stardis-solver_0.16.sh + shellcheck -o all -x -P src src/tbb_2021.13.0.sh diff --git a/src/embree4.mk.in b/src/embree4.mk.in @@ -82,9 +82,10 @@ embree4: build_embree4 prefix $(EMBREE_DIR)/embree4.pc cp -P $(EMBREE_INC) "$${prefix}/include/embree4/" && \ cp -P $(EMBREE_DOC) "$${prefix}/share/doc/embree4/" -build_embree4: $(EMBREE_DIR) - @cd -- $(EMBREE_DIR)/build && \ - cmake $(EMBREE_CMAKE_OPTIONS) .. && \ +build_embree4: $(EMBREE_DIR) prefix tbb + @prefix=$$(cat .prefix) && \ + cd -- $(EMBREE_DIR)/build && \ + cmake $(EMBREE_CMAKE_OPTIONS) -DTBB_DIR="$${prefix}/lib/cmake/TBB" .. && \ $(MAKE) $(EMBREE_DIR)/embree4.pc: $(EMBREE_DIR) prefix diff --git a/src/embree_4.0.1.sh b/src/embree_4.0.1.sh @@ -28,6 +28,8 @@ fi # Install from sources if [ -z "${EMBREE_BINDIST}" ] || [ "${EMBREE_BINDIST}" -eq 0 ]; then + . "tbb_2021.13.0.sh" + version=4.0.1 tag="v${version}" sed -e "s/@TAG@/${tag}/" \ diff --git a/src/tbb.mk.in b/src/tbb.mk.in @@ -0,0 +1,75 @@ +# Copyright (C) 2023, 2024 |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 +TBB_TAG = @TAG@ +TBB_URL_ONLINE = https://github.com/oneapi-src/oneTBB +TBB_URL_OFFLINE = $(MIRROR)/oneTBB +TBB_URL = $(TBB_URL_$(NETWORK)) + +# Helper macros +TBB_DIR = $(CACHE)/TBB/$(TBB_TAG) +TBB_CMAKE_OPTIONS =\ + -G "Unix Makefiles"\ + -DCMAKE_BUILD_TYPE=Release\ + -DCMAKE_INSTALL_LIBDIR="lib"\ + -DTBB_BUILD=ON\ + -DTBB_DISABLE_HWLOC_AUTOMATIC_SEARCH=ON\ + -DTBBMALLOC_BUILD=ON\ + -DTBBMALLOC_PROXY_BUILD=OFF\ + -DTBB_TEST=OFF + +tbb: build_tbb prefix + prefix="$$(cat .prefix)" && \ + cd -- $(TBB_DIR)/build && \ + cmake -DCMAKE_INSTALL_PREFIX="$${prefix}" .. && \ + make install + +build_tbb: $(TBB_DIR) + @cd -- $(TBB_DIR)/build && \ + cmake $(TBB_CMAKE_OPTIONS) .. && \ + $(MAKE) + +$(TBB_DIR): + git clone --branch $(TBB_TAG) --depth 1 $(TBB_URL) "$@" + mkdir -p "$@/build" + +clean_tbb: + if [ -d $(TBB_DIR)/build ]; then \ + cd -- $(TBB_DIR)/build && $(MAKE) clean; \ + fi + +uninstall_tbb: prefix + @prefix=$$(cat .prefix) && \ + cd -- "$(TBB_DIR)/build" && \ + cmake -DCMAKE_INSTALL_PREFIX="$${prefix}" .. && \ + $(MAKE) install + xargs rm -f < "$(TBB_DIR)/build/install_manifest.txt" + +distclean_tbb: + rm -rf $(TBB_DIR) + +mirror_tbb: + repo="$$(echo $(TBB_URL) | sed 's/[\/]\{0,\}$$//g')" && \ + repo="$(MIRROR)/$${repo##*/}" && \ + rm -rf "$${repo}" && \ + git clone --bare --branch $(TBB_TAG) $(MIRROR_GIT_OPT) \ + $(TBB_URL) "$${repo}" + +clean_all: clean_tbb +distclean_all: distclean_tbb +install_all: tbb +uninstall_all: uninstall_tbb +mirror_all: mirror_tbb diff --git a/src/tbb_2021.13.0.sh b/src/tbb_2021.13.0.sh @@ -0,0 +1,26 @@ +#!/bin/sh + +# Copyright (C) 2023, 2024 |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/>. + +set -e + +[ -n "${TBB_SH}" ] && return +export TBB_SH=1 + +. "build.sh" + +tag="v2021.13.0" +sed -e "s/@TAG@/${tag}/" src/tbb.mk.in