Commit 73180580 authored by gsell's avatar gsell
Browse files

Merge branch 'master' of gitorious.psi.ch:pmodules/src

parents a85c5070 247d9431
......@@ -4,14 +4,3 @@ declare -x MODULES_VERSION=3.2.10
declare -a COMPILER_VERSIONS=( 'gcc/4.7.4' 'gcc/4.8.3' 'gcc/4.8.4' 'gcc/4.9.2' )
declare -a MPI_VERSIONS=( 'openmpi/1.6.5' 'openmpi/1.8.2' 'openmpi/1.8.4' )
declare -a HDF5_VERSIONS=( 'hdf5/1.8.12' 'hdf5/1.8.14' )
declare COMPILER='gcc'
declare COMPILER_VERSION='4.8.4'
declare GCC_VERSION="${COMPILER_VERSION}"
declare MPI='openmpi'
declare MPI_VERSION='1.8.4'
declare OPENMPI_VERSION="${MPI_VERSION}"
declare HDF5='hdf5/1.8.12'
declare HDF5_serial='hdf5_serial/1.8.12'
......@@ -2,6 +2,9 @@
PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/X11/bin
# disable auto-echo feature of 'cd'
unset CDPATH
shopt -s expand_aliases
......@@ -96,85 +99,6 @@ ENV=VALUE
exit 1
}
debug_on='no'
force_rebuild='no'
ENVIRONMENT_ARGS=''
dry_run='no'
bootstrap='no'
# array collecting all modules specified on the command line via '--with=module'
with_modules=()
while (( $# > 0 )); do
case $1 in
-j )
JOBS=$2
shift
;;
--jobs=[0-9]* )
JOBS=${1/--jobs=}
;;
-v | --verbose)
debug_on='yes'
;;
-f | --force-rebuild )
force_rebuild='yes'
;;
-b | --bootstrap )
bootstrap='yes'
force_rebuild='yes'
;;
-? | -h | --help )
usage
;;
--dry-run )
dry_run='yes'
;;
--release=* )
MODULE_RELEASE=${1/--release=}
;;
--with=*/* )
with_modules+=( ${1/--with=} )
;;
*=* )
eval $1
ENVIRONMENT_ARGS="${ENVIRONMENT_ARGS} $1"
;;
* )
V=$1
;;
esac
shift
done
if [[ ${debug_on} == yes ]]; then
trap 'echo "$BASH_COMMAND"' DEBUG
fi
# while bootstraping the module command is not yet available
if [[ ${bootstrap} == no ]]; then
source "${PSI_PREFIX}/${PSI_CONFIG_DIR}/profile.bash"
MODULECMD="${PMODULES_HOME}/bin/modulecmd"
[[ -x ${MODULECMD} ]] || die 1 "${MODULECMD}: no such executable"
module use unstable
module purge
fi
P=$(basename $(dirname "${BUILDSCRIPT}"))
_P=$(echo $P | tr [:lower:] [:upper:])
_P=${_P//-/_}
_V=${_P}_VERSION
eval "${ENVIRONMENT_ARGS}"
if [[ -n ${PSI_RELEASES} ]]; then
declare -r releases="${PSI_RELEASES}"
else
# set defaults, if file doesn't exist or isn't readable
declare -r releases=":unstable:stable:deprecated:"
fi
is_release () {
[[ ${releases} =~ :$1: ]]
}
......@@ -223,16 +147,6 @@ function module_is_available() {
}
function _load_build_dependencies() {
# :FIXME: merge this two loops, load only modules which are required
# this merge is not as easy as it looks like at a first glance!
for m in "${with_modules[@]}"; do
if module_is_available "$m"; then
echo "Loading module: ${m}"
module load "${m}"
else
die 44 "$m: module not available!"
fi
done
for m in "${MODULE_BUILD_DEPENDENCIES[@]}"; do
[[ -z $m ]] && continue
if [[ ! $m =~ "*/*" ]]; then
......@@ -523,58 +437,56 @@ function _setup_env2() {
}
if [[ ${bootstrap} == yes ]]; then
# redefine function for bootstrapping
function _setup_env2() {
if [[ -z ${MODULE_FAMILY} ]]; then
# redefine function for bootstrapping
function _setup_env2_bootstrap() {
if [[ -z ${MODULE_FAMILY} ]]; then
die 1 "$P: family not set."
fi
fi
if [[ -z $V ]]; then
if [[ -z $V ]]; then
V=$(eval echo \$${_P}_VERSION)
fi
fi
# oops, we need a version
if [[ -z $V ]]; then
# oops, we need a version
if [[ -z $V ]]; then
die 1 "$P: Missing version."
fi
MODULE_SRCDIR="${BUILD_TMPDIR}/src/${P/_serial}-$V"
MODULE_BUILDDIR="${BUILD_TMPDIR}/build/$P-$V"
MODULE_FAMILY='Tools'
MODULE_NAME="Pmodules/${PMODULES_VERSION}"
# set PREFIX of module
PREFIX="${PSI_PREFIX}/${MODULE_FAMILY}/${MODULE_NAME}"
MODULE_RELEASE='unstable'
info "${MODULE_NAME}: will be released as \"${MODULE_RELEASE}\""
# directory for README's, license files etc
DOCDIR="${PREFIX}/share/doc/$P"
# set tar-ball and flags for tar
TARBALL="${BUILD_DOWNLOADSDIR}/${P/_serial}"
if [[ -r "${TARBALL}-${V}.tar.gz" ]]; then
TARBALL+="-${V}.tar.gz"
elif [[ -r "${TARBALL}-${OS}-${V}.tar.gz" ]]; then
TARBALL+="-${OS}-${V}.tar.gz"
elif [[ -r "${TARBALL}-${V}.tar.bz2" ]]; then
TARBALL+="-${V}.tar.bz2"
elif [[ -r "${TARBALL}-${OS}-${V}.tar.bz2" ]]; then
TARBALL+="-${OS}-${V}.tar.bz2"
else
error "tar-ball for $P/$V not found."
exit 43
fi
C_INCLUDE_PATH="${PREFIX}/include"
CPLUS_INCLUDE_PATH="${PREFIX}/include"
CPP_INCLUDE_PATH="${PREFIX}/include"
LIBRARY_PATH="${PREFIX}/lib"
LD_LIBRARY_PATH="${PREFIX}/lib"
DYLD_LIBRARY_PATH="${PREFIX}/lib"
PATH+=":${PREFIX}/bin"
}
fi
fi
MODULE_SRCDIR="${BUILD_TMPDIR}/src/${P/_serial}-$V"
MODULE_BUILDDIR="${BUILD_TMPDIR}/build/$P-$V"
MODULE_FAMILY='Tools'
MODULE_NAME="Pmodules/${PMODULES_VERSION}"
# set PREFIX of module
PREFIX="${PSI_PREFIX}/${MODULE_FAMILY}/${MODULE_NAME}"
MODULE_RELEASE='unstable'
info "${MODULE_NAME}: will be released as \"${MODULE_RELEASE}\""
# directory for README's, license files etc
DOCDIR="${PREFIX}/share/doc/$P"
# set tar-ball and flags for tar
TARBALL="${BUILD_DOWNLOADSDIR}/${P/_serial}"
if [[ -r "${TARBALL}-${V}.tar.gz" ]]; then
TARBALL+="-${V}.tar.gz"
elif [[ -r "${TARBALL}-${OS}-${V}.tar.gz" ]]; then
TARBALL+="-${OS}-${V}.tar.gz"
elif [[ -r "${TARBALL}-${V}.tar.bz2" ]]; then
TARBALL+="-${V}.tar.bz2"
elif [[ -r "${TARBALL}-${OS}-${V}.tar.bz2" ]]; then
TARBALL+="-${OS}-${V}.tar.bz2"
else
error "tar-ball for $P/$V not found."
exit 43
fi
C_INCLUDE_PATH="${PREFIX}/include"
CPLUS_INCLUDE_PATH="${PREFIX}/include"
CPP_INCLUDE_PATH="${PREFIX}/include"
LIBRARY_PATH="${PREFIX}/lib"
LD_LIBRARY_PATH="${PREFIX}/lib"
DYLD_LIBRARY_PATH="${PREFIX}/lib"
PATH+=":${PREFIX}/bin"
}
function _prep() {
......@@ -689,7 +601,11 @@ function em.make_all() {
_setup_env1
_load_build_dependencies
# setup module specific environment
_setup_env2
if [[ ${bootstrap} == no ]]; then
_setup_env2
else
_setup_env2_bootstrap
fi
if [[ ! -d "${PREFIX}" ]] || [[ ${force_rebuild} == 'yes' ]]; then
echo "Building $P/$V ..."
......@@ -719,6 +635,94 @@ function em.make_all() {
em.cleanup_build
}
##############################################################################
#
debug_on='no'
force_rebuild='no'
ENVIRONMENT_ARGS=''
dry_run='no'
bootstrap='no'
# array collecting all modules specified on the command line via '--with=module'
with_modules=()
while (( $# > 0 )); do
case $1 in
-j )
JOBS=$2
shift
;;
--jobs=[0-9]* )
JOBS=${1/--jobs=}
;;
-v | --verbose)
debug_on='yes'
;;
-f | --force-rebuild )
force_rebuild='yes'
;;
-b | --bootstrap )
bootstrap='yes'
force_rebuild='yes'
;;
-? | -h | --help )
usage
;;
--dry-run )
dry_run='yes'
;;
--release=* )
MODULE_RELEASE=${1/--release=}
;;
--with=*/* )
with_modules+=( ${1/--with=} )
;;
*=* )
eval $1
ENVIRONMENT_ARGS="${ENVIRONMENT_ARGS} $1"
;;
* )
V=$1
;;
esac
shift
done
if [[ ${debug_on} == yes ]]; then
trap 'echo "$BASH_COMMAND"' DEBUG
fi
# while bootstraping the module command is not yet available
if [[ ${bootstrap} == no ]]; then
source "${PSI_PREFIX}/${PSI_CONFIG_DIR}/profile.bash"
MODULECMD="${PMODULES_HOME}/bin/modulecmd"
[[ -x ${MODULECMD} ]] || die 1 "${MODULECMD}: no such executable"
module use unstable
module purge
for m in "${with_modules[@]}"; do
if module_is_available "$m"; then
echo "Loading module: ${m}"
module load "${m}"
else
die 44 "$m: module not available!"
fi
done
fi
P=$(basename $(dirname "${BUILDSCRIPT}"))
_P=$(echo $P | tr [:lower:] [:upper:])
_P=${_P//-/_}
_V=${_P}_VERSION
eval "${ENVIRONMENT_ARGS}"
if [[ -n ${PSI_RELEASES} ]]; then
declare -r releases="${PSI_RELEASES}"
else
# set defaults, if file doesn't exist or isn't readable
declare -r releases=":unstable:stable:deprecated:"
fi
# Local Variables:
# mode: sh
# sh-basic-offset: 8
......
......@@ -117,24 +117,18 @@ function replace_path () {
sed '/^\s*$/d' | tr "\n" ":" | sed -e 's|^:||' -e 's|:$||')
}
module purge
#############################################################################
# setup environment
#
if [[ -z ${LOADEDMODULES} ]]; then
declare -x LOADEDMODULES=''
fi
if [[ -z ${MODULEPATH} ]]; then
declare -x MODULEPATH=''
for f in ${PSI_DEFAULT_FAMILIES}; do
append_path MODULEPATH "${PSI_PREFIX}/${PSI_MODULES_ROOT}/$f"
append_path PSI_LOADEDFAMILIES "${f}"
done
fi
if [[ -z ${PSI_LOADEDFAMILIES} ]]; then
declare -x PSI_LOADEDFAMILIES=''
fi
declare -x LOADEDMODULES=''
declare -x PSI_LOADEDFAMILIES=''
declare -x MODULEPATH=''
for f in ${PSI_DEFAULT_FAMILIES}; do
append_path MODULEPATH "${PSI_PREFIX}/${PSI_MODULES_ROOT}/$f"
append_path PSI_LOADEDFAMILIES "${f}"
done
replace_path PATH "${PMODULES_HOME%/*}/.*"
replace_path MANPATH "${PMODULES_HOME%/*}/.*"
......@@ -151,9 +145,6 @@ fi
#############################################################################
# legacy...
#
#declare -x MODULE_VERSION=${PMODULES_VERSION}
#declare -x MODULE_VERSION_STACK="${PMODULE_VERSION}"
#declare -x MODULESHOME="${PMODULES_HOME}"
unset MODULE_VERSION
unset MODULE_VERSION_STACK
unset MODULESHOME
......
#!@PMODULES_HOME@/bin/bash
unset CDPATH
shopt -s expand_aliases
declare -r bindir=$(cd $(dirname "$0") && pwd)
......@@ -141,7 +143,7 @@ subcommand_init() {
local target_prefixes=()
local user=''
local opts=''
opts=$(get_options -o h -l src: -l user: -l help -- "$@")
opts=$(get_options -o h -l src: -l user: -l help -l version: -- "$@")
if [[ $? != 0 ]]; then
subcommand_help_init
exit 1
......@@ -157,6 +159,10 @@ subcommand_init() {
user=$2
shift
;;
--version )
PMODULES_VERSION=$2
shift
;;
-- )
:
;;
......
#!@PMODULES_HOME@/bin/bash
#
# we have to unset CDPATH, otherwise 'cd' prints the directoy!
unset CDPATH
declare -r PMODULES_DIR=$( cd "$(dirname $0)/.." && pwd )
declare -r version='@PMODULES_VERSION@'
......@@ -464,6 +468,11 @@ subcommand_generic1plus() {
"${modulecmd}" "${shell}" "${subcommand}" "$@"
}
#
# load module
#
# $1: module to load
#
subcommand_load() {
output_load_hints() {
local -ra rels=( ${available_releases//:/ } )
......@@ -509,7 +518,9 @@ subcommand_load() {
}
local -r m=$1
if module_is_available "${m}"; then
if [[ "${m}" == "" ]]; then
echo "No module specified." 1>&2
elif module_is_available "${m}"; then
"${modulecmd}" "${shell}" load "${m}"
else
if [[ ${userlvl} = 'novice' ]]; then
......
......@@ -21,7 +21,6 @@ function em.post_install() {
{ cd "${PREFIX}"/bin && rm -f tclsh && ln -fs tclsh${V%.*} tclsh; };
}
em.add_to_family 'Programming'
em.add_to_family 'Tools'
em.set_docfiles 'license.terms' 'README'
em.set_build_dependencies "${COMPILER}"
em.make_all
......@@ -8,6 +8,5 @@ function em.configure() {
|| exit 1
}
em.add_to_family 'System'
em.set_build_dependencies "${COMPILER}"
em.add_to_family 'Tools'
em.make_all
......@@ -8,13 +8,13 @@ source "${BASE_DIR}/config/Pmodules.conf"
unset PMODULES_HOME
source "/opt/psi/config/environment.bash"
${BOOTSTRAP_DIR}/gettext/build --bootstrap
${BOOTSTRAP_DIR}/getopt/build --bootstrap
${BOOTSTRAP_DIR}/dialog/build --bootstrap
${BOOTSTRAP_DIR}/bash/build --bootstrap
${BOOTSTRAP_DIR}/Tcl/build --bootstrap
${BOOTSTRAP_DIR}/gettext/build --bootstrap || { echo "compiling 'gettext' failed!"; exit 1; }
${BOOTSTRAP_DIR}/getopt/build --bootstrap || { echo "compiling 'getopt' failed!"; exit 1; }
${BOOTSTRAP_DIR}/dialog/build --bootstrap || { echo "compiling 'dialog' failed!"; exit 1; }
${BOOTSTRAP_DIR}/bash/build --bootstrap || { echo "compiling 'bash' failed!"; exit 1; }
${BOOTSTRAP_DIR}/Tcl/build --bootstrap || { echo "compiling 'Tcl' failed!"; exit 1; }
# we have to remove the init directory - otherwise the next build will fail...
rm -rf "${PMODULES_HOME}/init"
${BOOTSTRAP_DIR}/Modules/build --bootstrap
${BOOTSTRAP_DIR}/Modules/build --bootstrap || { echo "compiling 'Modules' failed!"; exit 1; }
mv -v "${PMODULES_HOME}/bin/modulecmd" "${PMODULES_HOME}/bin/modulecmd.tcl"
......@@ -9,5 +9,4 @@ function em.configure() {
}
em.add_to_family 'Tools'
em.set_build_dependencies "${COMPILER}"
em.make_all
......@@ -20,5 +20,4 @@ function em.configure() {
}
em.add_to_family 'Tools'
em.set_build_dependencies "${COMPILER}"
em.make_all
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment