diff --git a/Pmodules/libpbuild.bash b/Pmodules/libpbuild.bash index d71b252..14fc373 100644 --- a/Pmodules/libpbuild.bash +++ b/Pmodules/libpbuild.bash @@ -246,7 +246,7 @@ set_full_module_name_and_prefix() { # set full module name fully_qualified_module_name=$( join_by '/' "${name[@]}" ) # set PREFIX of module - PREFIX="${PMODULES_ROOT}/${GROUP}/" + PREFIX="${overlay}/${GROUP}/" local -i i=0 for ((i=${#name[@]}-1; i >= 0; i--)); do PREFIX+="${name[i]}/" @@ -916,7 +916,7 @@ pbuild::make_all() { return fi # assemble name of modulefile - local dst="${PMODULES_ROOT}/" + local dst="${overlay}/" dst+="${GROUP}/" dst+="${PMODULES_MODULEFILES_DIR}/" dst+="${fully_qualified_module_name}" @@ -932,7 +932,7 @@ pbuild::make_all() { } install_release_file() { - local dst="${PMODULES_ROOT}/" + local dst="${overlay}/" dst+="${GROUP}/" dst+="${PMODULES_MODULEFILES_DIR}/" dst+="${fully_qualified_module_name}" @@ -1082,7 +1082,7 @@ pbuild::make_all() { fi # assemble name of modulefile - local dst="${PMODULES_ROOT}/" + local dst="${overlay}/" dst+="${GROUP}/" dst+="${PMODULES_MODULEFILES_DIR}/" dst+="${fully_qualified_module_name}" @@ -1262,7 +1262,7 @@ pbuild.bootstrap() { MODULECMD=$(which true) GROUP='Tools' - PREFIX="${PMODULES_ROOT}/${GROUP}/Pmodules/${PMODULES_VERSION}" + PREFIX="${overlay}/${GROUP}/Pmodules/${PMODULES_VERSION}" C_INCLUDE_PATH="${PREFIX}/include" CPLUS_INCLUDE_PATH="${PREFIX}/include" diff --git a/Pmodules/modbuild.in b/Pmodules/modbuild.in index 9b71194..592dda4 100755 --- a/Pmodules/modbuild.in +++ b/Pmodules/modbuild.in @@ -67,7 +67,7 @@ BUILD-STEPS OPTIONS: --all Run throu all steps including cleanup. ---update-modulefiles +-update-modulefiles Only install the modulefile and set the release. MISCELLANEOUS OPTIONS: @@ -111,6 +111,8 @@ MISCELLANEOUS OPTIONS: --tmpdir Directory used for building a module. +--overlay + Install in this overlay. Defaults to '${PMODULES_ROOT}'. " exit 1 } @@ -126,6 +128,7 @@ declare opt_all_variants='no' declare opt_bootstrap='no' # array collecting all modules specified on the command line via '--with=module' declare -a opt_with_modules=() +declare overlay='' declare build_config='modbuild.conf' declare system="$(uname -s)" @@ -225,6 +228,12 @@ parse_args() { --update-modulefiles ) pbuild.update_modulefiles 'yes' ;; + --overlay ) + overlay=$2 + ;; + --overlay=* ) + overlay=${1*=} + ;; -* ) std::die 1 "Invalid option -- '$1'" ;; @@ -379,6 +388,7 @@ source "${build_config}" || \ source libpbuild.bash || \ std::die 3 "Oops: Cannot source library -- '$_'" +[[ -z "${overlay}" ]] && overlay=${PMODULES_ROOT} declare -r BUILD_SCRIPT declare -r BUILDBLOCK_DIR