* Use gsed if present and temp directory to avoid system recompilation

git-svn-id: trunk@22169 -
This commit is contained in:
pierre 2012-08-22 09:43:34 +00:00
parent e719c73860
commit 4ecd67f6e2

View File

@ -11,8 +11,14 @@ if [ "$1" == "clean" ] ; then
exit exit
fi fi
gsed -n "s:ESysE\(.*\)[[:space:]]*=[[:space:]]*\([[:space:]0-9]*\);: test_errnostr E\1 \2 :p" errno.inc | \ # Use gsed if present
gsed "s:':'':g" > check_errnostr_list.sh SED=`which gsed`
if [ "$SED" == "" ] ; then
SED=sed
fi
$SED -n "s:ESysE\(.*\)[[:space:]]*=[[:space:]]*\([[:space:]0-9]*\);: test_errnostr E\1 \2 :p" errno.inc | \
$SED "s:':'':g" > check_errnostr_list.sh
if [ "$1" == "verbose" ] ; then if [ "$1" == "verbose" ] ; then
verbose=1 verbose=1
@ -24,7 +30,13 @@ fi
# Reverse 'error string', { ENUMBER } # Reverse 'error string', { ENUMBER }
# to ENUMBER string # to ENUMBER string
gsed -n -e "s|[^']*\('.*'\)[[:space:]]*,*[[:space:]]*{[[:space:]]*\(E[A-Za-z_0-9]*\).*|(Number : ESys\2; NumberStr : '\2'; Str : \1),|p" errnostr.inc > errnostrlst.inc $SED -n -e "s|[^']*\('.*'\)[[:space:]]*,*[[:space:]]*{[[:space:]]*\(E[A-Za-z_0-9]*\).*|(Number : ESys\2; NumberStr : '\2'; Str : \1),|p" errnostr.inc > errnostrlst.inc
# Use temp directory to avoid
# re-compilation of system unit
mkdir .testtmp
cd .testtmp
# Free Pascal source including # Free Pascal source including
# errnostr.inc file # errnostr.inc file
@ -108,11 +120,14 @@ begin
end. end.
EOF EOF
fpc $fpcopt ./testerrnostr.pp fpc $fpcopt -Fi.. -o../testerrnostr ./testerrnostr.pp
res=$? res=$?
cd ..
if [ $res -ne 0 ] ; then if [ $res -ne 0 ] ; then
echo "Compilation of testerrnostr.pp failed" echo "Compilation of testerrnostr.pp failed"
exit exit
else
rm -Rf .testtmp
fi fi
export verbose export verbose