Browse Source

+ Handler -dynamic-linker correctly, i.e.
skip next argument.
+ Add all library paths as $LIBRARYPATH and $OBJECTPATH
at the end of gdblib.inc to be able to parse it
directly in main fp.pas IDE program source
(This solves the warning about crtbegin.o not found,
at least for sparc-linux machine).

git-svn-id: trunk@24916 -

pierre 12 years ago
parent
commit
59d29b6c91
1 changed files with 23 additions and 3 deletions
  1. 23 3
      packages/gdbint/gen-gdblib-inc.sh

+ 23 - 3
packages/gdbint/gen-gdblib-inc.sh

@@ -300,6 +300,7 @@ fi
 cat comp-cmd.log | ${AWK} -v libdir="${libdir}" -v implibs="${implicitlibs}" \
 cat comp-cmd.log | ${AWK} -v libdir="${libdir}" -v implibs="${implicitlibs}" \
   -v add_libgdb=${add_libgdb} '
   -v add_libgdb=${add_libgdb} '
 BEGIN {
 BEGIN {
+  isdynlinker=0
   print "#!/usr/bin/env bash"
   print "#!/usr/bin/env bash"
   print "# copy-libs.sh generated by awk script"
   print "# copy-libs.sh generated by awk script"
   print "INSTALL=`which ginstall 2> /dev/null `"
   print "INSTALL=`which ginstall 2> /dev/null `"
@@ -333,6 +334,11 @@ BEGIN {
       staticlib = gensub (/([^ ]*)(lib[^ ]*\.a)/,"\\1\\2 ","g",list[i]);
       staticlib = gensub (/([^ ]*)(lib[^ ]*\.a)/,"\\1\\2 ","g",list[i]);
       print "cp -p " staticlib " ${destdir}";
       print "cp -p " staticlib " ${destdir}";
     }
     }
+    if ( list[i] ~ /^-dynamic-linker$/ ) {
+      i++;
+      print "echo dynamic linker " list[i] " skipped";
+      continue
+    }
     if ( list[i] ~ /lib[^ ]*\.so/ ) {
     if ( list[i] ~ /lib[^ ]*\.so/ ) {
       dynamiclib = gensub (/([^ ]*)(lib[^ ]*\.so)/,"\\1\\2 ","g",list[i]);
       dynamiclib = gensub (/([^ ]*)(lib[^ ]*\.so)/,"\\1\\2 ","g",list[i]);
       print "echo " dynamiclib " found";
       print "echo " dynamiclib " found";
@@ -370,7 +376,8 @@ chmod u+x ./copy-libs.sh
 
 
 echo Creating ./gdblib.inc file
 echo Creating ./gdblib.inc file
 # Generate gdblib.inc file
 # Generate gdblib.inc file
-cat comp-cmd.log |${AWK} -v gdbcvs=${gdbcvs} -v implibs="${implicitlibs}" \
+cat comp-cmd.log |${AWK} -v gdbcvs=${gdbcvs} \
+  -v implibs="${implicitlibs}" -v libdir="${libdir}" \
   -v gdbversion=${gdbversion} -v forcestatic=${forcestatic} \
   -v gdbversion=${gdbversion} -v forcestatic=${forcestatic} \
   -v has_get_stdin=${has_get_stdin} -v add_libgdb=${add_libgdb} '
   -v has_get_stdin=${has_get_stdin} -v add_libgdb=${add_libgdb} '
 BEGIN {
 BEGIN {
@@ -397,12 +404,17 @@ BEGIN {
       use_mingw=1
       use_mingw=1
       }
       }
     }
     }
+    if ( list[i] ~ /^-dynamic-linker$/ ) {
+      i++;
+      print "{ Dynamic linker found " list[i] " }";
+      continue
+    }
     if ( list[i] ~ /-D__USE_MINGW_/ ) {
     if ( list[i] ~ /-D__USE_MINGW_/ ) {
       use_mingw=1
       use_mingw=1
     }
     }
     if ( list[i] ~ /lib[^ ]*\.so/ ) {
     if ( list[i] ~ /lib[^ ]*\.so/ ) {
-      dynamiclib = gensub (/([^ ]*)(lib[^ ]*\.so)/,"{$LINKLIB \\2} { found in \\1 }","g",list[i]);
-      librarypath = gensub (/([^ ]*)(lib[^ ]*\.so)/,"{$LIBRARYPATH \\1} { for \\2 }","g",list[i]);
+      dynamiclib = gensub (/([^ ]*)(lib[^ ]*\.so[^ ]*)(.*)/,"{$LINKLIB \\2} { found in \\1 \\3 }","g",list[i]);
+      librarypath = gensub (/([^ ]*)(lib[^ ]*\.so[^ ]*)(.*)/,"{$LIBRARYPATH \\1} { for \\2 \\3 }","g",list[i]);
       print dynamiclib;
       print dynamiclib;
       print librarypath;
       print librarypath;
     }
     }
@@ -419,6 +431,7 @@ BEGIN {
   }
   }
 }
 }
 END {
 END {
+  print "{ List implicit libraries }"
   nb = split (implibs,list);
   nb = split (implibs,list);
   for (i=1;i<=nb; i++) {
   for (i=1;i<=nb; i++) {
     if ( list[i] ~ /lib.*\.a/ ) {
     if ( list[i] ~ /lib.*\.a/ ) {
@@ -433,6 +446,13 @@ END {
     print "{$LINKLIB " lib "} { implicit library } "
     print "{$LINKLIB " lib "} { implicit library } "
   }
   }
   print "{$endif COMPILING_GDBINT_UNIT }"
   print "{$endif COMPILING_GDBINT_UNIT }"
+  print "{ List library dirs }"
+  nb = split (libdir,list);
+  for (i=1;i<=nb; i++) {
+    dir=list[i];
+    print "{$LIBRARYPATH " dir "} { library path } "
+    print "{$OBJECTPATH " dir "} { library path } "
+  }
   print "{$undef NotImplemented}"
   print "{$undef NotImplemented}"
   if ( use_mingw == 1 ) {
   if ( use_mingw == 1 ) {
     print "{$define USE_MINGW_GDB}"
     print "{$define USE_MINGW_GDB}"