libtool-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[patch] cygwin libtool-1.5


From: Charles Wilson
Subject: [patch] cygwin libtool-1.5
Date: Mon, 17 Feb 2003 01:28:35 -0500
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.2.1) Gecko/20021130

The attached patch speeds up the process of identifying whether a given dependency is a DLL, an import lib, or a static lib, by about 35% (and provides a hook for an additional 8% speedup, once certain changes are accepted by the fileutils folks and make it into widespread deployment).

This is important, because the current delay really is visible -- and annoying -- when linking libraries that have lots of dependencies (e.g. gnome or kde).

Basically, it's a complete rewrite of the win32_libid() function.

--Chuck
2003-02-07  Charles Wilson  <address@hidden>

        * ltmain.in (win32_libid): rewritten to improve
        speed.
Index: ltmain.in
===================================================================
RCS file: /cvsroot/libtool/libtool/ltmain.in,v
retrieving revision 1.322
diff -u -r1.322 ltmain.in
--- ltmain.in   29 Jan 2003 04:53:18 -0000      1.322
+++ ltmain.in   17 Feb 2003 03:57:48 -0000
@@ -123,24 +123,34 @@
 # that is supplied when $file_magic_command is called.
 win32_libid () {
   win32_libid_type="unknown"
-  if eval $OBJDUMP -f $1 2>/dev/null | \
-     grep -E 'file format pei+-i386(.*architecture: i386)?' >/dev/null ; then
-    win32_libid_type="x86 DLL"
-  else
-    if eval $OBJDUMP -f $1 2>/dev/null | \
-      grep -E 'file format pei*-i386(.*architecture: i386)?' >/dev/null ; then
-      win32_libid_type="x86"
-      if eval file $1 2>/dev/null | \
-         grep -E 'ar archive' >/dev/null; then
-        win32_libid_type="$win32_libid_type archive"
-        if eval $NM -f posix -A $1 | awk '{print $3}' | grep "I" >/dev/null ; 
then
-          win32_libid_type="$win32_libid_type import"
-        else
-          win32_libid_type="$win32_libid_type static"
-        fi
+  win32_fileres=`file -L $1 2>/dev/null`
+  case $win32_fileres in
+  *ar\ archive\ import\ library*) # definitely import
+    win32_libid_type="x86 archive import"
+    ;;
+  *ar\ archive*) # could be an import, or static
+    if eval $OBJDUMP -f $1 | head -n 10 2>/dev/null | \
+      grep -E 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then
+      win32_nmres=`eval $NM -f posix -A $1 | \
+        sed -n -e '1,100{/ I /{x;/import/!{s/^/import/;h;p;};x;}}'`
+      if test "X$win32_nmres" = "Ximport" ; then
+        win32_libid_type="x86 archive import"
+      else
+        win32_libid_type="x86 archive static"
       fi
     fi
-  fi
+    ;;
+  *DLL*) 
+    win32_libid_type="x86 DLL"
+    ;;
+  *executable*) # but shell scripts are "executable" too...
+    case $win32_fileres in
+    *MS\ Windows\ PE\ Intel*)
+      win32_libid_type="x86 DLL"
+      ;;
+    esac
+    ;;
+  esac
   echo $win32_libid_type
 }
 

reply via email to

[Prev in Thread] Current Thread [Next in Thread]