On Wed, Nov 23, 2005 at 09:48:01AM +0100, Marc Espie wrote:

> I'm very annoyed at
> libtool --mode=link cc -L/usr/local/lib -o foo foo.o ./libbar.la
> expanding into some stuff like:
> cc -L/usr/local/lib -L. -o foo foo.o -lbar
> which gets us the libbar installed under /usr/local/lib instead of the one
> we just built...

patch below seems to do the trick.  tested with devel/glib2 and
multimedia/transcode.

-- 
<[EMAIL PROTECTED]>

Index: patches/patch-ltmain_in
===================================================================
RCS file: /home/cvs/OpenBSD/ports/devel/libtool/patches/patch-ltmain_in,v
retrieving revision 1.13
diff -u -r1.13 patch-ltmain_in
--- patches/patch-ltmain_in     2 Nov 2005 02:47:09 -0000       1.13
+++ patches/patch-ltmain_in     28 Nov 2005 00:13:54 -0000
@@ -1,6 +1,6 @@
 $OpenBSD: patch-ltmain_in,v 1.13 2005/11/02 02:47:09 brad Exp $
---- ltmain.in.orig     Wed Aug 31 14:25:28 2005
-+++ ltmain.in  Tue Nov  1 15:13:43 2005
+--- ltmain.in.orig     Wed Aug 31 11:25:28 2005
++++ ltmain.in  Sun Nov 27 15:08:55 2005
 @@ -1089,14 +1089,15 @@ EOF
          if test -n "$link_static_flag"; then
            dlopen_self=$dlopen_self_static
@@ -90,7 +90,95 @@
              add="$libdir/$linklib"
            elif test "$hardcode_minus_L" = yes; then
              add_dir="-L$libdir"
-@@ -5932,40 +5948,6 @@ relink_command=\"$relink_command\""
+@@ -3710,6 +3726,43 @@ EOF
+       old_library=
+       dlname=
+ 
++      # move library search paths that coincide with paths to not yet
++      # installed libraries to the beginning of the library search list
++      new_libs=
++      for path in $notinst_path ; do
++      case " $new_libs " in
++        *" -L$path/.libs "*);;
++        *) new_libs="$new_libs -L$path/.libs" ;;
++      esac
++      done
++      for deplib in $deplibs ; do
++      case $deplib in
++        -L*)
++          dir=`$echo "X$deplib" | $Xsed -e 's/^-L//'`
++          # We need an absolute path.
++          case $dir in
++          [\\/]* | [A-Za-z]:[\\/]*) ;;
++          *)
++            absdir=`cd "$dir" && pwd`
++            if test -z "$absdir"; then
++              $echo "$modename: cannot determine absolute directory name of 
\`$dir'" 1>&2
++              exit $EXIT_FAILURE
++            fi
++            dir="$absdir"
++            ;;
++          esac
++          case " $new_libs " in
++          *" -L$dir "*) ;;
++          *)
++            new_libs="$new_libs -L$dir"
++            ;;
++          esac
++          ;;
++        *) new_libs="$new_libs $deplib" ;;
++      esac
++      done
++      deplibs="$new_libs"
++
+       # Test again, we may have decided not to build it any more
+       if test "$build_libtool_libs" = yes; then
+       if test "$hardcode_into_libs" = yes; then
+@@ -4219,6 +4272,43 @@ EOF
+         ;;
+       esac
+ 
++      # move library search paths that coincide with paths to not yet
++      # installed libraries to the beginning of the library search list
++      new_libs=
++      for path in $notinst_path ; do
++      case " $new_libs " in
++        *" -L$path/.libs "*);;
++        *) new_libs="$new_libs -L$path/.libs" ;;
++      esac
++      done
++      for deplib in $compile_deplibs ; do
++      case $deplib in
++        -L*)
++          dir=`$echo "X$deplib" | $Xsed -e 's/^-L//'`
++          # We need an absolute path.
++          case $dir in
++          [\\/]* | [A-Za-z]:[\\/]*) ;;
++          *)
++            absdir=`cd "$dir" && pwd`
++            if test -z "$absdir"; then
++              $echo "$modename: cannot determine absolute directory name of 
\`$dir'" 1>&2
++              exit $EXIT_FAILURE
++            fi
++            dir="$absdir"
++            ;;
++          esac
++          case " $new_libs " in
++          *" -L$dir "*) ;;
++          *)
++            new_libs="$new_libs -L$dir"
++            ;;
++          esac
++          ;;
++        *) new_libs="$new_libs $deplib" ;;
++      esac
++      done
++      compile_deplibs="$new_libs" 
++
+       compile_command="$compile_command $compile_deplibs"
+       finalize_command="$finalize_command $finalize_deplibs"
+ 
+@@ -5932,40 +6022,6 @@ relink_command=\"$relink_command\""
      # Exit here if they wanted silent mode.
      test "$show" = : && exit $EXIT_SUCCESS
  

Reply via email to