+ Script to generate libgdb directory

git-svn-id: trunk@14149 -
This commit is contained in:
pierre 2009-11-11 21:41:24 +00:00
parent 9f6f70830f
commit da59236bb3
2 changed files with 112 additions and 0 deletions

1
.gitattributes vendored
View File

@ -2285,6 +2285,7 @@ packages/gdbint/examples/mingw.pas svneol=native#text/plain
packages/gdbint/examples/symify.pp svneol=native#text/plain
packages/gdbint/examples/testgdb.pp svneol=native#text/plain
packages/gdbint/fpmake.pp svneol=native#text/plain
packages/gdbint/gen-gdblib-inc.sh svneol=native#text/plain
packages/gdbint/src/freadlin.pp svneol=native#text/x-pascal
packages/gdbint/src/gdbcon.pp svneol=native#text/plain
packages/gdbint/src/gdbint.pp svneol=native#text/plain

111
packages/gdbint/gen-gdblib-inc.sh Executable file
View File

@ -0,0 +1,111 @@
#!/bin/bash
if [ "$1" != "" ]; then
destdir=$1
fi
if [ "$PATHEXT" != "" ]; then
EXEEXT=.exe
else
EXEEXT=
fi
rm -f gdb${EXEEXT}
make | tee make.log
gdb_full_version=`sed -n "s:.*version.*\"\(.*\)\".*:\1:p" version.c`
gdb_version1=`sed -n "s:.*version.*\"\([0-9]*\)\.\([0-9]*\).*:\1:p" version.c`
gdb_version2=`sed -n "s:.*version.*\"\([0-9]*\)\.\([0-9]*\).*:\2:p" version.c`
gdb_version=`sed -n "s:.*version.*\"\([0-9]*\)\.\([0-9]*\).*:\1.\2:p" version.c`
echo found full version is ${gdb_full_version}
echo found version is ${gdb_version}
if [ ${gdb_version2} -lt 10 ]; then
gdbversion=${gdb_version1}0${gdb_version2}
else
gdbversion=${gdb_version1}${gdb_version2}
fi
if [ "${destdir}" == "" ]; then
destdir=./libgdb
fi
if ! [ -d ${destdir} ]; then
mkdir ${destdir}
fi
cat make.log | gawk '
BEGIN {
doprint=0
}
/gcc / { doprint=1; }
{
if ( doprint == 1 ) {
print $0
}
}
! /\\$/ { doprint=0; }
' | tee comp-cmd.log
# Try to locate all libraries
echo Creating ./copy-libs.sh script
cat comp-cmd.log |gawk -v destdir=${destdir} '
BEGIN {
print "#!/bin/bash"
print "# copy-libs.sh generated by awk script"
print "cp gdblib.inc " destdir
}
{
nb = split ($0,list);
for (i=1; i<=nb; i++) {
if ( list[i] ~ /lib[^ ]*\.a/ ) {
libs = gensub (/([^ ]*)(lib[^ ]*\.a)/,"\\1\\2 ","g",list[i]);
print "cp " libs destdir;
}
if ( list[i] ~ /-l/ ) {
systemlib = gensub (/-l([^ ]*)/,"lib\\1.a ","g",list[i]);
print "systemlib=`find /lib -name " systemlib "`" ;
print "if [ \"${systemlib}\" != \"\" ]; then";
print "echo System lib found: ${systemlib}";
print "cp ${systemlib} " destdir;
print "else";
print "echo Library " systemlib " not found";
print "fi";
}
}
}
' | tee copy-libs.sh
chmod u+x ./copy-libs.sh
# For later
echo Creating ./gdblib.inc file
# Generate gdblib.inc file
cat comp-cmd.log |gawk -v destdir=${destdir} -v gdbversion=${gdbversion} '
BEGIN {
print "{ libgdb.inc file generated by awk script }"
print "{$define GDB_V" gdbversion " }"
print "{$ifdef COMPILING_GDBINT_UNIT }"
}
{
nb = split ($0,list);
for (i=1; i<=nb; i++) {
if ( list[i] ~ /lib[^ ]*\.a/ ) {
libs = gensub (/([^ ]*)(lib[^ ]*\.a)/,"{$LINKLIB \\2} { found in \\1 }","g",list[i]);
print libs;
}
if ( list[i] ~ /-l/ ) {
dlibs = gensub (/-l([^ ]*)/,"{$LINKLIB \\1} { with -l gcc option}","g",list[i]);
print dlibs;
}
}
}
END {
print "{$endif COMPILING_GDBINT_UNIT }"
print "{$undef NotImplemented}"
}
' | tee gdblib.inc