move test to discover shared libs in .la files to pass 2 because then we
actually have all the .la files we need (especially so if users insist on using -lfoo instead of foo.la). this makes it behave better for the creation of executable wrappers. should fix sysutils/bacula.
This commit is contained in:
parent
cf7709ffec
commit
205a6c48cc
@ -1,5 +1,5 @@
|
||||
#!/usr/bin/perl
|
||||
# $OpenBSD: libtool,v 1.4 2010/09/19 17:30:52 steven Exp $
|
||||
# $OpenBSD: libtool,v 1.5 2010/09/24 20:57:54 steven Exp $
|
||||
|
||||
# Copyright (c) 2007-2010 Steven Mestdagh <steven@openbsd.org>
|
||||
#
|
||||
@ -242,9 +242,6 @@ sub resolve_la
|
||||
# -Lfoo, -lfoo, foo.a, foo.la
|
||||
# recursively find .la files corresponding to -l flags; if there is no .la
|
||||
# file, just inspect the library file itself for any dependencies.
|
||||
# XXX the variable $lashared will register whether or not a .la file is
|
||||
# found which refers to a shared library
|
||||
# this is used to decide where to link executables and create wrappers
|
||||
sub parse_linkargs1
|
||||
{
|
||||
state $seen_pthread = 0;
|
||||
@ -253,7 +250,6 @@ sub parse_linkargs1
|
||||
Trace::debug {"parse_linkargs1, level: $level\n"};
|
||||
Trace::debug {" args: @$args\n"};
|
||||
my $result = $self->{result};
|
||||
my $lashared = $self->{seen_la_shared};
|
||||
|
||||
# first read all directories where we can search libraries
|
||||
foreach my $a (@$args) {
|
||||
@ -327,7 +323,6 @@ sub parse_linkargs1
|
||||
my $oldlib = $lainfo->{'old_library'};
|
||||
my $libdir = $lainfo->{'libdir'};
|
||||
if ($dlname ne '') {
|
||||
$$lashared = 1;
|
||||
if (!exists $libs->{$key}) {
|
||||
$libs->{$key} = Library->new($key);
|
||||
$libs->{$key}->{lafile} = $fulla;
|
||||
@ -359,6 +354,9 @@ sub parse_linkargs1
|
||||
# (this list may contain duplicates)
|
||||
# fill staticlibs array, which is the sequence of static and convenience
|
||||
# libraries
|
||||
# XXX the variable $parser->{seen_la_shared} will register whether or not
|
||||
# a .la file is found which refers to a shared library
|
||||
# this is used to decide where to link executables and create wrappers
|
||||
sub parse_linkargs2
|
||||
{
|
||||
state $seen_pthread = 0;
|
||||
@ -410,6 +408,9 @@ sub parse_linkargs2
|
||||
my $lainfo = LaFile->parse($fulla);
|
||||
my $dlname = $lainfo->stringize('dlname');
|
||||
my $oldlib = $lainfo->stringize('old_library');
|
||||
if ($dlname ne '') {
|
||||
$self->{seen_la_shared} = 1;
|
||||
}
|
||||
if ($dlname eq '' && -f "$d/$ltdir/$oldlib") {
|
||||
push @$staticlibs, "$d/$ltdir/$oldlib";
|
||||
} else {
|
||||
@ -901,7 +902,6 @@ sub link
|
||||
my $libdirs = shift;
|
||||
my $parser = shift;
|
||||
my $opts = shift;
|
||||
my $seen_la_shared = shift;
|
||||
|
||||
my $ltdir = $main::ltdir;
|
||||
Trace::debug {"linking program (",
|
||||
@ -917,12 +917,6 @@ sub link
|
||||
my @libflags;
|
||||
my @cmd;
|
||||
my $dst;
|
||||
if ($self->{shared} && $seen_la_shared) {
|
||||
$dst = ($odir eq '.') ? "$ltdir/$fname" : "$odir/$ltdir/$fname";
|
||||
mkdir "$odir/$ltdir" if (! -d "$odir/$ltdir");
|
||||
} else {
|
||||
$dst = ($odir eq '.') ? $fname : "$odir/$fname";
|
||||
}
|
||||
|
||||
Trace::debug {"argvstring (pre resolve_la): @{$parser->{args}}\n"};
|
||||
my $args = $parser->resolve_la($deplibs, $libdirs);
|
||||
@ -930,6 +924,7 @@ sub link
|
||||
my $orderedlibs = [];
|
||||
my $staticlibs = [];
|
||||
$parser->{args} = $args;
|
||||
$parser->{seen_la_shared} = 0;
|
||||
$args = $parser->parse_linkargs2(\@main::Rresolved,
|
||||
\@main::libsearchdirs, $orderedlibs, $staticlibs, $dirs, $libs);
|
||||
Trace::debug {"staticlibs = \n", join("\n", @$staticlibs), "\n"};
|
||||
@ -937,6 +932,14 @@ sub link
|
||||
my $finalorderedlibs = main::reverse_zap_duplicates_ref($orderedlibs);
|
||||
Trace::debug {"final orderedlibs = @$finalorderedlibs\n"};
|
||||
|
||||
if ($self->{shared} && $parser->{seen_la_shared}) {
|
||||
$dst = ($odir eq '.') ? "$ltdir/$fname" : "$odir/$ltdir/$fname";
|
||||
mkdir "$odir/$ltdir" if (! -d "$odir/$ltdir");
|
||||
$self->write_wrapper();
|
||||
} else {
|
||||
$dst = ($odir eq '.') ? $fname : "$odir/$fname";
|
||||
}
|
||||
|
||||
my $symbolsfile;
|
||||
if ($opts->{'export-symbols'}) {
|
||||
$symbolsfile = $opts->{'export-symbols'};
|
||||
@ -1452,8 +1455,6 @@ if ($mode eq 'compile') {
|
||||
|
||||
my $parser = Parser->new(\@ARGV);
|
||||
$parser->{result} = [];
|
||||
my $seen_la_shared = 0;
|
||||
$parser->{seen_la_shared} = \$seen_la_shared;
|
||||
|
||||
if ($linkmode == PROGRAM) {
|
||||
my $program = Program->new;
|
||||
@ -1473,7 +1474,6 @@ if ($mode eq 'compile') {
|
||||
$parser->{args} = $parser->{result};
|
||||
Trace::debug {"end parse_linkargs1\n"};
|
||||
Trace::debug {"deplibs = @$deplibs\n"};
|
||||
$seen_la_shared = ${$parser->{seen_la_shared}};
|
||||
|
||||
$program->{objlist} = \@objs;
|
||||
if (@objs == 0) {
|
||||
@ -1489,10 +1489,7 @@ if ($mode eq 'compile') {
|
||||
@$RPdirs = (@Ropts, @RPopts, @Rresolved);
|
||||
$program->{RPdirs} = $RPdirs;
|
||||
|
||||
$program->link($ltprog, $dirs, $libs, $deplibs, $libdirs, $parser, \%opts, $seen_la_shared);
|
||||
if ($program->{shared} && $seen_la_shared) {
|
||||
$program->write_wrapper();
|
||||
}
|
||||
$program->link($ltprog, $dirs, $libs, $deplibs, $libdirs, $parser, \%opts);
|
||||
} elsif ($linkmode == LIBRARY) {
|
||||
my $lainfo = LaFile->new;
|
||||
|
||||
@ -1527,7 +1524,6 @@ if ($mode eq 'compile') {
|
||||
$parser->{args} = $parser->{result};
|
||||
Trace::debug {"end parse_linkargs1\n"};
|
||||
Trace::debug {"deplibs = @$deplibs\n"};
|
||||
$seen_la_shared = ${$parser->{seen_la_shared}};
|
||||
|
||||
my $sover = '0.0';
|
||||
my $origver = 'unknown';
|
||||
|
Loading…
Reference in New Issue
Block a user