aboutsummaryrefslogtreecommitdiffstats
path: root/libraries/vendors/shared.sh
diff options
context:
space:
mode:
authorPatrick Lehmann <Patrick.Lehmann@tu-dresden.de>2016-06-20 07:52:44 +0200
committertgingold <tgingold@users.noreply.github.com>2016-06-20 07:52:44 +0200
commitf2b83716c79e7c6123aa9b6215a6dc6ac1c9d83b (patch)
tree0c8aa39c2da9eee985242342f9ef7718a023075e /libraries/vendors/shared.sh
parente2587eb9137f627f4ec51a80dfe641394197d975 (diff)
downloadghdl-f2b83716c79e7c6123aa9b6215a6dc6ac1c9d83b.tar.gz
ghdl-f2b83716c79e7c6123aa9b6215a6dc6ac1c9d83b.tar.bz2
ghdl-f2b83716c79e7c6123aa9b6215a6dc6ac1c9d83b.zip
Compile scripts: Implemented a default installation directory guessing. Fixed minor issues (see #85). (#88)
Diffstat (limited to 'libraries/vendors/shared.sh')
-rw-r--r--libraries/vendors/shared.sh22
1 files changed, 15 insertions, 7 deletions
diff --git a/libraries/vendors/shared.sh b/libraries/vendors/shared.sh
index 690e5008b..6becba2ef 100644
--- a/libraries/vendors/shared.sh
+++ b/libraries/vendors/shared.sh
@@ -1,4 +1,3 @@
-#! /bin/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;
@@ -54,22 +53,25 @@ SetupDirectories() {
Index=$1
Name=$2
- SourceDirectory=${SourceDirectories[$Index]}
- DestinationDirectory=${DestinationDirectories[$Index]}
-
# source directory
# ----------------------
# If a command line argument ('--src') was passed in, use it, else use the default value
# from config.sh
if [ ! -z "$SrcDir" ]; then
- SourceDirectory=$SrcDir
+ SourceDirectory=${SrcDir%/} # remove trailing slashes
+ elif [ ! -z "$EnvSourceDir" ]; then
+ SourceDirectory=$EnvSourceDir # fall back to environment variable
+ elif [ ! -z "${InstallationDirectories[$Index]}" ]; then
+ SourceDirectory=${InstallationDirectories[$Index]}/${SourceDirectories[$Index]} # fall back to value from config.sh
fi
# output directory
# ----------------------
# If a command line argument ('--out') was passed in, use it, else use the default value
# from config.sh
if [ ! -z "$DestDir" ]; then
- DestinationDirectory=$DestDir
+ DestinationDirectory=${DestDir%/} # remove trailing slashes
+ else
+ DestinationDirectory=${DestinationDirectories[$Index]} # fall back to value from config.sh
fi
if [ -z $SourceDirectory ] || [ -z $DestinationDirectory ]; then
@@ -87,11 +89,17 @@ SetupDirectories() {
# Use GHDL binary directory from command line argument, if set
if [ ! -z "$GHDLBinDir" ]; then
- GHDLBinary=$GHDLBinDir/ghdl
+ 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}"
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}"
+ exit -1
+ fi
+ GHDLBinary=$GHDL
else # fall back to GHDL found via PATH
GHDLBinary=$(which ghdl 2>/dev/null)
if [ $? -ne 0 ]; then