Make output slightly more similar like gnu libtool in various

modes. Simplify Exec->command() a bit too while here as suggested by espie@

ok espie@
This commit is contained in:
jasper 2011-11-14 22:12:08 +00:00
parent 088b2093ec
commit 3dcf344837
6 changed files with 52 additions and 23 deletions

View File

@ -1,5 +1,5 @@
#!/usr/bin/perl
# $OpenBSD: libtool,v 1.32 2011/05/16 20:09:54 sthen Exp $
# $OpenBSD: libtool,v 1.33 2011/11/14 22:12:08 jasper Exp $
# Copyright (c) 2007-2010 Steven Mestdagh <steven@openbsd.org>
#
@ -260,11 +260,11 @@ if ($mode eq 'compile') {
require Program;
Program->install($s, $dst, $ltprog, \@instopts);
} else {
Exec->command(@$ltprog, @instopts, $s, $dst);
Exec->$mode(@$ltprog, @instopts, $s, $dst);
}
}
if (defined $install_opts{'d'}) {
Exec->command(@$ltprog, @instopts, @ARGV);
Exec->$mode(@$ltprog, @instopts, @ARGV);
}
} elsif ($mode eq 'link') {
my $cmd;
@ -507,7 +507,7 @@ if ($mode eq 'compile') {
} elsif ($mode eq 'execute') {
# XXX check whether this is right
Exec->silent_run;
Exec->command(@$ltprog, @ARGV);
Exec->$mode(@$ltprog, @ARGV);
} else {
die "MODE=$mode not implemented yet.\n";
}

View File

@ -1,4 +1,4 @@
# $OpenBSD: Archive.pm,v 1.1 2010/12/05 16:37:50 espie Exp $
# $OpenBSD: Archive.pm,v 1.2 2011/11/14 22:12:08 jasper Exp $
# Copyright (c) 2007-2010 Steven Mestdagh <steven@openbsd.org>
#
@ -31,7 +31,7 @@ sub extract
Trace::debug {"mkdir -p $dir\n"};
File::Path::mkpath($dir);
}
Exec->chdir($dir)->command('ar', 'x', $archive);
Exec->chdir($dir)->link('ar', 'x', $archive);
}
sub get_objlist

View File

@ -1,4 +1,4 @@
# $OpenBSD: Exec.pm,v 1.1 2010/12/05 16:37:50 espie Exp $
# $OpenBSD: Exec.pm,v 1.2 2011/11/14 22:12:08 jasper Exp $
# Copyright (c) 2007-2010 Steven Mestdagh <steven@openbsd.org>
#
@ -57,6 +57,30 @@ sub chdir
bless {dir => $dir}, $class;
}
sub compile
{
my ($self, @l) = @_;
$self->command("compile", @l);
}
sub execute
{
my ($self, @l) = @_;
$self->command("execute", @l);
}
sub install
{
my ($self, @l) = @_;
$self->command("install", @l);
}
sub link
{
my ($self, @l) = @_;
$self->command("link", @l);
}
sub command_run
{
my ($self, @l) = @_;
@ -101,15 +125,20 @@ sub shell
sub command
{
my ($self, @l) = @_;
my ($self, $mode, @l) = @_;
# create an object "on the run"
if (!ref($self)) {
$self = $self->new;
}
say "@l" if $verbose || $dry;
if ($mode eq "compile"){
say "@l" if $verbose || $dry;
} else {
say "libtool: $mode: @l" if $verbose || $dry;
}
if (!$dry) {
$self->command_run(@l);
}
$performed++;
}
1;

View File

@ -1,4 +1,4 @@
# $OpenBSD: LaFile.pm,v 1.1 2010/12/05 16:37:50 espie Exp $
# $OpenBSD: LaFile.pm,v 1.2 2011/11/14 22:12:08 jasper Exp $
# Copyright (c) 2007-2010 Steven Mestdagh <steven@openbsd.org>
#
@ -218,8 +218,8 @@ sub link
}
push @cmd, @libflags if (@libflags);
push @cmd, @$objs if (@$objs);
Exec->command(@cmd);
Exec->command('ranlib', $dst);
Exec->link(@cmd);
Exec->link('ranlib', $dst);
return;
}
@ -285,7 +285,7 @@ sub link
if (@$staticlibs);
push @cmd, "-L$symlinkdir", @libflags if (@libflags);
push @cmd, "-Wl,-retain-symbols-file,$symbolsfile" if ($symbolsfile);
Exec->command(@cmd);
Exec->link(@cmd);
}
sub install
@ -312,13 +312,13 @@ sub install
@realinstopts = grep { $_ ne '-s' } @realinstopts;
my $s = "$srcdir/$ltdir/$staticlib";
my $d = "$dstdir/$staticlib";
Exec->command(@$instprog, @realinstopts, $s, $d);
Exec->command('strip', @stripopts, $d) if ($strip);
Exec->install(@$instprog, @realinstopts, $s, $d);
Exec->install('strip', @stripopts, $d) if ($strip);
}
if ($sharedlib) {
my $s = "$srcdir/$ltdir/$sharedlib";
my $d = "$dstdir/$sharedlib";
Exec->command(@$instprog, @opts, $s, $d);
Exec->install(@$instprog, @opts, $s, $d);
}
if ($laipath) {
# do not try to strip .la files
@ -326,7 +326,7 @@ sub install
@realinstopts = grep { $_ ne '-s' } @realinstopts;
my $s = $laipath;
my $d = "$dstdir/$dstfile";
Exec->command(@$instprog, @realinstopts, $s, $d);
Exec->install(@$instprog, @realinstopts, $s, $d);
}
# for libraries with a -release in their name
my @libnames = split /\s+/, $lainfo->{'library_names'};

View File

@ -1,4 +1,4 @@
# $OpenBSD: LoFile.pm,v 1.1 2010/12/05 16:37:50 espie Exp $
# $OpenBSD: LoFile.pm,v 1.2 2011/11/14 22:12:08 jasper Exp $
# Copyright (c) 2007-2010 Steven Mestdagh <steven@openbsd.org>
#
@ -56,7 +56,7 @@ sub compile
my $o = ($odir eq '.') ? '' : "$odir/";
$o .= $self->{picobj};
push @cmd, $o;
Exec->command(@cmd);
Exec->compile(@cmd);
}
if (defined $self->{nonpicobj}) {
my @cmd = @$compiler;
@ -65,7 +65,7 @@ sub compile
my $o = ($odir eq '.') ? '' : "$odir/";
$o .= $self->{nonpicobj};
push @cmd, $o;
Exec->command(@cmd);
Exec->compile(@cmd);
}
}

View File

@ -1,4 +1,4 @@
# $OpenBSD: Program.pm,v 1.1 2010/12/05 16:37:50 espie Exp $
# $OpenBSD: Program.pm,v 1.2 2011/11/14 22:12:08 jasper Exp $
# Copyright (c) 2007-2010 Steven Mestdagh <steven@openbsd.org>
#
@ -172,7 +172,7 @@ sub link
push @cmd, "-L$symlinkdir", @libflags if (@libflags);
push @cmd, @$RPdirs if (@$RPdirs);
push @cmd, "-Wl,-retain-symbols-file,$symbolsfile" if ($symbolsfile);
Exec->command(@cmd);
Exec->link(@cmd);
}
sub install
@ -182,7 +182,7 @@ sub install
my $srcdir = dirname $src;
my $srcfile = basename $src;
my $realpath = "$srcdir/$ltdir/$srcfile";
Exec->command(@$instprog, @$instopts, $realpath, $dst);
Exec->install(@$instprog, @$instopts, $realpath, $dst);
}
1;