commit 6140902fce2fe9d206128a1c692ade81e840627e
parent edd06489591e8529a78b769b05296164cc026806
Author: Vincent Forest <vincent.forest@meso-star.com>
Date: Tue, 7 May 2024 15:21:22 +0200
random123: complete rewriting of the build script
It no longer depends on an external package. Instead, Random123 is now
installed directly from source, since nothing needs to be built. It's a
headers-only library that only requires files to be copied into the
right directory.
Diffstat:
2 files changed, 89 insertions(+), 4 deletions(-)
diff --git a/src/random123.mk.in b/src/random123.mk.in
@@ -0,0 +1,84 @@
+# 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
+RANDOM123_VERSION=@VERSION@
+RANDOM123_TAG=@TAG@
+RANDOM123_URL=https://github.com/DEShawResearch/random123
+
+# Helper macros
+RANDOM123_DIR=random123_$(RANDOM123_TAG)
+
+random123: $(RANDOM123_DIR) $(RANDOM123_DIR)/random123.pc.in
+ prefix="$$(cat .prefix)" && \
+ mkdir -p "$${prefix}/lib/pkgconfig" && \
+ mkdir -p "$${prefix}/share/doc/Random123" && \
+ cp -RP "$(RANDOM123_DIR)/include" "$${prefix}" && \
+ cp -L "$(RANDOM123_DIR)/LICENSE" "$${prefix}/share/doc/Random123" && \
+ sed "s#@PREFIX@#$${prefix}#" "$(RANDOM123_DIR)/random123.pc.in" \
+ > "$${prefix}/lib/pkgconfig/random123.pc"
+
+$(RANDOM123_DIR):
+ @git clone --branch "$(RANDOM123_TAG)" --depth 1 "$(RANDOM123_URL)" $@
+
+$(RANDOM123_DIR)/random123.pc.in:
+ @{ \
+ printf 'prefix=@PREFIX@\n' > "$@"; \
+ printf 'includedir=$${prefix}/include\n'; \
+ printf '\n'; \
+ printf 'Name: Random123\n'; \
+ printf 'Description: Counter-Based Random Number Generators\n'; \
+ printf 'Version: %s\n' "$(RANDOM123_VERSION)"; \
+ printf '\n'; \
+ printf 'Cflags: -I$${includedir}\n'; \
+ } > "$@"
+
+uninstall_random123:
+ prefix="$$(cat .prefix)" && \
+ rm -f "$${prefix}/include/Random123/aes.h" && \
+ rm -f "$${prefix}/include/Random123/array.h" && \
+ rm -f "$${prefix}/include/Random123/ars.h" && \
+ rm -f "$${prefix}/include/Random123/boxmuller.hpp" && \
+ rm -f "$${prefix}/include/Random123/conventional/Engine.hpp" && \
+ rm -f "$${prefix}/include/Random123/conventional/gsl_cbrng.h" && \
+ rm -f "$${prefix}/include/Random123/features/clangfeatures.h" && \
+ rm -f "$${prefix}/include/Random123/features/compilerfeatures.h" && \
+ rm -f "$${prefix}/include/Random123/features/gccfeatures.h" && \
+ rm -f "$${prefix}/include/Random123/features/iccfeatures.h" && \
+ rm -f "$${prefix}/include/Random123/features/metalfeatures.h" && \
+ rm -f "$${prefix}/include/Random123/features/msvcfeatures.h" && \
+ rm -f "$${prefix}/include/Random123/features/nvccfeatures.h" && \
+ rm -f "$${prefix}/include/Random123/features/open64features.h" && \
+ rm -f "$${prefix}/include/Random123/features/openclfeatures.h" && \
+ rm -f "$${prefix}/include/Random123/features/pgccfeatures.h" && \
+ rm -f "$${prefix}/include/Random123/features/sse.h" && \
+ rm -f "$${prefix}/include/Random123/features/sunprofeatures.h" && \
+ rm -f "$${prefix}/include/Random123/features/xlcfeatures.h" && \
+ rm -f "$${prefix}/include/Random123/gsl_microrng.h" && \
+ rm -f "$${prefix}/include/Random123/MicroURNG.hpp" && \
+ rm -f "$${prefix}/include/Random123/philox.h" && \
+ rm -f "$${prefix}/include/Random123/ReinterpretCtr.hpp" && \
+ rm -f "$${prefix}/include/Random123/threefry.h" && \
+ rm -f "$${prefix}/include/Random123/u01fixedpt.h" && \
+ rm -f "$${prefix}/include/Random123/uniform.hpp" && \
+ rm -f "$${prefix}/lib/pkgconfig/random123.pc" && \
+ rm -f "$${prefix}/share/doc/Random123/LICENSE"
+
+distclean_random123:
+ rm -rf random123_$(RANDOM123_TAG)
+
+distclean_all: distclean_random123
+install_all: random123
+uninstall_all: uninstall_random123
diff --git a/src/random123_1.14.0.sh b/src/random123_1.14.0.sh
@@ -20,8 +20,9 @@ set -e
[ -n "${RANDOM1233_SH}" ] && return
export RANDOM123_SH=1
-. "build.sh"
+version="1.14.0"
+tag="v${version}"
-name="random123"
-url="$\(REPO_BIN\)/Random123_1.14.0_gnu_linux64.tgz"
-bin_spkg
+sed -e "s/@TAG@/${tag}/" \
+ -e "s/@VERSION@/${version}/" \
+ "src/random123.mk.in"