Skip to content

Commit e723eb6

Browse files
Cleanup checking of GPR_PROJECT_PATH
1 parent 7b80462 commit e723eb6

File tree

1 file changed

+18
-4
lines changed

1 file changed

+18
-4
lines changed

experiments/list_unsupported.sh

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,19 +61,33 @@ if ! (gnat --version | grep -q 'GNAT GPL 2016') ; then
6161
exit 5
6262
fi
6363

64+
# Sane ADA_INCLUDE_PATH and GPR_PROJECT_PATH?
6465
GNAT2GOTO=`command -v gnat2goto`
6566
ADA_HOME=`command -v gnat`
66-
ADA_HOME="$(dirname "$ADA_HOME")/.."
67+
ADA_HOME=$(cd "$(dirname ${ADA_HOME})/.." 2>/dev/null && pwd)
6768
PLATFORM=`${ADA_HOME}/bin/gcc -dumpmachine`
6869
DEF_ADA_INCLUDE_PATH="${ADA_HOME}/lib/gcc/${PLATFORM}"
6970
ADA_GCC_VERSION=`${ADA_HOME}/bin/gcc -dumpversion`
7071
DEF_ADA_INCLUDE_PATH="${DEF_ADA_INCLUDE_PATH}/${ADA_GCC_VERSION}/rts-native/adainclude:${ADA_HOME}/include"
7172
export ADA_INCLUDE_PATH="${ADA_INCLUDE_PATH:-$DEF_ADA_INCLUDE_PATH}"
7273

73-
export GPR_PROJECT_PATH="${GPR_PROJECT_PATH:-/opt/gnat/lib/gnat}"
74-
if [ ! -d "$GPR_PROJECT_PATH" ]; then
75-
echo >&2 "GPR project path does not exists!"
74+
if [ -n "$GPR_PROJECT_PATH" -a ! -d "$GPR_PROJECT_PATH" ]; then
75+
echo >&2 "GPR project path environment variable has been set to:"
76+
echo >&2 " \"${GPR_PROJECT_PATH}\""
77+
echo >&2 "but that path is not a directory."
78+
echo >&2 "Please set the environment variable GPR_PROJECT_PATH to the"
79+
echo >&2 "location of the gnat libraries"
7680
exit 6
81+
else
82+
# GPR_PROJECT_PATH not previously specified, use a default
83+
export GPR_PROJECT_PATH="${ADA_HOME}/lib/gnat"
84+
if [ ! -d "$GPR_PROJECT_PATH" ]; then
85+
echo >&2 "Could not find gnat library directory at ${GPR_PROJECT_PATH}"
86+
echo >&2 "Please set the environment variable GPR_PROJECT_PATH to the"
87+
echo >&2 "location of the gnat libraries"
88+
exit 9
89+
fi
90+
fi
7791
fi
7892

7993
# Enumerate all the sub directories of ADA_INCLUDE_PATH

0 commit comments

Comments
 (0)