oops2, committed stuff that's not ready yet along

This commit is contained in:
espie 2008-11-08 09:43:43 +00:00
parent 10a17a5002
commit 15242ec79f

View File

@ -1,5 +1,5 @@
#!/usr/bin/perl
# $OpenBSD: libtool,v 1.54 2008/11/08 09:41:25 espie Exp $
# $OpenBSD: libtool,v 1.55 2008/11/08 09:43:43 espie Exp $
# Copyright (c) 2007-2008 Steven Mestdagh <steven@openbsd.org>
#
@ -41,7 +41,7 @@ use subs qw(
notyet
parse_linkargs_list
parse_version_info
process_deplibs_list
process_deplibs
resolve_la_list
reverse_zap_duplicates
reverse_zap_duplicates_ref
@ -254,23 +254,6 @@ sub deplib_list
return $self->{deplib_list}
}
sub set_deplibs
{
my ($self, $v) = @_;
$self->{deplib_list} = $v;
}
sub stringize
{
my ($self, $k) = @_;
if ($k eq 'dependency_libs') {
return join(' ', @{$self->{deplib_list}}) || '';
} else {
return $self->SUPER::stringize($k);
}
}
# XXX not sure how much of this cruft we need
sub write
{
@ -375,7 +358,7 @@ my @valid_modes = qw(clean compile execute finish install link uninstall);
my @valid_src = qw(asm c cc cpp cxx f s);
my $cwd = getcwd();
my $ltdir = '.libs';
my @picflags = ('-fPIC' '-DPIC');
my $picflags = '-fPIC -DPIC';
my $sharedflag = '-shared';
my $instlibdir = '/usr/local/lib';
my @libsearchdirs;
@ -518,7 +501,7 @@ if ($mode eq 'compile') {
if ($pic) {
$cmd = $ltprog;
$cmd .= " @ARGV" if (@ARGV);
$cmd .= " @picflags";
$cmd .= " $picflags";
$cmd .= " -o ";
$cmd .= ($odir eq '.') ? '' : $odir.'/';
$cmd .= $picobj;
@ -796,11 +779,14 @@ if ($mode eq 'compile') {
$lainfo->{'installed'} = 'no';
$lainfo->{'shouldnotlink'} = $opts{'module'} ? 'yes' : 'no';
map { $_ = "-R$_" } @Ropts;
unshift(@deplibs, @Ropts) if @Ropts;
my $deplibstring = join ' ', @deplibs;
$deplibstring = "@Ropts $deplibstring" if (@Ropts);
@deplibs = split /\s+/, $deplibstring;
Trace::debug {"deplibs = @deplibs\n"};
my @finaldeplibs = reverse_zap_duplicates(@deplibs);
Trace::debug {"finaldeplibs = @finaldeplibs\n"};
$lainfo->set_deplibs(\@finaldeplibs);
$deplibstring = join ' ', @finaldeplibs;
$lainfo->set('dependency_libs', $deplibstring);
if (@RPopts) {
if (@RPopts > 1) {
Trace::debug {"more than 1 -rpath option given, taking the first: ", $RPopts[0], "\n"};
@ -812,8 +798,7 @@ if ($mode eq 'compile') {
symlink("../$ofile", "$odir/$ltdir/$ofile");
if ($shared) {
my $lai = "$odir/$ltdir/$ofile".'i';
$lainfo->set_deplibs(
process_deplibs_list(\@finaldeplibs));
$lainfo->set('dependency_libs', process_deplibs($deplibstring));
$lainfo->{'installed'} = 'yes';
# write .lai file (.la file that will be installed)
$lainfo->write($lai, $ofile);
@ -1210,25 +1195,22 @@ sub inspect_lib
# prepare dependency_libs information for the .la file which is installed
# i.e. remove any .libs directories and use the final libdir for all the
# .la files
sub process_deplibs_list
sub process_deplibs
{
my $linkflags = shift;
my $result = [];
my $deplibline = shift;
my @linkflags = split /\s+/, $deplibline;
my %la_in_ldpath;
foreach my $lf (@$linkflags) {
foreach my $lf (@linkflags) {
if ($lf =~ m/-L\S+\Q$ltdir\E$/) {
next;
$lf = '';
} elsif ($lf =~ m/\/\S+\/(\S+\.la)/) {
my $lafile = $1;
push(@$result,
LaFile->parse($lf)->{'libdir'}.'/'.$lafile);
} else {
push(@$result, $lf);
$lf = LaFile->parse($lf)->{'libdir'}.'/'.$lafile;
}
}
return $result;
return join ' ', @linkflags;
}
# construct linker command (list) for either libraries or programs
@ -1358,8 +1340,8 @@ sub linkcmds
$libcounter++;
}
$cmd = $ltprog;
$cmd .= " $sharedflag @picflags" if ($lmode == LIBRARY);
$cmd = "$ltprog";
$cmd .= " $sharedflag $picflags" if ($lmode == LIBRARY);
$cmd .= " -o $dst";
$cmd .= " @$argv";
$cmd .= " @$objs" if (@$objs);
@ -1441,7 +1423,7 @@ sub get_objlist_from_archive
{
my $a = shift;
open(my $arh, '-|', "ar", "t", $a);
open(my $arh, '-|', "ar t $a");
my @o = <$arh>;
close $arh;
map { chomp; } @o;