diff --git a/Pmodules/libpbuild.bash b/Pmodules/libpbuild.bash index 20d47e7..5267ce6 100644 --- a/Pmodules/libpbuild.bash +++ b/Pmodules/libpbuild.bash @@ -25,16 +25,6 @@ unset FC unset F77 unset F90 -# assemble default path -PATH='/usr/bin:/bin:/usr/sbin:/sbin' - -#if [[ "${OS}" == "Darwin" ]]; then -# # :FIXME: do we really need this? -# # if required we should do this in the build-block -# [[ -d "/opt/X11/bin" ]] && PATH+=':/opt/X11/bin' || \ -# std::info "Xquarz is not installed in '/opt/X11'" -#fi - #.............................................................................. # global variables used in the library @@ -52,8 +42,6 @@ declare -x ModuleRelease='' # abs. path is "${PREFIX}/${_docdir}/$P" declare -r _DOCDIR='share/doc' - - # set default for the defined releases if [[ -z ${PMODULES_DEFINED_RELEASES} ]]; then declare -r PMODULES_DEFINED_RELEASES=":unstable:stable:deprecated:" @@ -795,14 +783,20 @@ pbuild::make_all() { std::info "${P}/${V}: skipping modulefile installation ..." return fi - local -r dst="${PMODULES_ROOT}/${ModuleGroup}/${PMODULES_MODULEFILES_DIR}/${P}" + # assemble name of modulefile + local dst="${PMODULES_ROOT}/" + dst+="${ModuleGroup}/" + dst+="${PMODULES_MODULEFILES_DIR}/" + dst+="${ModuleName}" - std::info "${P}/${V}: installing modulefile in '${dst}' ..." - mkdir -p "${dst}" - install -m 0444 "${src}" "${dst}/$V" + # directory where to install module- and release-file + local -r dstdir=${dst%/*} + + std::info "${P}/${V}: installing modulefile in '${dstdir}' ..." + mkdir -p "${dstdir}" + install -m 0444 "${src}" "${dst}" std::info "${P}/${V}: setting release to '${ModuleRelease}' ..." - local -r release_file=".release-${ModuleName##*/}" - echo "${ModuleRelease}" > "${dst}/${release_file}" + echo "${ModuleRelease}" > "${dstdir}/.release-$V" } ############################################################################## @@ -828,14 +822,17 @@ pbuild::make_all() { [[ ${dry_run} == yes ]] && std::die 0 "" check_compiler - if [[ ! -e "${MODULE_BUILDDIR}/.prep" ]] || [[ ${force_rebuild} == 'yes' ]] ; then + if [[ ! -e "${MODULE_BUILDDIR}/.prep" ]] || \ + [[ ${force_rebuild} == 'yes' ]] || \ + [[ -z ${target} ]]; then pbuild::prep touch "${MODULE_BUILDDIR}/.prep" fi [[ "${target}" == "prep" ]] && return 0 if [[ ! -e "${MODULE_BUILDDIR}/.configure" ]] || \ - [[ ${force_rebuild} == 'yes' ]]; then + [[ ${force_rebuild} == 'yes' ]] || \ + [[ -z ${target} ]]; then cd "${MODULE_SRCDIR}" pbuild::pre_configure cd "${MODULE_BUILDDIR}" @@ -844,14 +841,18 @@ pbuild::make_all() { fi [[ "${target}" == "configure" ]] && return 0 - if [[ ! -e "${MODULE_BUILDDIR}/.compile" ]] || [[ ${force_rebuild} == 'yes' ]]; then + if [[ ! -e "${MODULE_BUILDDIR}/.compile" ]] || \ + [[ ${force_rebuild} == 'yes' ]] || \ + [[ -z ${target} ]]; then cd "${MODULE_BUILDDIR}" pbuild::build touch "${MODULE_BUILDDIR}/.compile" fi [[ "${target}" == "compile" ]] && return 0 - if [[ ! -e "${MODULE_BUILDDIR}/.install" ]] || [[ ${force_rebuild} == 'yes' ]]; then + if [[ ! -e "${MODULE_BUILDDIR}/.install" ]] || \ + [[ ${force_rebuild} == 'yes' ]] || \ + [[ -z ${target} ]]; then cd "${MODULE_BUILDDIR}" pbuild::install pbuild::post_install diff --git a/Pmodules/libpmodules.bash b/Pmodules/libpmodules.bash index e873871..12368d1 100644 --- a/Pmodules/libpmodules.bash +++ b/Pmodules/libpmodules.bash @@ -11,8 +11,6 @@ pmodules::get_options() { pmodules::check_env_vars() { [[ -n "${PMODULES_ROOT}" ]] && - [[ -n "${PMODULES_CONFIG_DIR}" ]] && - [[ -n "${PMODULES_TEMPLATES_DIR}" ]] && [[ -n "${PMODULES_HOME}" ]] && [[ -n "${PMODULES_VERSION}" ]] || std::die 1 " Error: the module environment you are going to use as source has not been diff --git a/Pmodules/modbuild b/Pmodules/modbuild index 260c372..9ad83ab 100755 --- a/Pmodules/modbuild +++ b/Pmodules/modbuild @@ -7,7 +7,7 @@ declare -r mydir=$(dirname "$0") declare -r libpbuild='libpbuild.bash' declare -r libstd='libstd.bash' -declare -r pmodule_environment='environment.bash' +declare -r pmodules_build_config='modbuild.conf' declare -ra bash_libpath=("${mydir}" "${mydir}/../lib") ############################################################################## @@ -146,7 +146,7 @@ declare force_rebuild='no' declare dry_run='no' declare enable_cleanup_build='yes' declare enable_cleanup_src='no' -declare target='all' +declare target='' declare bootstrap='no' declare variants_file='' @@ -269,25 +269,20 @@ fi declare -r OS +# assemble default path. We have to do this here, before +# including the modbuild configuration file. +PATH="/usr/bin:/bin:/usr/sbin:/sbin:${PMODULES_DIR}/bin" # source Pmodule environment configuration if [[ "${bootstrap}" == "yes" ]]; then - [[ -r ${BUILD_BLOCK_DIR}/../config/${pmodule_environment} ]] || \ + [[ -r ${BUILD_BLOCK_DIR}/../config/${pmodules_build_config} ]] || \ std::die 1 "Cannot read configuration file!" - source "${BUILD_BLOCK_DIR}/../config/${pmodule_environment}" + source "${BUILD_BLOCK_DIR}/../config/${pmodules_build_config}" declare -r BUILD_BASEDIR=$(std::get_abspath "${BUILD_BLOCK_DIR}/..") - - if [[ -r "${BUILD_BLOCK_DIR}/../config/modbuild.conf" ]]; then - source "${BUILD_BLOCK_DIR}/../config/modbuild.conf" - fi -elif [[ -n ${PMODULES_ROOT} ]] && [[ -n ${PMODULES_CONFIG_DIR} ]] && \ - [[ -r ${PMODULES_ROOT}/${PMODULES_CONFIG_DIR}/${pmodule_environment} ]]; then - source ${PMODULES_ROOT}/${PMODULES_CONFIG_DIR}/${pmodule_environment} +elif [[ -n "${PMODULES_ROOT}" ]] && [[ -n "${PMODULES_CONFIG_DIR}" ]] && \ + [[ -r "${PMODULES_ROOT}/${PMODULES_CONFIG_DIR}/modbuild.conf" ]]; then + source "${PMODULES_ROOT}/${PMODULES_CONFIG_DIR}/modbuild.conf" declare -r BUILD_BASEDIR=$(std::get_abspath "${BUILD_BLOCK_DIR}/../..") - if [[ -r "${PMODULES_ROOT}/config/modbuild.conf" ]]; then - source "${PMODULES_ROOT}/config/modbuild.conf" - fi - else std::die 3 "Build environment not setup properbly!" fi @@ -323,7 +318,6 @@ if [[ ${bootstrap} == no ]]; then fi # initialize module environment - source "${PMODULES_ROOT}/${PMODULES_CONFIG_DIR}/profile.bash" MODULECMD="${PMODULES_HOME}/bin/modulecmd" [[ -x ${MODULECMD} ]] || std::die 1 "${MODULECMD}: no such executable" diff --git a/Pmodules/modulecmd.bash.in b/Pmodules/modulecmd.bash.in index 2f17702..d05e1c6 100755 --- a/Pmodules/modulecmd.bash.in +++ b/Pmodules/modulecmd.bash.in @@ -1464,7 +1464,7 @@ pmodules_init() { declare -g PMODULES_DEFAULT_GROUPS='' declare -g PMODULES_DEFAULT_RELEASES='' - source "${PMODULES_ROOT}/${PMODULES_CONFIG_DIR}/environment.bash" + source "${PMODULES_ROOT}/${PMODULES_CONFIG_DIR}/profile.bash" declare -g LOADEDMODULES='' declare -g PMODULES_USED_GROUPS='' diff --git a/Pmodules/profile.bash.in b/Pmodules/profile.bash.in index 9d1df2d..c0fdbe9 100644 --- a/Pmodules/profile.bash.in +++ b/Pmodules/profile.bash.in @@ -7,18 +7,18 @@ # ${PMODULES_ROOT}/Tools/Pmodules/${PMODULES_VERSION} # +declare -x PMODULES_DEFAULT_GROUPS +declare -x PMODULES_DEFAULT_RELEASES +declare -x PMODULES_VERSION + : ${PMODULES_DEFAULT_GROUPS:='Tools Programming'} : ${PMODULES_DEFAULT_RELEASES:='stable'} -: ${PMODULES_VERSION:="@PMODULES_VERSION@}" +: ${PMODULES_VERSION:=@PMODULES_VERSION@} ############################################################################# # N O C H A N G E S B E L O W T H I S L I N E ! # ############################################################################# -declare -x PMODULES_DEFAULT_GROUPS -declare -x PMODULES_DEFAULT_RELEASES -declare -x PMODULES_VERSION - declare -x PMODULES_MODULEFILES_DIR='modulefiles' declare -x PMODULES_DEFINED_RELEASES=':unstable:stable:deprecated:' @@ -27,10 +27,6 @@ declare -x PMODULES_CONFIG_DIR=$(basename $(cd $(dirname "${BASH_SOURCE}") && pw declare -x PMODULES_HOME="${PMODULES_ROOT}/Tools/Pmodules/${PMODULES_VERSION}" declare -x PMODULES_DIR="${PMODULES_HOME}" -declare -x PMODULES_TEMPLATES_DIR='templates' -declare -x PMODULES_DISTFILESDIR="@PMODULES_DISTFILESDIR@" -declare -x PMODULES_TMPDIR="@PMODULES_TMPDIR@" - ############################################################################ # some sanity checks # diff --git a/config/environment.bash.opalrunner b/config/environment.bash.opalrunner deleted file mode 100644 index 1829aa5..0000000 --- a/config/environment.bash.opalrunner +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/bash -# - -# -# define PMODULES_ROOT only if it has not been passed as argument -# to build/install scripts -# -if [[ -z "${PMODULES_ROOT}" ]]; then - declare -x PMODULES_ROOT='/home/psi.local' -fi - -declare -x PMODULES_CONFIG_DIR='config' -declare -x PMODULES_MODULEFILES_DIR='modulefiles' -declare -x PMODULES_TEMPLATES_DIR='templates' - -declare -x PMODULES_HOME="${PMODULES_ROOT}/Tools/Pmodules/${PMODULES_VERSION}" - -declare -x PMODULES_DEFAULT_GROUPS='Tools Programming' -declare -x PMODULES_DEFINED_RELEASES=':unstable:stable:deprecated:' -declare -x PMODULES_DEFAULT_RELEASES='stable' - -declare -x PMODULES_DISTFILESDIR='/afs/psi.ch/software/Pmodules/distfiles' -declare -x PMODULES_TMPDIR="/var/tmp/${USER}" - diff --git a/config/environment.bash.psi b/config/environment.bash.psi deleted file mode 100644 index d343a8d..0000000 --- a/config/environment.bash.psi +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/bash -# - -# -# define PMODULES_ROOT only if it has not been passed as argument -# to build/install scripts -# -if [[ -z "${PMODULES_ROOT}" ]]; then - declare -x PMODULES_ROOT='/opt/psi' -fi - -declare -x PMODULES_CONFIG_DIR='config' -declare -x PMODULES_MODULEFILES_DIR='modulefiles' -declare -x PMODULES_TEMPLATES_DIR='templates' - -declare -x PMODULES_HOME="${PMODULES_ROOT}/Tools/Pmodules/${PMODULES_VERSION}" - -declare -x PMODULES_DEFAULT_GROUPS='Tools Programming' -declare -x PMODULES_DEFINED_RELEASES=':unstable:stable:deprecated:' -declare -x PMODULES_DEFAULT_RELEASES='stable' - -if [[ -z ${PMODULES_DISTFILESDIR} ]]; then - PMODULES_DISTFILESDIR='/afs/psi.ch/software/Pmodules/distfiles' -fi -declare -x PMODULES_DISTFILESDIR - -if [[ -z ${PMODULES_TMPDIR} ]]; then - PMODULES_TMPDIR="/var/tmp/${USER}" -fi -declare -x PMODULES_TMPDIR - diff --git a/config/modbuild.conf b/config/modbuild.conf index 7a25d05..aaaa12a 100644 --- a/config/modbuild.conf +++ b/config/modbuild.conf @@ -1,5 +1,30 @@ #!/bin/bash +# +# define PMODULES_ROOT only if it has not been passed as argument +# to build/install scripts +# + +declare -x PMODULES_ROOT +declare -x PMODULES_DISTFILESDIR +declare -x PMODULES_TMPDIR + +: ${PMODULES_ROOT:=/opt/psi} +: ${PMODULES_DISTFILESDIR:=/opt/psi/var/distfiles} +: ${PMODULES_TMPDIR:=/var/tmp/${USER}} + +declare -x PMODULES_CONFIG_DIR='config' +declare -x PMODULES_MODULEFILES_DIR='modulefiles' + +declare -x PMODULES_HOME="${PMODULES_ROOT}/Tools/Pmodules/${PMODULES_VERSION}" + +declare -x PMODULES_DEFAULT_GROUPS='Tools Programming' +declare -x PMODULES_DEFINED_RELEASES=':unstable:stable:deprecated:' +declare -x PMODULES_DEFAULT_RELEASES='stable' + +#----------------------------------------------------------------------------- +# OS specific configuration +# case ${OS} in Darwin ) declare -x MACOSX_DEPLOYMENT_TARGET='10.12' diff --git a/config/environment.bash.in b/config/modbuild.conf.in similarity index 59% rename from config/environment.bash.in rename to config/modbuild.conf.in index a0dc9b5..0f9e61e 100644 --- a/config/environment.bash.in +++ b/config/modbuild.conf.in @@ -1,17 +1,15 @@ #!/bin/bash -# # # define PMODULES_ROOT only if it has not been passed as argument # to build/install scripts # -if [[ -z "${PMODULES_ROOT}" ]]; then - declare -x PMODULES_ROOT='@PMODULES_ROOT@' -fi +: ${PMODULES_ROOT:=@PMODULES_ROOT@} +: ${PMODULES_DISTFILESDIR:=@PMODULES_DISTFILESDIR@} +: ${PMODULES_TMPDIR:=@PMODULES_TMPDIR@} declare -x PMODULES_CONFIG_DIR='config' declare -x PMODULES_MODULEFILES_DIR='modulefiles' -declare -x PMODULES_TEMPLATES_DIR='templates' declare -x PMODULES_HOME="${PMODULES_ROOT}/Tools/Pmodules/${PMODULES_VERSION}" @@ -19,13 +17,16 @@ declare -x PMODULES_DEFAULT_GROUPS='Tools Programming' declare -x PMODULES_DEFINED_RELEASES=':unstable:stable:deprecated:' declare -x PMODULES_DEFAULT_RELEASES='stable' -if [[ -z ${PMODULES_DISTFILESDIR} ]]; then - PMODULES_DISTFILESDIR='@PMODULES_DISTFILESDIR@' -fi declare -x PMODULES_DISTFILESDIR - -if [[ -z ${PMODULES_TMPDIR} ]]; then - PMODULES_TMPDIR="/var/tmp/${USER}" -fi declare -x PMODULES_TMPDIR +#----------------------------------------------------------------------------- +# OS specific configuration +# +case ${OS} in +Darwin ) + declare -x MACOSX_DEPLOYMENT_TARGET='10.12' + #declare -rx SDKROOT='macosx10.9' + ;; +esac +