From dd8b76f5cf3a97f82d787b1c98702ec2ae29796a Mon Sep 17 00:00:00 2001 From: binaryfz Date: Tue, 16 Mar 2021 14:47:51 +0800 Subject: [PATCH] fix a env path bug --- build/envsetup.sh | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/build/envsetup.sh b/build/envsetup.sh index 5e6a761b92..2556441de8 100644 --- a/build/envsetup.sh +++ b/build/envsetup.sh @@ -20,12 +20,39 @@ function print_usage { echo " " } +function gettop { + local TOPFILE=build/core/maple_variables.mk + if [ -n "$TOP" -a -f "$TOP/$TOPFILE" ] ; then + # The following circumlocution ensures we remove symlinks from TOP. + (cd $TOP; PWD= /bin/pwd) + else + if [ -f $TOPFILE ] ; then + # The following circumlocution (repeated below as well) ensures + # that we record the true directory name and not one that is + # faked up with symlink names. + #PWD= /bin/pwd + /bin/pwd -L + else + local HERE=$PWD + local T= + while [ \( ! \( -f $TOPFILE \) \) -a \( $PWD != "/" \) ]; do + \cd .. + T=`PWD= /bin/pwd -P` + done + \cd $HERE + if [ -f "$T/$TOPFILE" ]; then + echo $T + fi + fi + fi +} + if [ "$#" -lt 2 ]; then print_usage # return fi -curdir=$(pwd) +curdir=$(gettop) export MAPLE_ROOT=${curdir} export CASE_ROOT=${curdir}/testsuite export OUT_ROOT=${curdir}/output -- Gitee