# Common stuff for "bar" modulefiles
# Using "modulepath based" strategy
#
# This file expects the following Tcl variables to have been
# previously set:
#	version: version of foo
#	compilerTag: compiler was built for
#	simdTag: max CPU vectorization commands to support
#		avx, avx2, sse4.1, etc.

# 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

proc ModulesHelp { } {
   global version compilerTag simdTag
   puts stderr "
foo: Test dummy version of foo $version

For testing packages depending on compilers/etc

Foo: $version
Compiler: $compilerTag
SIMD Support: $simdTag

"
}

module-whatis "Dummy foo $version ($compilerTag, $simdTag)"

# Compute the installation prefix
set pkgroot $swroot/bar
set vroot $pkgroot/$version
set prefix $vroot/$compilerTag/$simdTag

# We need to prereq the compiler to allow autohandling to work
prereq $compilerTag

# Set environment variables
setenv BAR_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 bar
