Files
modules/doc/example/compiler-etc-dependencies/modulerc4/foo/common
Xavier Delaruelle 410bd79d5e doc: normalize code of modulefile of compiler-etc-depend recipe
And include these modulefile examples as Tcl code in recipe document to
get their content highlighted.
2020-02-21 22:41:46 +01:00

67 lines
1.9 KiB
Plaintext

# Common stuff for "foo" modulefiles
# Using "modulerc based" strategy
#
# This file expects the following Tcl variables to have been
# previously set:
# version: version of foo
# compilerTag: compiler was built for
# mpiTag: mpi was built for
# Declare the path where the packages are installed
# The reference to the environment variable is a hack
# for this example; normally one would hard code a path
set rootdir $::env(MOD_GIT_ROOTDIR)
set swroot $rootdir/doc/example/compiler-etc-dependencies/dummy-sw-root
# Also get location of and load common procedures
# This is a hack for the cookbook examples, in production
# one should either
# 1) declare the procedures in a site config file (preferred)
# 2) hardcode the path to $tcllibdir and common_utilities.tcl
set tcllibdir $rootdir/doc/example/compiler-etc-dependencies/tcllib
source $tcllibdir/common_utilities.tcl
proc ModulesHelp { } {
global version compilerTag mpiTag
puts stderr "
foo: Test dummy version of foo $version
For testing packages depending on compilers/MPI
Foo: $version
Compiler: $compilerTag
MPI: $mpiTag
"
}
module-whatis "Dummy foo $version ($compilerTag, $mpiTag)"
# Make sure loaded compiler and MPI match what we want.
# And load them if not already loaded
LoadedCompilerMatches $compilerTag 1 1
# But don't load intelmpi if compiler is intel
LoadedMpiMatches $mpiTag 1 1 1
# For Env Modules 3.x, set requireIt to false
#LoadedCompilerMatches $compilerTag 0 1
#LoadedMpiMatches $mpiTag 0 1 1
# Compute the installation prefix
set pkgroot $swroot/foo
set vroot $pkgroot/$version
set prefix $vroot/$compilerTag/$mpiTag
# Set environment variables
setenv FOO_DIR $prefix
set bindir $prefix/bin
set libdir $prefix/lib
set incdir $prefix/include
prepend-path PATH $bindir
prepend-path LIBRARY_PATH $libdir
prepend-path LD_LIBRARY_PATH $libdir
prepend-path CPATH $incdir
conflict foo