From fb12125fd12c15eaf5986099bfc94a6bf476aa17 Mon Sep 17 00:00:00 2001 From: Paul Osmialowski Date: Tue, 14 Jan 2025 12:41:03 +0000 Subject: [PATCH] [ATfL] A script which generates modulefiles directory tree that could be pointed at with MODULEPATH This is a proof of concept script which generates a directory tree with modulefiles. It may be used later when the RPM and DEB post-install shell scripts are being implemented. Currently it can be used as such: In the ATfL tarball (as created by build.sh) a new directory called 'arm' is being created containing the mkmodulesdir.sh script. This script is being amended by build.sh in order to adjust the ATfL version info. After unpacking the tarball, an user can execute this script, it will create three directories in the current directory: moduledeps modulefiles moduleglobals These contain all the files needed to load ATfL as a module. Assuming this script has been executed in the atfl/arm directory in the user's $HOME, ATfL can be loaded as such: $ MODULEPATH=$HOME/atfl/arm/modulefiles module load atfl/0.0 --- arm-software/linux/build.sh | 15 +++ arm-software/linux/mkmoduledirs.sh.var | 161 +++++++++++++++++++++++++ 2 files changed, 176 insertions(+) create mode 100644 arm-software/linux/mkmoduledirs.sh.var diff --git a/arm-software/linux/build.sh b/arm-software/linux/build.sh index b60c08697608..11cce0bee5ec 100755 --- a/arm-software/linux/build.sh +++ b/arm-software/linux/build.sh @@ -11,6 +11,7 @@ fi BASE_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" README_MD_PATH=${README_MD_PATH:-"${BASE_DIR}/README.md"} +MKMODULEDIRS_PATH=${MKMODULEDIRS_PATH:-"${BASE_DIR}/mkmoduledirs.sh.var"} SOURCES_DIR=${SOURCES_DIR:-"${BASE_DIR}/src"} LIBRARIES_DIR=${LIBRARIES_DIR:-"${BASE_DIR}/lib"} PATCHES_DIR=${PATCHES_DIR:-"${BASE_DIR}/patches"} @@ -166,6 +167,8 @@ Environment Variables: README_MD_PATH Specifies the location of the README.md file to bundle (default: ${README_MD_PATH}) + MKMODULEDIRS_PATH Specifies the location of mkmoduledirs.sh.var to tweak + (default: ${MKMODULEDIRS_PATH}) SOURCES_DIR The directory where all source code will be stored (default: $SOURCES_DIR) LIBRARIES_DIR The directory where the ArmPL veclibs will be stored @@ -354,6 +357,12 @@ shared_lib_build() { package() { cp "${README_MD_PATH}" "${ATFL_DIR}/README.md" + mkdir -p "${ATFL_DIR}/arm" + cp "${MKMODULEDIRS_PATH}" "${ATFL_DIR}/arm/mkmoduledirs.sh" + sed -i "s/%ATFL_VERSION%/${ATFL_VERSION}/g" "${ATFL_DIR}/arm/mkmoduledirs.sh" + sed -i "s/%ATFL_BUILD%/unknown/g" "${ATFL_DIR}/arm/mkmoduledirs.sh" + sed -i "s/%ATFL_INSTALL_PREFIX%/\$\(dirname \$\(dirname \`realpath \$BASH_SOURCE\`\)\)/g" "${ATFL_DIR}/arm/mkmoduledirs.sh" + chmod 0755 ${ATFL_DIR}/arm/mkmoduledirs.sh cp "${LIBRARIES_DIR}/libamath.a" \ "${ATFL_DIR}/lib/aarch64-unknown-linux-gnu" cp "${LIBRARIES_DIR}/libamath.so" \ @@ -425,6 +434,12 @@ then exit 1 fi +if ! [[ -f "${MKMODULEDIRS_PATH}" ]] +then + echo "The path to mkmoduledirs.sh.var file is configured incorrectly or does not exist." + exit 1 +fi + if ! [[ -e "${SOURCES_DIR}" ]] then echo "The sources directory is configured incorrectly or does not exist." diff --git a/arm-software/linux/mkmoduledirs.sh.var b/arm-software/linux/mkmoduledirs.sh.var new file mode 100644 index 000000000000..07340155825c --- /dev/null +++ b/arm-software/linux/mkmoduledirs.sh.var @@ -0,0 +1,161 @@ +#!/usr/bin/env bash + +ATFL_VERSION="%ATFL_VERSION%" +ATFL_BUILD="%ATFL_BUILD%" +ATFL_INSTALL_PREFIX="%ATFL_INSTALL_PREFIX%" + +mkdir -p "moduledeps/atfl/${ATFL_VERSION}/clang-autocomplete" +( +cat < "moduledeps/atfl/${ATFL_VERSION}/clang-autocomplete/${ATFL_VERSION}.lua" + +mkdir -p "modulefiles/atfl" +( +cat < "modulefiles/atfl/${ATFL_VERSION}" + +mkdir -p "moduleglobals/compiler_functions" +( +cat < "moduleglobals/compiler_functions/${ATFL_VERSION}"