Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- # Change the following definition to reflect any given install location
- ROOTDIR=/packages/LabSoC/Xilinx
- declare -A tools
- # tools["ISE"]="ISE"
- tools["Vivado"]="VIVADO"
- # Echoes
- str=''
- idt=' '
- tab=''
- function indent {
- tab+="${idt}"
- }
- function dedent {
- tab="${tab/%$idt}"
- }
- function append {
- str+="${1}"
- }
- function eol {
- append $'\n'
- }
- function log {
- append "${tab}${*}"
- eol
- }
- # Common environment variables modifications
- function vappend {
- tmp="${!1}"
- if [ "x${tmp}" == "x" ]; then
- export ${1}=${2}
- elif [[ "${tmp}" != ${2} && "${tmp}" != ${2}:* && "${tmp}" != *:${2} && "${tmp}" != *:${2}:* ]]; then
- export ${1}=${tmp}:${2}
- fi
- }
- function vprepend {
- tmp="${!1}"
- if [ "x${tmp}" == "x" ]; then
- export ${1}=${2}
- elif [[ "${tmp}" != ${2} && "${tmp}" != ${2}:* && "${tmp}" != *:${2} && "${tmp}" != *:${2}:* ]]; then
- export ${1}=${2}:${tmp}
- fi
- }
- lm_license_file=${LM_LICENSE_FILE}
- path=${PATH}
- lang=${LANG}
- lc_ctype=${LC_CTYPE}
- lc_numeric=${LC_NUMERIC}
- ld_library_path=${LD_LIBRARY_PATH}
- # Architecture
- arch="32"
- brch=""
- uname -a | grep x86_64 > /dev/null
- if [ $? -eq 0 ]; then
- arch="64"
- brch="_x86_64"
- fi
- echo "Xilinx tools configuration:"
- indent
- log $'Selected architecture:'
- indent
- if [ "x${XILINX_ARCH}" = "x" ]; then
- XILINX_ARCH="${arch}"
- log "None, trying ${XILINX_ARCH} bits. Please set the XILINX_ARCH environment variable to 32 or 64 in order to change this"
- else
- log "${XILINX_ARCH} bits. Please set the XILINX_ARCH environment variable to 32 or 64 in order to change this"
- fi
- dedent
- for tool in "${!tools[@]}"; do
- TOOL=${tools[$tool]}
- v="XILINX_${TOOL}_VERSION"
- if [ "x${!v}" = "x" ]; then
- version=Default
- else
- version="${!v}"
- fi
- if [ -d "${ROOTDIR}/$tool" ]; then
- log "${tool}:"
- indent
- log "Selected version: ${version}. Please set the XILINX_${TOOL}_VERSION environment variable to change this. Available versions:"
- indent
- for n in ${ROOTDIR}/${tool}/*; do
- n=$(basename "${n}")
- log "${n}"
- done
- dedent
- log "Configuring ${tool}:"
- indent
- root="${ROOTDIR}/${tool}/${version}"
- if [ "${tool}" = "ISE" ]; then
- root+="/ISE_DS"
- fi
- if [ -f "${root}/settings${XILINX_ARCH}.sh" ]; then
- log "source ${root}/settings${XILINX_ARCH}.sh"
- source ${root}/settings${XILINX_ARCH}.sh
- else
- log "${root} does not seam to be a valid installation directory for ${tool} (${version} version) ${arch} bits. Skipping ${tool} configuration."
- fi
- dedent
- dedent
- elif [ "x${!v}" != "x" ]; then
- log "Could not find installation directory of ${tool} (${version} version) ${arch} bits. Skipping ${tool} configuration."
- fi
- done
- # Licenses
- log "Licenses:"
- indent
- export LM_LICENSE_FILE="27000@lmgrd"
- log "LM_LICENSE_FILE=${LM_LICENSE_FILE}"
- dedent
- # Locales
- export LANG="en_US.UTF-8"
- export LC_CTYPE="en_US.UTF-8"
- export LC_NUMERIC="en_US.UTF-8"
- # Prompt, message
- cp=0
- for V in LM_LICENSE_FILE PATH LD_LIBRARY_PATH LANG LC_CTYPE LC_NUMERIC; do
- v=${V,,}
- if [ "x${!V}" != "x${!v}" ]; then
- log "Warning: the $V environment variable has been modified:"
- indent
- log "Was: ${!v}"
- log "Now: ${!V}"
- dedent
- cp=1
- fi
- done
- if [ "$cp" == 1 ]; then
- log 'The prompt is modified to reflect these changes.'
- PS1="\[\e[0;31m\]XILINX\[\e[0m\] $PS1"
- fi
- echo "$str"
- str=''
- tab=''
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement