Bladeren bron

Add removedir= argument; use cd ; pwd -P to obtain absolute path; use defs.h header in gdb_get_stdin.c source

git-svn-id: trunk@31816 -
pierre 10 jaren geleden
bovenliggende
commit
4cb5a35228
1 gewijzigde bestanden met toevoegingen van 35 en 5 verwijderingen
  1. 35 5
      packages/gdbint/gen-gdblib-inc.sh

+ 35 - 5
packages/gdbint/gen-gdblib-inc.sh

@@ -13,6 +13,7 @@ usage ()
   echo "should be copied."
   echo "Possible parameters for this script:"
   echo "--forcestatic, to convert all -lname into $LINKLIB libname.a"
+  echo "removedir=\"space separated list of directories to remove\""
   echo "implicitlibs=\"space separated list of used system libraries\""
   echo "libdir=\"space separated list of library directories\""
 }
@@ -146,12 +147,20 @@ if [ "${1#libdir=}" != "$1" ]; then
   opt_handled=1
 fi
 
-if [ "${1//=/ }" != "$1" ]; then
-  # Some variable set explicitly
-  echo "Evaluating $1"
-  export $1
+if [ "${1#removedir=}" != "$1" ]; then
+  removedir=${1#removedir=}
+  echo "removedir is set to \"$removedir\""
   opt_handled=1
 fi
+
+if [ $opthandled -eq 0 ] ; then
+  if [ "${1//=/ }" != "$1" ]; then
+    # Some variable set explicitly
+    echo "Evaluating \"$1\""
+    export "$1"
+    opt_handled=1
+  fi
+fi
 }
 
 # Try to handle all command line options
@@ -188,7 +197,7 @@ ${MAKE} gdb${EXEEXT} ${MAKEOPT} LDFLAGS="$LDFLAGS" 2>&1 | tee make.log
 # To avoid stdin macro expansion hell.
 
 cat > gdb_get_stdin.c <<EOF
-#include "stdio.h"
+#include "defs.h"
 
 /* Missing prototypes.  */
 
@@ -301,6 +310,27 @@ if [ "$gcccompiler" != "" ]; then
   fi
 fi
 
+newlibdir=
+for dir in $libdir ; do
+  echo "Handling dir $dir"
+  newdir=`cd $dir 2> /dev/null && pwd -P`
+  if [ "X$newdir" != "X" ] ; then
+    adddir=1
+    for rdir in $removedir ; do
+      if [ "$rdir" == "$newdir" ] ; then
+        adddir=0
+      fi
+    done
+    if [ $adddir -eq 1 ] ; then
+      newlibdir="$newlibdir $newdir"
+      echo "Adding $dir as $newdir"
+    fi
+  else
+    echo "$dir not found"
+  fi
+done
+libdir="$newlibdir"
+
 # Try to locate all libraries
 echo Creating ./copy-libs.sh script
 has_libgdb=`cat comp-cmd.log | grep "libgdb\.a"`