summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc Espie <espie@cvs.openbsd.org>2012-07-10 17:05:35 +0000
committerMarc Espie <espie@cvs.openbsd.org>2012-07-10 17:05:35 +0000
commit71926da674725c44ce708c407689231284f05b12 (patch)
treea8895eb660ab76699c1bd61a045e159008b559c1
parented6f350bccce55ad821badfe6f7fcfaed4157e88 (diff)
unconfuse myself.
having two methods that do completely different things with the same name (!) is evil...
-rw-r--r--usr.bin/libtool/LT/LaFile.pm7
-rw-r--r--usr.bin/libtool/LT/Library.pm8
-rw-r--r--usr.bin/libtool/LT/Parser.pm6
-rw-r--r--usr.bin/libtool/LT/Program.pm6
4 files changed, 12 insertions, 15 deletions
diff --git a/usr.bin/libtool/LT/LaFile.pm b/usr.bin/libtool/LT/LaFile.pm
index 5cc7d6905f7..8fd66ffdb2e 100644
--- a/usr.bin/libtool/LT/LaFile.pm
+++ b/usr.bin/libtool/LT/LaFile.pm
@@ -1,4 +1,4 @@
-# $OpenBSD: LaFile.pm,v 1.12 2012/07/10 16:41:00 espie Exp $
+# $OpenBSD: LaFile.pm,v 1.13 2012/07/10 17:05:34 espie Exp $
# Copyright (c) 2007-2010 Steven Mestdagh <steven@openbsd.org>
# Copyright (c) 2012 Marc Espie <espie@openbsd.org>
@@ -220,7 +220,6 @@ sub link
tsay {"creating link command for library (linked ",
($shared) ? "dynamically" : "statically", ")"};
- my $what = ref($self);
my @libflags;
my @cmd;
my $dst = ($odir eq '.') ? "$ltdir/$fname" : "$odir/$ltdir/$fname";
@@ -269,7 +268,7 @@ sub link
next if !defined $l->{lafile};
my $lainfo = LT::LaFile->parse($l->{lafile});
next if ($lainfo->stringize('dlname') ne '');
- $l->find($dirs, 0, 0, $what);
+ $l->resolve_library($dirs, 0, 0, ref($self));
my $a = $l->{fullpath};
if ($a =~ m/\.a$/ && $a !~ m/_pic\.a/) {
# extract objects from archive
@@ -299,7 +298,7 @@ sub link
my $tmp = [];
while (my $k = shift @$finalorderedlibs) {
my $l = $libs->{$k};
- $l->find($dirs, 1, $gp->static, $what);
+ $l->resolve_library($dirs, 1, $gp->static, ref($self));
if ($l->{dropped}) {
# remove library if dependency on it has been dropped
delete $libs->{$k};
diff --git a/usr.bin/libtool/LT/Library.pm b/usr.bin/libtool/LT/Library.pm
index 79626480260..088b0380ae4 100644
--- a/usr.bin/libtool/LT/Library.pm
+++ b/usr.bin/libtool/LT/Library.pm
@@ -1,4 +1,4 @@
-# $OpenBSD: Library.pm,v 1.5 2012/07/06 22:18:11 espie Exp $
+# $OpenBSD: Library.pm,v 1.6 2012/07/10 17:05:34 espie Exp $
# Copyright (c) 2007-2010 Steven Mestdagh <steven@openbsd.org>
# Copyright (c) 2012 Marc Espie <espie@openbsd.org>
@@ -26,9 +26,9 @@ use LT::Trace;
# find actual library filename
# XXX pick the right one if multiple are found!
-sub find
+sub resolve_library
{
- my ($self, $dirs, $shared, $staticflag, $linkmode, $ldconfigdirs) = @_;
+ my ($self, $dirs, $shared, $staticflag, $linkmode, $gp) = @_;
my $libtofind = $self->{key};
my $libfile = 0;
@@ -83,7 +83,7 @@ sub find
my @sdirs = sort { $dirs->{$b} <=> $dirs->{$a} } keys %$dirs;
# search in .libs when priority is high
map { $_ = "$_/$ltdir" if (exists $dirs->{$_} && $dirs->{$_} > 3) } @sdirs;
- push @sdirs, @$ldconfigdirs if ($ldconfigdirs);
+ push @sdirs, $gp->libsearchdirs if $gp;
tsay {"searching for $libtofind"};
tsay {"search path= ", join(':', @sdirs)};
tsay {"search type= ", $shared ? 'shared' : 'static'};
diff --git a/usr.bin/libtool/LT/Parser.pm b/usr.bin/libtool/LT/Parser.pm
index 6e566492d48..e767e1b4bc0 100644
--- a/usr.bin/libtool/LT/Parser.pm
+++ b/usr.bin/libtool/LT/Parser.pm
@@ -1,4 +1,4 @@
-# $OpenBSD: Parser.pm,v 1.4 2012/07/10 16:41:00 espie Exp $
+# $OpenBSD: Parser.pm,v 1.5 2012/07/10 17:05:34 espie Exp $
# Copyright (c) 2007-2010 Steven Mestdagh <steven@openbsd.org>
# Copyright (c) 2012 Marc Espie <espie@openbsd.org>
@@ -156,10 +156,10 @@ sub parse_linkargs1
push @$result, $lafile;
next;
} else {
- $libs->{$key}->find($dirs, 1, 0, 'notyet', [$gp->libsearchdirs]);
+ $libs->{$key}->resolve_library($dirs, 1, 0, 'notyet', $gp);
my @deps = $libs->{$key}->inspect;
foreach my $d (@deps) {
- my $k = basename $d;
+ my $k = basename($d);
$k =~ s/^(\S+)\.so.*$/$1/;
$k =~ s/^lib//;
push(@largs, "-l$k");
diff --git a/usr.bin/libtool/LT/Program.pm b/usr.bin/libtool/LT/Program.pm
index aca1ab413c5..759dc1debd6 100644
--- a/usr.bin/libtool/LT/Program.pm
+++ b/usr.bin/libtool/LT/Program.pm
@@ -1,4 +1,4 @@
-# $OpenBSD: Program.pm,v 1.10 2012/07/10 16:41:00 espie Exp $
+# $OpenBSD: Program.pm,v 1.11 2012/07/10 17:05:34 espie Exp $
# Copyright (c) 2007-2010 Steven Mestdagh <steven@openbsd.org>
# Copyright (c) 2012 Marc Espie <espie@openbsd.org>
@@ -99,7 +99,6 @@ sub link
tsay {"linking program (", ($gp->static ? "not " : ""),
"dynamically linking not-installed libtool libraries)"};
- my $what = ref($self);
my $fpath = $self->{outfilepath};
my $RPdirs = $self->{RPdirs};
@@ -163,8 +162,7 @@ sub link
require LT::Library;
$libs->{$k} = LT::Library->new($k);
}
- my $l = $libs->{$k};
- $l->find($dirs, 1, $gp->static, $what);
+ $libs->{$k}->resolve_library($dirs, 1, $gp->static, ref($self));
}
my @libobjects = values %$libs;