libtool-patches
[Top][All Lists]
Advanced

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

Re: Remove object files from convenience library after relink


From: Albert Chin
Subject: Re: Remove object files from convenience library after relink
Date: Fri, 13 Feb 2004 12:31:16 -0600
User-agent: Mutt/1.4i

On Fri, Feb 13, 2004 at 11:02:07AM -0600, Albert Chin wrote:
> When a library is installed, dependent on a convenience library, and
> it involves relinking, the object files extracted from the convenience
> library are not removed after the relink. This is a problem if you
> build as non-root, install as root, then try to remove the build
> directory as non-root.
> 
> In addition, if the relink fails, we don't clean up after ourselves.
> 
> And, what's up with this:
>   $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname 
> ${realname}T && $mv "$realname"U $realname)' || exit $?
>   (i.e.)
>     $rm ${realname}T
>     $mv $realname ${realname}T
>     $mv "$realname"U $realname
> 
>   (example with KDE 3.2's libkutils)
>     rm -f libkutils.sl.3.0T
>     mv libkutils.sl.3.0 libkutils.sl.3.0T
>     mv -f libkutils.sl.3.0U libkutils.sl.3.0
> 
>   We should just:
>     $rm ${realname}T
>     $mv "$realname"U $realname

Ok, scratch that patch. Try this instead. The above is correct (though
it still leaves libkutils.sl.3.0T with permission of the user doing
the install).

-- 
albert chin (address@hidden)

-- snip snip
        * ltmain.in: When a library is installed, dependent on a
        convenience library, and it involves relinking, the object
        files extracted from the convenience library are not removed
        after the relink. This is a problem if you build as non-root,
        install as root, then try to remove the build directory as
        non-root; Clean up properly if relink fails; Change
        "$realname"U to ${realname}T to be consistent.

Index: ltmain.in
===================================================================
RCS file: /cvsroot/libtool/libtool/ltmain.in,v
retrieving revision 1.334.2.26
diff -u -3 -p -r1.334.2.26 ltmain.in
--- ltmain.in   12 Feb 2004 19:24:00 -0000      1.334.2.26
+++ ltmain.in   13 Feb 2004 18:09:22 -0000
@@ -3842,7 +3913,16 @@ EOF
            IFS="$save_ifs"
            eval cmd=\"$cmd\"
            $show "$cmd"
-           $run eval "$cmd" || exit $?
+           $run eval "$cmd" || {
+             lt_exit=$?
+
+             # Restore the uninstalled library and exit
+             if test "$mode" = relink; then
+               $run eval '(cd $output_objdir && $rm ${realname}T && $mv 
${realname}U $realname)'
+             fi
+
+             exit $lt_exit
+           }
          done
          IFS="$save_ifs"
 
@@ -3880,14 +3960,31 @@ EOF
          IFS="$save_ifs"
          eval cmd=\"$cmd\"
          $show "$cmd"
-         $run eval "$cmd" || exit $?
+         $run eval "$cmd" || {
+           lt_exit=$?
+
+           # Restore the uninstalled library and exit
+           if test "$mode" = relink; then
+             $run eval '(cd $output_objdir && $rm ${realname}T && $mv 
${realname}U $realname)'
+           fi
+
+           exit $lt_exit
+         }
        done
        IFS="$save_ifs"
 
        # Restore the uninstalled library and exit
        if test "$mode" = relink; then
-         $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname 
${realname}T && $mv "$realname"U $realname)' || exit $?
-         exit $EXIT_SUCCESS
+         $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname 
${realname}T && $mv ${realname}U $realname)' || exit $?
+
+         if test -n "$convenience"; then
+           if test -z "$whole_archive_flag_spec"; then
+             $show "${rm}r $gentop"
+             $run ${rm}r "$gentop"
+           fi
+         fi
+
+         exit $EXIT_SUCCESS 
        fi
 
        # Create links to the real library.




reply via email to

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