Hi,

When I tried to compile the x11/openmotif port, it did not work
because the compiler used the old include files from the installed
openmotif package.  Of course, it should use the include files from
the port that is currently compiled.

Then I used OpenBSD libtool instead of GNU libtool but compiling
failed with the same error.

I think the relative -I paths should be sorted in front of the
absolute ones.  Then the current port is searched first and after
that /usr/local/include.

With this patch, OpenBSD libtool can compile openmotif-2.3.0p0 even
if openmotif-2.1.30.5p2 is still installed.

Are there any libtool regression tests?

ok ?

bluhm


Index: infrastructure/build/libtool
===================================================================
RCS file: /data/mirror/openbsd/cvs/ports/infrastructure/build/libtool,v
retrieving revision 1.17
diff -u -p -r1.17 libtool
--- infrastructure/build/libtool        16 Nov 2007 15:37:20 -0000      1.17
+++ infrastructure/build/libtool        12 Feb 2008 22:19:07 -0000
@@ -188,6 +188,27 @@ if ($mode eq 'compile') {
        (my $nonpicobj = $ofile) =~ s/\.lo$/.o/;
        my $picobj = "$ltdir/$nonpicobj";
 
+       # uniquely sort relative include paths in front of absolute paths
+       my(%abs_incs, %rel_incs);
+       my $i = 0;  # index to keep the order of the include paths
+       my @other_argv;
+       while (@ARGV) {
+               local $_ = shift @ARGV;
+               if (m,^-I$, && @ARGV) {
+                       $_ .= shift @ARGV;
+               }
+               if (m,^-I/,) {
+                       $abs_incs{$_} ||= ++$i;
+               } elsif (m,^-I.,) {
+                       $rel_incs{$_} ||= ++$i;
+               } else {
+                       push @other_argv, $_;
+               }
+       }
+       push @ARGV, sort { $rel_incs{$a} <=> $rel_incs{$b} } keys %rel_incs;
+       push @ARGV, sort { $abs_incs{$a} <=> $abs_incs{$b} } keys %abs_incs;
+       push @ARGV, @other_argv;
+
        handle_special_chars([EMAIL PROTECTED]);
 
        mkdir "$odir/$ltdir" if (! -d "$odir/$ltdir");

Reply via email to