aboutsummaryrefslogtreecommitdiffstats
path: root/libraries/vendors
diff options
context:
space:
mode:
authorPatrick Lehmann <Patrick.Lehmann@tu-dresden.de>2016-06-21 00:42:19 +0200
committerPatrick Lehmann <Patrick.Lehmann@tu-dresden.de>2016-06-21 00:42:19 +0200
commitbbac47a54fabf812db845329b674b83f1cfd39fb (patch)
tree59c62d41cedafa9cd18238359c1f9ae4fdc365ff /libraries/vendors
parentf2b83716c79e7c6123aa9b6215a6dc6ac1c9d83b (diff)
downloadghdl-bbac47a54fabf812db845329b674b83f1cfd39fb.tar.gz
ghdl-bbac47a54fabf812db845329b674b83f1cfd39fb.tar.bz2
ghdl-bbac47a54fabf812db845329b674b83f1cfd39fb.zip
Implemented a work around for Mac OS.
Diffstat (limited to 'libraries/vendors')
-rwxr-xr-xlibraries/vendors/compile-altera.sh17
-rwxr-xr-xlibraries/vendors/compile-lattice.sh29
-rwxr-xr-xlibraries/vendors/compile-osvvm.sh11
-rwxr-xr-xlibraries/vendors/compile-vunit.sh11
-rwxr-xr-xlibraries/vendors/compile-xilinx-ise.sh17
-rwxr-xr-xlibraries/vendors/compile-xilinx-vivado.sh13
-rw-r--r--libraries/vendors/config.sh14
-rw-r--r--libraries/vendors/shared.sh49
8 files changed, 92 insertions, 69 deletions
diff --git a/libraries/vendors/compile-altera.sh b/libraries/vendors/compile-altera.sh
index afb2ffbae..1b20d417e 100755
--- a/libraries/vendors/compile-altera.sh
+++ b/libraries/vendors/compile-altera.sh
@@ -1,4 +1,4 @@
-#! /bin/bash
+#! /usr/bin/env bash
# EMACS settings: -*- tab-width: 2; indent-tabs-mode: t -*-
# vim: tabstop=2:shiftwidth=2:noexpandtab
# kate: tab-width 2; replace-tabs off; indent-width 2;
@@ -35,10 +35,13 @@
# ==============================================================================
# ---------------------------------------------
+# work around for Darwin (Mac OS)
+READLINK=readlink; if [[ $(uname) == "Darwin" ]]; then READLINK=greadlink; fi
+
# save working directory
WorkingDir=$(pwd)
ScriptDir="$(dirname $0)"
-ScriptDir="$(readlink -f $ScriptDir)"
+ScriptDir="$($READLINK -f $ScriptDir)"
# source configuration file from GHDL's 'vendors' library directory
source $ScriptDir/config.sh
@@ -110,9 +113,9 @@ while [[ $# > 0 ]]; do
;;
--vhdl2008)
VHDLStandard=2008
- echo 1>&2 -e "${COLORED_ERROR} VHDL-2008 is not yet supported by Altera.${ANSI_RESET}"
- echo 1>&2 -e "${ANSI_YELLOW}Possible workaround: ${ANSI_RESET}"
- echo 1>&2 -e "${ANSI_YELLOW} Compile 'std_logic_arith' and 'std_logic_unsigned' into library IEEE.${ANSI_RESET}"
+ echo 1>&2 -e "${COLORED_ERROR} VHDL-2008 is not yet supported by Altera.${ANSI_NOCOLOR}"
+ echo 1>&2 -e "${ANSI_YELLOW}Possible workaround: ${ANSI_NOCOLOR}"
+ echo 1>&2 -e "${ANSI_YELLOW} Compile 'std_logic_arith' and 'std_logic_unsigned' into library IEEE.${ANSI_NOCOLOR}"
exit -1
;;
--ghdl)
@@ -128,7 +131,7 @@ while [[ $# > 0 ]]; do
shift # skip argument
;;
*) # unknown option
- echo 1>&2 -e "${COLORED_ERROR} Unknown command line option.${ANSI_RESET}"
+ echo 1>&2 -e "${COLORED_ERROR} Unknown command line option '$key'.${ANSI_NOCOLOR}"
exit -1
;;
esac
@@ -249,7 +252,7 @@ ERRORCOUNT=0
if [ "$CLEAN" == "TRUE" ]; then
echo 1>&2 -e "${COLORED_ERROR} '--clean' is not implemented!"
exit -1
- echo -e "${ANSI_YELLOW}Cleaning up vendor directory ...${ANSI_RESET}"
+ echo -e "${ANSI_YELLOW}Cleaning up vendor directory ...${ANSI_NOCOLOR}"
rm *.o 2> /dev/null
rm *.cf 2> /dev/null
fi
diff --git a/libraries/vendors/compile-lattice.sh b/libraries/vendors/compile-lattice.sh
index 860024d6c..57d7f883a 100755
--- a/libraries/vendors/compile-lattice.sh
+++ b/libraries/vendors/compile-lattice.sh
@@ -1,4 +1,4 @@
-#! /bin/bash
+#! /usr/bin/env bash
# EMACS settings: -*- tab-width: 2; indent-tabs-mode: t -*-
# vim: tabstop=2:shiftwidth=2:noexpandtab
# kate: tab-width 2; replace-tabs off; indent-width 2;
@@ -36,10 +36,13 @@
# ==============================================================================
# ---------------------------------------------
+# work around for Darwin (Mac OS)
+READLINK=readlink; if [[ $(uname) == "Darwin" ]]; then READLINK=greadlink; fi
+
# save working directory
WorkingDir=$(pwd)
ScriptDir="$(dirname $0)"
-ScriptDir="$(readlink -f $ScriptDir)"
+ScriptDir="$($READLINK -f $ScriptDir)"
DeviceList="ec ecp ecp2 ecp3 ecp5u lptm lptm2 machxo machxo2 machxo3l sc scm xp xp2"
@@ -90,9 +93,9 @@ while [[ $# > 0 ]]; do
;;
--vhdl2008)
VHDLStandard=2008
- echo 1>&2 -e "${COLORED_ERROR} VHDL-2008 is not yet supported by Lattice.${ANSI_RESET}"
- # echo 1>&2 -e "${ANSI_YELLOW}Possible workaround: ${ANSI_RESET}"
- # echo 1>&2 -e "${ANSI_YELLOW} Compile 'std_logic_arith' and 'std_logic_unsigned' into library IEEE.${ANSI_RESET}"
+ echo 1>&2 -e "${COLORED_ERROR} VHDL-2008 is not yet supported by Lattice.${ANSI_NOCOLOR}"
+ # echo 1>&2 -e "${ANSI_YELLOW}Possible workaround: ${ANSI_NOCOLOR}"
+ # echo 1>&2 -e "${ANSI_YELLOW} Compile 'std_logic_arith' and 'std_logic_unsigned' into library IEEE.${ANSI_NOCOLOR}"
exit -1
;;
--ghdl)
@@ -108,7 +111,7 @@ while [[ $# > 0 ]]; do
shift # skip argument
;;
*) # unknown option
- echo 1>&2 -e "${COLORED_ERROR} Unknown command line option.${ANSI_RESET}"
+ echo 1>&2 -e "${COLORED_ERROR} Unknown command line option '$key'.${ANSI_NOCOLOR}"
exit -1
;;
esac
@@ -159,14 +162,14 @@ fi
DefaultDirectories=("/usr/local/diamond" "/opt/Diamond" "/opt/diamond")
if [ ! -z $LSC_DIAMOND ]; then
- EnvSourceDir=$FOUNDRY/../cae_library/simulation/vhdl
+ EnvSourceDir=$FOUNDRY/../${SourceDirectories[LatticeDiamond]}
else
for DefaultDir in ${DefaultDirectories[@]}; do
for Major in 3; do
for Minor in 8 7 6 5; do
Dir=$DefaultDir/${Major}.${Minor}_x64
if [ -d $Dir ]; then
- EnvSourceDir=$Dir/cae_library/simulation/vhdl
+ EnvSourceDir=$Dir/${SourceDirectories[LatticeDiamond]}
break 3
fi
done
@@ -208,7 +211,7 @@ GHDL_OPTIONS=(-fexplicit -frelaxed-rules --no-vital-checks --warn-binding --mb-c
GHDL_PARAMS=(${GHDL_OPTIONS[@]})
-GHDL_PARAMS+=(--ieee=$VHDLFlavor --std=$VHDLStandard -P$DestinationDirectory)
+GHDL_PARAMS+=(--ieee=$VHDLFlavor --std=$VHDLStandard)
STOPCOMPILING=0
@@ -219,7 +222,7 @@ ERRORCOUNT=0
if [ "$CLEAN" == "TRUE" ]; then
echo 1>&2 -e "${COLORED_ERROR} '--clean' is not implemented!"
exit -1
- echo -e "${ANSI_YELLOW}Cleaning up vendor directory ...${ANSI_RESET}"
+ echo -e "${ANSI_YELLOW}Cleaning up vendor directory ...${ANSI_NOCOLOR}"
rm *.o 2> /dev/null
rm *.cf 2> /dev/null
fi
@@ -248,7 +251,7 @@ for device in $DeviceList; do
LibraryDirectory=$DestinationDirectory/$Library/$VHDLVersion
mkdir -p $LibraryDirectory
cd $LibraryDirectory
- echo -e "${ANSI_YELLOW}Compiling library '$Library'...${ANSI_RESET}"
+ echo -e "${ANSI_YELLOW}Compiling library '$Library'...${ANSI_NOCOLOR}"
DeviceSourceDirectory="$SourceDirectory/$device/src"
for File in ${FileLists[$device]}; do
@@ -256,9 +259,9 @@ for device in $DeviceList; do
FileName=$(basename "$File")
FileName="${device}_$FileName"
if [ $SKIP_EXISTING_FILES -eq 1 ] && [ -e "${FileName%.*}.o" ]; then
- echo -e "${ANSI_CYAN}Skipping file '$File'${ANSI_RESET}"
+ echo -e "${ANSI_CYAN}Skipping file '$File'${ANSI_NOCOLOR}"
else
- echo -e "${ANSI_CYAN}Analyzing file '$File'${ANSI_RESET}"
+ echo -e "${ANSI_CYAN}Analyzing file '$File'${ANSI_NOCOLOR}"
$GHDLBinary -a ${GHDL_PARAMS[@]} --work=$Library "$File" 2>&1 | $GRC_COMMAND
if [ $? -ne 0 ]; then
let ERRORCOUNT++
diff --git a/libraries/vendors/compile-osvvm.sh b/libraries/vendors/compile-osvvm.sh
index f7bbdba5f..f9f3b05d3 100755
--- a/libraries/vendors/compile-osvvm.sh
+++ b/libraries/vendors/compile-osvvm.sh
@@ -1,4 +1,4 @@
-#! /bin/bash
+#! /usr/bin/env bash
# EMACS settings: -*- tab-width: 2; indent-tabs-mode: t -*-
# vim: tabstop=2:shiftwidth=2:noexpandtab
# kate: tab-width 2; replace-tabs off; indent-width 2;
@@ -34,10 +34,13 @@
# ==============================================================================
# ---------------------------------------------
+# work around for Darwin (Mac OS)
+READLINK=readlink; if [[ $(uname) == "Darwin" ]]; then READLINK=greadlink; fi
+
# save working directory
WorkingDir=$(pwd)
ScriptDir="$(dirname $0)"
-ScriptDir="$(readlink -f $ScriptDir)"
+ScriptDir="$($READLINK -f $ScriptDir)"
# source configuration file from GHDL's 'vendors' library directory
source $ScriptDir/config.sh
@@ -88,7 +91,7 @@ while [[ $# > 0 ]]; do
shift # skip argument
;;
*) # unknown option
- echo 1>&2 -e "${COLORED_ERROR} Unknown command line option.${ANSI_RESET}"
+ echo 1>&2 -e "${COLORED_ERROR} Unknown command line option '$key'.${ANSI_NOCOLOR}"
exit -1
;;
esac
@@ -170,7 +173,7 @@ GHDL_OPTIONS=(-fexplicit -frelaxed-rules --no-vital-checks --warn-binding --mb-c
# Cleanup directory
# ==============================================================================
if [ "$CLEAN" == "TRUE" ]; then
- echo -e "${ANSI_YELLOW}Cleaning up directory ...${ANSI_RESET}"
+ echo -e "${ANSI_YELLOW}Cleaning up directory ...${ANSI_NOCOLOR}"
rm *.o 2> /dev/null
rm *.cf 2> /dev/null
fi
diff --git a/libraries/vendors/compile-vunit.sh b/libraries/vendors/compile-vunit.sh
index 1bdace797..f5a7c64e0 100755
--- a/libraries/vendors/compile-vunit.sh
+++ b/libraries/vendors/compile-vunit.sh
@@ -1,4 +1,4 @@
-#! /bin/bash
+#! /usr/bin/env bash
# EMACS settings: -*- tab-width: 2; indent-tabs-mode: t -*-
# vim: tabstop=2:shiftwidth=2:noexpandtab
# kate: tab-width 2; replace-tabs off; indent-width 2;
@@ -34,10 +34,13 @@
# ==============================================================================
# ---------------------------------------------
+# work around for Darwin (Mac OS)
+READLINK=readlink; if [[ $(uname) == "Darwin" ]]; then READLINK=greadlink; fi
+
# save working directory
WorkingDir=$(pwd)
ScriptDir="$(dirname $0)"
-ScriptDir="$(readlink -f $ScriptDir)"
+ScriptDir="$($READLINK -f $ScriptDir)"
# source configuration file from GHDL's 'vendors' library directory
source $ScriptDir/config.sh
@@ -88,7 +91,7 @@ while [[ $# > 0 ]]; do
shift # skip argument
;;
*) # unknown option
- echo 1>&2 -e "${COLORED_ERROR} Unknown command line option.${ANSI_RESET}"
+ echo 1>&2 -e "${COLORED_ERROR} Unknown command line option '$key'.${ANSI_NOCOLOR}"
exit -1
;;
esac
@@ -167,7 +170,7 @@ GHDL_OPTIONS=(-fexplicit -frelaxed-rules --no-vital-checks --warn-binding --mb-c
# Cleanup directory
# ==============================================================================
if [ "$CLEAN" == "TRUE" ]; then
- echo -e "${ANSI_YELLOW}Cleaning up vendor directory ...${ANSI_RESET}"
+ echo -e "${ANSI_YELLOW}Cleaning up vendor directory ...${ANSI_NOCOLOR}"
rm *.o 2> /dev/null
rm *.cf 2> /dev/null
fi
diff --git a/libraries/vendors/compile-xilinx-ise.sh b/libraries/vendors/compile-xilinx-ise.sh
index 443322c0e..67fb51074 100755
--- a/libraries/vendors/compile-xilinx-ise.sh
+++ b/libraries/vendors/compile-xilinx-ise.sh
@@ -1,4 +1,4 @@
-#! /bin/bash
+#! /usr/bin/env bash
# EMACS settings: -*- tab-width: 2; indent-tabs-mode: t -*-
# vim: tabstop=2:shiftwidth=2:noexpandtab
# kate: tab-width 2; replace-tabs off; indent-width 2;
@@ -35,10 +35,13 @@
# ==============================================================================
# ---------------------------------------------
+# work around for Darwin (Mac OS)
+READLINK=readlink; if [[ $(uname) == "Darwin" ]]; then READLINK=greadlink; fi
+
# save working directory
WorkingDir=$(pwd)
ScriptDir="$(dirname $0)"
-ScriptDir="$(readlink -f $ScriptDir)"
+ScriptDir="$($READLINK -f $ScriptDir)"
# source configuration file from GHDL's 'vendors' library directory
source $ScriptDir/config.sh
@@ -115,7 +118,7 @@ while [[ $# > 0 ]]; do
shift # skip argument
;;
*) # unknown option
- echo 1>&2 -e "${COLORED_ERROR} Unknown command line option.${ANSI_RESET}"
+ echo 1>&2 -e "${COLORED_ERROR} Unknown command line option '$key'.${ANSI_NOCOLOR}"
exit -1
;;
esac
@@ -174,21 +177,21 @@ if [ "$COMPILE_ALL" == "TRUE" ]; then
fi
if [ $VHDLStandard -eq 2008 ]; then
- echo -e "${ANSI_RED}Not all Xilinx primitives are VHDL-2008 compatible! Setting HALT_ON_ERROR to FALSE.${ANSI_RESET}"
+ echo -e "${ANSI_RED}Not all Xilinx primitives are VHDL-2008 compatible! Setting HALT_ON_ERROR to FALSE.${ANSI_NOCOLOR}"
HALT_ON_ERROR=0
fi
DefaultDirectories=("/opt/Xilinx" "/opt/xilinx")
if [ ! -z $XILINX ]; then
- EnvSourceDir=$XILINX/vhdl/src
+ EnvSourceDir=$XILINX/${SourceDirectories[XilinxISE]}
else
for DefaultDir in ${DefaultDirectories[@]}; do
for Major in 14 13; do
for Minor in 7 6 5 4 3 2 1 0; do
Dir=$DefaultDir/${Major}.${Minor}/ISE_DS/ISE
if [ -d $Dir ]; then
- EnvSourceDir=$Dir/vhdl/src
+ EnvSourceDir=$Dir/${SourceDirectories[XilinxISE]}
break 3
fi
done
@@ -239,7 +242,7 @@ ERRORCOUNT=0
if [ "$CLEAN" == "TRUE" ]; then
echo 1>&2 -e "${COLORED_ERROR} '--clean' is not implemented!"
exit -1
- echo -e "${ANSI_YELLOW}Cleaning up vendor directory ...${ANSI_RESET}"
+ echo -e "${ANSI_YELLOW}Cleaning up vendor directory ...${ANSI_NOCOLOR}"
rm *.o 2> /dev/null
rm *.cf 2> /dev/null
fi
diff --git a/libraries/vendors/compile-xilinx-vivado.sh b/libraries/vendors/compile-xilinx-vivado.sh
index f825c3a1e..4ae2862fa 100755
--- a/libraries/vendors/compile-xilinx-vivado.sh
+++ b/libraries/vendors/compile-xilinx-vivado.sh
@@ -1,4 +1,4 @@
-#! /bin/bash
+#! /usr/bin/env bash
# EMACS settings: -*- tab-width: 2; indent-tabs-mode: t -*-
# vim: tabstop=2:shiftwidth=2:noexpandtab
# kate: tab-width 2; replace-tabs off; indent-width 2;
@@ -35,10 +35,13 @@
# ==============================================================================
# ---------------------------------------------
+# work around for Darwin (Mac OS)
+READLINK=readlink; if [[ $(uname) == "Darwin" ]]; then READLINK=greadlink; fi
+
# save working directory
WorkingDir=$(pwd)
ScriptDir="$(dirname $0)"
-ScriptDir="$(readlink -f $ScriptDir)"
+ScriptDir="$($READLINK -f $ScriptDir)"
# source configuration file from GHDL's 'vendors' library directory
source $ScriptDir/config.sh
@@ -111,7 +114,7 @@ while [[ $# > 0 ]]; do
shift # skip argument
;;
*) # unknown option
- echo 1>&2 -e "${COLORED_ERROR} Unknown command line option.${ANSI_RESET}"
+ echo 1>&2 -e "${COLORED_ERROR} Unknown command line option '$key'.${ANSI_NOCOLOR}"
exit -1
;;
esac
@@ -168,7 +171,7 @@ if [ "$COMPILE_ALL" == "TRUE" ]; then
fi
if [ $VHDLStandard -eq 2008 ]; then
- echo -e "${ANSI_RED}Not all Xilinx primitives are VHDL-2008 compatible! Setting HALT_ON_ERROR to FALSE.${ANSI_RESET}"
+ echo -e "${ANSI_RED}Not all Xilinx primitives are VHDL-2008 compatible! Setting HALT_ON_ERROR to FALSE.${ANSI_NOCOLOR}"
HALT_ON_ERROR=0
fi
@@ -233,7 +236,7 @@ ERRORCOUNT=0
if [ "$CLEAN" == "TRUE" ]; then
echo 1>&2 -e "${COLORED_ERROR} '--clean' is not implemented!"
exit -1
- echo -e "${ANSI_YELLOW}Cleaning up vendor directory ...${ANSI_RESET}"
+ echo -e "${ANSI_YELLOW}Cleaning up vendor directory ...${ANSI_NOCOLOR}"
rm *.o 2> /dev/null
rm *.cf 2> /dev/null
fi
diff --git a/libraries/vendors/config.sh b/libraries/vendors/config.sh
index 52cf6ec3d..a1cafd662 100644
--- a/libraries/vendors/config.sh
+++ b/libraries/vendors/config.sh
@@ -41,20 +41,20 @@
# compile script. Empty strings means not configured.
declare -A InstallationDirectories
InstallationDirectories[AlteraQuartus]="" # "/opt/altera/16.0/quartus"
-InstallationDirectories[XilinxISE]="" # "/opt/Xilinx/14.7/ISE_DS/ISE"
-InstallationDirectories[XilinxVivado]="" # "/opt/Xilinx/Vivado/2016.2"
InstallationDirectories[LatticeDiamond]="" # "/usr/local/diamond/3.7_x64"
-InstallationDirectories[OSVVM]="" # "~/git/github/osvvm"
-InstallationDirectories[VUnit]="" # "~/git/github/vunit"
+InstallationDirectories[OSVVM]="" # "~/git/github/osvvm"
+InstallationDirectories[VUnit]="" # "~/git/github/vunit"
+InstallationDirectories[XilinxISE]="" # "/opt/Xilinx/14.7/ISE_DS/ISE"
+InstallationDirectories[XilinxVivado]="" # "/opt/Xilinx/Vivado/2016.2"
# Configure preferred output directories for each library set:
declare -A DestinationDirectories
DestinationDirectories[AlteraQuartus]="altera"
+DestinationDirectories[LatticeDiamond]="lattice"
+DestinationDirectories[OSVVM]="." # "osvvm"
+DestinationDirectories[VUnit]="." # "vunit_lib"
DestinationDirectories[XilinxISE]="xilinx-ise"
DestinationDirectories[XilinxVivado]="xilinx-vivado"
-DestinationDirectories[LatticeDiamond]="lattice"
-DestinationDirectories[OSVVM]="." # "osvvm"
-DestinationDirectories[VUnit]="." # "vunit_lib"
# Declare source directories depending on the installation paths:
declare -A SourceDirectories
diff --git a/libraries/vendors/shared.sh b/libraries/vendors/shared.sh
index 6becba2ef..586e17010 100644
--- a/libraries/vendors/shared.sh
+++ b/libraries/vendors/shared.sh
@@ -36,15 +36,15 @@ ANSI_YELLOW="\e[33m"
ANSI_BLUE="\e[34m"
ANSI_MAGENTA="\e[35m"
ANSI_CYAN="\e[36;1m"
-ANSI_RESET="\e[0m"
+ANSI_NOCOLOR="\e[0m"
# red texts
-COLORED_ERROR="$ANSI_RED[ERROR]$ANSI_RESET"
-COLORED_FAILED="$ANSI_RED[FAILED]$ANSI_RESET"
+COLORED_ERROR="$ANSI_RED[ERROR]$ANSI_NOCOLOR"
+COLORED_FAILED="$ANSI_RED[FAILED]$ANSI_NOCOLOR"
# green texts
-COLORED_DONE="$ANSI_GREEN[DONE]$ANSI_RESET"
-COLORED_SUCCESSFUL="$ANSI_GREEN[SUCCESSFUL]$ANSI_RESET"
+COLORED_DONE="$ANSI_GREEN[DONE]$ANSI_NOCOLOR"
+COLORED_SUCCESSFUL="$ANSI_GREEN[SUCCESSFUL]$ANSI_NOCOLOR"
# set bash options
set -o pipefail
@@ -75,35 +75,37 @@ SetupDirectories() {
fi
if [ -z $SourceDirectory ] || [ -z $DestinationDirectory ]; then
- echo 1>&2 -e "${COLORED_ERROR} $Name is not configured in '$ScriptDir/config.sh'${ANSI_RESET}"
+ echo 1>&2 -e "${COLORED_ERROR} $Name is not configured in '$ScriptDir/config.sh'${ANSI_NOCOLOR}"
echo 1>&2 -e " Use adv. options '--src' and '--out' or configure 'config.sh'."
exit -1
elif [ ! -d $SourceDirectory ]; then
- echo 1>&2 -e "${COLORED_ERROR} Path '$SourceDirectory' does not exist.${ANSI_RESET}"
+ echo 1>&2 -e "${COLORED_ERROR} Path '$SourceDirectory' does not exist.${ANSI_NOCOLOR}"
exit -1
fi
# Resolve paths to an absolute paths
SourceDirectory=$(readlink -f $SourceDirectory)
- DestinationDirectory=$(readlink -f $DestinationDirectory)
+ if [[ ! "$DestinationDirectory" = /* ]]; then
+ DestinationDirectory=$WorkingDir/$DestinationDirectory
+ fi
# Use GHDL binary directory from command line argument, if set
if [ ! -z "$GHDLBinDir" ]; then
GHDLBinary=${GHDLBinDir%/}/ghdl # remove trailing slashes
if [[ ! -x "$GHDLBinary" ]]; then
- echo 1>&2 -e "${COLORED_ERROR} GHDL not found or is not executable.${ANSI_RESET}"
+ echo 1>&2 -e "${COLORED_ERROR} GHDL not found or is not executable.${ANSI_NOCOLOR}"
exit -1
fi
elif [ ! -z "$GHDL" ]; then
- if [[ ! -x "$GHDL" ]]; then
- echo 1>&2 -e "${COLORED_ERROR} Found GHDL1 environment variable, but GHDL is not executable.${ANSI_RESET}"
+ if [ ! \( -f "$GHDL" -a -x "$GHDL" \) ]; then
+ echo 1>&2 -e "${COLORED_ERROR} Found GHDL environment variable, but '$GHDL' is not executable.${ANSI_NOCOLOR}"
exit -1
fi
GHDLBinary=$GHDL
else # fall back to GHDL found via PATH
GHDLBinary=$(which ghdl 2>/dev/null)
if [ $? -ne 0 ]; then
- echo 1>&2 -e "${COLORED_ERROR} GHDL not found in PATH.${ANSI_RESET}"
+ echo 1>&2 -e "${COLORED_ERROR} GHDL not found in PATH.${ANSI_NOCOLOR}"
echo 1>&2 -e " Use adv. options '--ghdl' to set the GHDL binary directory."
exit -1
fi
@@ -122,10 +124,13 @@ SetupGRCat() {
}
CreateDestinationDirectory() {
- if [[ -d "$DestinationDirectory" ]]; then
- echo -e "${ANSI_YELLOW}Vendor directory '$DestinationDirectory' already exists.${ANSI_RESET}"
+ if [ -d "$DestinationDirectory" ]; then
+ echo -e "${ANSI_YELLOW}Vendor directory '$DestinationDirectory' already exists.${ANSI_NOCOLOR}"
+ elif [ -f "$DestinationDirectory" ]; then
+ echo 1>&2 -e "${COLORED_ERROR} Vendor directory '$DestinationDirectory' already exists as a file.${ANSI_NOCOLOR}"
+ exit -1
else
- echo -e "${ANSI_YELLOW}Creating vendor directory: '$DestinationDirectory'${ANSI_RESET}"
+ echo -e "${ANSI_YELLOW}Creating vendor directory: '$DestinationDirectory'${ANSI_NOCOLOR}"
mkdir -p "$DestinationDirectory"
fi
}
@@ -147,17 +152,17 @@ GHDLCompileLibrary() {
LibraryDirectory=$DestinationDirectory/$Library/$VHDLVersion
mkdir -p $LibraryDirectory
cd $LibraryDirectory
- echo -e "${ANSI_YELLOW}Compiling library '$Library'...${ANSI_RESET}"
+ echo -e "${ANSI_YELLOW}Compiling library '$Library'...${ANSI_NOCOLOR}"
for File in ${SourceFiles[@]}; do
FileName=$(basename "$File")
FileSize=($(wc -c $File))
if [ $SKIP_EXISTING_FILES -eq 1 ] && [ -e "${FileName%.*}.o" ]; then
- echo -e "${ANSI_CYAN}Skipping existing file '$File'${ANSI_RESET}"
+ echo -e "${ANSI_CYAN}Skipping existing file '$File'${ANSI_NOCOLOR}"
elif [ $SKIP_LARGE_FILES -eq 1 ] && [ ${FileSize[0]} -gt $LARGE_FILESIZE ]; then
- echo -e "${ANSI_CYAN}Skipping large file '$File'${ANSI_RESET}"
+ echo -e "${ANSI_CYAN}Skipping large file '$File'${ANSI_NOCOLOR}"
else
- echo -e "${ANSI_CYAN}Analyzing file '$File'${ANSI_RESET}"
+ echo -e "${ANSI_CYAN}Analyzing file '$File'${ANSI_NOCOLOR}"
$GHDLBinary -a ${GHDL_PARAMS[@]} --work=$Library "$File" 2>&1 | $GRC_COMMAND
if [ $? -ne 0 ]; then
let ERRORCOUNT++
@@ -173,14 +178,14 @@ GHDLCompilePackages() {
LibraryDirectory=$DestinationDirectory/$Library/$VHDLVersion
mkdir -p $LibraryDirectory
cd $LibraryDirectory
- echo -e "${ANSI_YELLOW}Compiling library '$Library'...${ANSI_RESET}"
+ echo -e "${ANSI_YELLOW}Compiling library '$Library'...${ANSI_NOCOLOR}"
for File in ${SourceFiles[@]}; do
FileName=$(basename "$File")
if [ $SKIP_EXISTING_FILES -eq 1 ] && [ -e "${FileName%.*}.o" ]; then
- echo -e "${ANSI_CYAN}Skipping existing package '$File'${ANSI_RESET}"
+ echo -e "${ANSI_CYAN}Skipping existing package '$File'${ANSI_NOCOLOR}"
else
- echo -e "${ANSI_CYAN}Analyzing package '$File'${ANSI_RESET}"
+ echo -e "${ANSI_CYAN}Analyzing package '$File'${ANSI_NOCOLOR}"
$GHDLBinary -a ${GHDL_PARAMS[@]} --work=$Library "$File" 2>&1 | $GRC_COMMAND
if [ $? -ne 0 ]; then
let ERRORCOUNT++