libtool-patches
[Top][All Lists]
Advanced

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

Re: Fix for 'Cygwin List O' Issues' #2: make install DESTDIR= COMPLETE P


From: Charles Wilson
Subject: Re: Fix for 'Cygwin List O' Issues' #2: make install DESTDIR= COMPLETE PATCH
Date: Sat, 02 Nov 2002 13:08:34 -0500
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:0.9.4) Gecko/20011019 Netscape6/6.2

The attached patch contains both the code and the documentation changes to fix the 'make install DESTDIR=" problem.

2002-10-30  Ossama Othman  <address@hidden>

        * ltmain.in: add support for installing into temporary
        staging area (e.g. 'make install DESTDIR=...')

2002-11-01  Charles Wilson  <address@hidden>

        * doc/libtool.texi (Install mode): document new
        --inst-prefix option.

--Chuck
Index: ltmain.in
===================================================================
RCS file: /cvsroot/libtool/libtool/ltmain.in,v
retrieving revision 1.308
diff -u -r1.308 ltmain.in
--- ltmain.in   31 Oct 2002 00:52:39 -0000      1.308
+++ ltmain.in   2 Nov 2002 18:04:44 -0000
@@ -841,6 +841,7 @@
     linker_flags=
     dllsearchpath=
     lib_search_path=`pwd`
+    inst_prefix_dir=
 
     avoid_version=no
     dlfiles=
@@ -973,6 +974,11 @@
          prev=
          continue
          ;;
+       inst_prefix)
+         inst_prefix_dir="$arg"
+         prev=
+         continue
+         ;;
        release)
          release="-$arg"
          prev=
@@ -1189,6 +1195,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]*:*)
@@ -2243,6 +2254,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"
@@ -2301,6 +2320,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
 
@@ -4467,7 +4494,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.
@@ -4768,12 +4795,33 @@
        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.
+         # At present, this check doesn't affect windows .dll's that
+         # are installed into $libdir/../bin (currently, that works fine)
+         # but it's something to keep an eye on.
+         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
 
Index: doc/libtool.texi
===================================================================
RCS file: /cvsroot/libtool/libtool/doc/libtool.texi,v
retrieving revision 1.126
diff -u -r1.126 libtool.texi
--- doc/libtool.texi    28 Oct 2002 15:38:37 -0000      1.126
+++ doc/libtool.texi    2 Nov 2002 18:05:26 -0000
@@ -1351,12 +1351,53 @@
 @cindex install mode
 @cindex mode, install
 
-In @dfn{install} mode, libtool interprets @var{mode-args} as an
-installation command beginning with @code{cp}, or a BSD-compatible
address@hidden program.
+In @dfn{install} mode, libtool interprets most of the elements of
address@hidden as an installation command beginning with 
address@hidden, or a BSD-compatible @code{install} program.
 
-The rest of the @var{mode-args} are interpreted as arguments to that
-command.
+The following components of @var{mode-args} are treated specially:
+
address@hidden @samp
address@hidden -inst-prefix @var{inst-prefix-dir}
+When installing into a temporary staging area, rather than the
+final @var{prefix}, this argument is used to reflect the 
+temporary path, in much the same way @code{automake} uses
address@hidden  For instance, if @var{prefix} is @code{/usr/local},
+but @var{inst-prefix-dir} is @code{/tmp}, then the object will be
+installed under @code{/tmp/usr/local/}.  If the installed object 
+is a libtool library, then the internal fields of that library
+will reflect only @var{prefix}, not @var{inst-prefix-dir}:
+
address@hidden
+# Directory that this library needs to be installed in:
+libdir='/usr/local/lib'
address@hidden example
+
+not
+
address@hidden
+# Directory that this library needs to be installed in:
+libdir='/tmp/usr/local/lib'
address@hidden example
+
address@hidden is also used to insure that if the installed 
+object must be relinked upon installation, that it is relinked 
+against the libraries in @var{inst-prefix-dir}/@var{prefix}, 
+not @var{prefix}.
+
+In truth, this option is not really intended for use when calling
+libtool directly; it is automatically used when @code{libtool --mode=install}
+calls @code{libtool --mode=relink}.  Libtool does this by 
+analyzing the destination path given in the original 
address@hidden --mode=install} command and comparing it to the 
+expected installation path established during @code{libtool --mode=link}.
+
+Thus, end-users need change nothing, and @code{automake}-style
address@hidden install DESTDIR=/tmp} will Just Work(tm).
address@hidden table
+
+The rest of the @var{mode-args} are interpreted as arguments to the
address@hidden or @code{install} command.
 
 The command is run, and any necessary unprivileged post-installation
 commands are also completed.

reply via email to

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