libtool-patches
[Top][All Lists]
Advanced

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

Patch for installations that use an install prefix


From: Ossama Othman
Subject: Patch for installations that use an install prefix
Date: Tue, 9 Jul 2002 18:24:03 -0700
User-agent: Mutt/1.3.28i

Hi,

The following patch was submitted to Debian's bug tracking system to
correct problems with the fact that libtool cannot handle situations
where the final install destination and the current install
destination are not the same.  I believe that it was originally
obtained from the Debian ORBit package.  This situation occurs, for
example, when installing binaries into the installation directory of a
Debian package.  Upon installing the Debian package, those binaries
will ultimately be installed into the appropriate system location
(e.g. `/usr/lib').

The below patch is for the libtool 1.4 branch, so we'd need to port it
to libtool HEAD, in addition to updating the libtool documentations.

Okay to commit?

--- libtool-1.4.2/ltmain.in     Sun Jul  7 11:11:08 2002
+++ /usr/local/src/devel/autotools/libtool-1.4.2/ltmain.in      Sat Jul  6 
14:55:34 2002
@@ -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
 
@@ -3921,7 +3948,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.
@@ -4222,12 +4249,30 @@
        dir="$dir$objdir"
 
        if test -n "$relink_command"; then
-         $echo "$modename: warning: relinking \`$file'" 1>&2
+          # 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 
"address@hidden@%-inst-prefix-dir $inst_prefix_dir%"`
+          else
+            relink_command=`$echo "$relink_command" | sed "address@hidden@%%"`
+          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
 

Thanks,
-Ossama
-- 
Ossama Othman <address@hidden>
Distributed Object Computing Laboratory, Univ. of California at Irvine
1024D/F7A394A8 - 84ED AA0B 1203 99E4 1068  70E6 5EB7 5E71 F7A3 94A8



reply via email to

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