#%Module1.0###################################################################

# Copyright (c) 2019-2020 Intel Corporation.
#
# This software and the related documents are Intel copyrighted materials, and
# your use of them is governed by the express license under which they were
# provided to you (License). Unless the License provides otherwise, you may
# not use, modify, copy, publish, distribute, disclose or transmit this
# software or the related documents without Intel's prior written permission.
#
# This software and the related documents are provided as is, with no express
# or implied warranties, other than those that are expressly stated in the
# License.

# Get full pathname for this script file
set scriptpath "${ModulesCurrentModulefile}"

# If modulefile script name is a symlink, resolve it
if { "[file type "$scriptpath"]" eq "link" } {
    set scriptpath "[file readlink "$scriptpath"]"
}

# If fullpath contains links, resolve them
set scriptpath "[file normalize "$scriptpath"]"

# Get directory holding this modulefile script and others
set modulefileroot "[file dirname "$scriptpath"]"

# Get name of modulefile script we are loading
set modulefilename "[file tail "$scriptpath"]"

# Determine modulefile script version
set modulefilever "[file dirname "$modulefileroot"]"
set modulefilever "[file tail "$modulefilever"]"

# Point to component top-level root folder
set componentroot "[file dirname "$modulefileroot"]"
set componentroot "[file dirname "$componentroot"]"

# Get component folder name
set componentname "[file tail "$componentroot"]"

# Get oneAPI top-level root folder
set oneapiroot "[file dirname "$componentroot"]"

# On load print component name and version being loaded
if { [ module-info mode load ] } {
    puts stderr "Loading $modulefilename version $modulefilever"
}

# On remove print component name and version being removed
if { [ module-info mode unload ] } {
    puts stderr "Removing $modulefilename version $modulefilever"
}

# ###### Component Specific env vars setup ###################################

set gdbroot "$componentroot/$modulefilever"

# PATH
prepend-path PATH "$gdbroot/gdb/intel64/bin"

# LD_LIBRARY_PATH
prepend-path LD_LIBRARY_PATH "$gdbroot/gdb/intel64/lib"
prepend-path LD_LIBRARY_PATH "$gdbroot/libipt/intel64/lib"
prepend-path LD_LIBRARY_PATH "$gdbroot/dep/lib"

# Documentation
prepend-path MANPATH "$gdbroot/documentation/man"
prepend-path GDB_INFO "$gdbroot/documentation/info/"

# Export Python home directory for the gdb-oneapi debugger
setenv INTEL_PYTHONHOME "$gdbroot/dep/"

# User information about the module
proc ModulesHelp { } {
    puts stderr "The gdb-oneapi debugger (an extension of standard gdb)."
}
module-whatis "The gdb-oneapi debugger (an extension of standard gdb)."



## 99ee5104d67b31074ed218269de0e0c3e69dca57
