* Charles Wilson <[EMAIL PROTECTED]> [20021030 21:20]:
> David I. Lehn wrote:
> 
> >Could someone -please- either let all of us know how to properly deal
> >with this relink issue or just apply the ltmain.sh patches in the latest
> >Debian libtool package to CVS?  Or at least comment on how it should be
> >modified if it's not acceptable.  Thanks.
> >
> >Grab the latest diffs from one of:
> >http://packages.debian.org/unstable/devel/libtool.html
> >http://packages.qa.debian.org/libt/libtool.html
> 
> I'll take a look at them, unless somebody beats me to it.  However, that 
> patch is 282k against libtool-1.4.3.  It is going to be quite difficult 
> to extract the portion that fixes this problem, and then integrate it 
> into libtool CVS (which has seen massive changes since 1.4.x).
> 
> Any chance that the debian maintainer could give some advice on how to 
> proceed?
> 

Heh... just need the ltmain.sh part.  Use filterdiff from patchutils:

zcat libtool_1.4.3-2.diff.gz | filterdiff -i \*ltmain.sh

Patch attached.  It just patches ltmain.sh... I haven't looked to see if
there are other related fixes.

Notice also the "exit 1" vs "continue" when a relink fails... is there a
good reason not to exit?  It does leave the -already-installed- files
broken if the relink fails, which can easily be missed unless you know
to scan install log files for it.

-dave
--- libtool-1.4.3.orig/ltmain.sh
+++ libtool-1.4.3/ltmain.sh
@@ -56,7 +56,7 @@
 PROGRAM=ltmain.sh
 PACKAGE=libtool
 VERSION=1.4.3
-TIMESTAMP=" (1.922.2.110 2002/10/23 01:39:54)"
+TIMESTAMP=" (1.922.2.111 2002/10/23 02:54:36)"
 
 default_mode=
 help="Try \`$progname --help' for more information."
@@ -226,7 +226,7 @@
   # Infer the operation mode.
   if test -z "$mode"; then
     case $nonopt in
-    *cc | *++ | gcc* | *-gcc* | xlc*)
+    *cc | *++ | gcc* | *-gcc* | g++* | xlc*)
       mode=link
       for arg
       do
@@ -768,6 +768,7 @@
     linker_flags=
     dllsearchpath=
     lib_search_path=`pwd`
+    inst_prefix_dir=
 
     avoid_version=no
     dlfiles=
@@ -898,6 +899,11 @@
          prev=
          continue
          ;;
+       inst_prefix)
+         inst_prefix_dir="$arg"
+         prev=
+         continue
+         ;;
        release)
          release="-$arg"
          prev=
@@ -999,6 +1005,11 @@
        continue
        ;;
 
+      -inst-prefix-dir)
+       prev=inst_prefix
+       continue
+       ;;
+
       # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
       # so, if we see these flags be careful not to treat them like -L
       -L[A-Z][A-Z]*:*)
@@ -1846,6 +1857,14 @@
                add="$dir/$linklib"
              elif test "$hardcode_minus_L" = yes; then
                add_dir="-L$dir"
+               # Try looking first in the location we're being installed to.
+               if test -n "$inst_prefix_dir"; then
+                 case "$libdir" in
+                 [\/]*)
+                   add_dir="-L$inst_prefix_dir$libdir $add_dir"
+                   ;;
+                 esac
+               fi
                add="-l$name"
              elif test "$hardcode_shlibpath_var" = yes; then
                add_shlibpath="$dir"
@@ -1904,6 +1923,14 @@
            else
              # We cannot seem to hardcode it, guess we'll fake it.
              add_dir="-L$libdir"
+             # Try looking first in the location we're being installed to.
+             if test -n "$inst_prefix_dir"; then
+               case "$libdir" in
+               [\/]*)
+                 add_dir="-L$inst_prefix_dir$libdir $add_dir"
+                 ;;
+               esac
+             fi
              add="-l$name"
            fi
 
@@ -3928,7 +3955,7 @@
        fi
       done
       # Quote the link command for shipping.
-      relink_command="(cd `pwd`; $SHELL $0 --mode=relink $libtool_args)"
+      relink_command="(cd `pwd`; $SHELL $0 --mode=relink $libtool_args 
+@inst_prefix_dir@)"
       relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
 
       # Only create the output if not a dry run.
@@ -4229,12 +4256,30 @@
        dir="$dir$objdir"
 
        if test -n "$relink_command"; then
+          # Determine the prefix the user has applied to our future dir.
+          inst_prefix_dir=`$echo "$destdir" | sed "s%$libdir\$%%"`
+ 
+          # Don't allow the user to place us outside of our expected
+          # location b/c this prevents finding dependent libraries that
+          # are installed to the same prefix.
+          if test "$inst_prefix_dir" = "$destdir"; then
+            $echo "$modename: error: cannot install \`$file' to a directory not 
+ending in $libdir" 1>&2
+            exit 1
+          fi
+ 
+          if test -n "$inst_prefix_dir"; then
+            # Stick the inst_prefix_dir data into the link command.
+            relink_command=`$echo "$relink_command" | sed 
+"s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
+          else
+            relink_command=`$echo "$relink_command" | sed "s%@inst_prefix_dir@%%"`
+          fi
+
          $echo "$modename: warning: relinking \`$file'" 1>&2
          $show "$relink_command"
          if $run eval "$relink_command"; then :
          else
            $echo "$modename: error: relink \`$file' with the above command before 
installing it" 1>&2
-           continue
+           exit 1
          fi
        fi
 

Reply via email to