[BACK]Return to libtool CVS log [TXT][DIR] Up to [local] / src / usr.bin / libtool

Diff for /src/usr.bin/libtool/libtool between version 1.22 and 1.23

version 1.22, 2012/07/08 09:36:31 version 1.23, 2012/07/08 10:42:25
Line 19 
Line 19 
 use strict;  use strict;
 use warnings;  use warnings;
 use feature qw(say switch state);  use feature qw(say switch state);
 use Cwd qw(getcwd abs_path);  use Cwd qw(getcwd);
 use File::Basename;  
 use File::Glob ':glob';  use File::Glob ':glob';
 use File::Path;  use File::Path;
   
 use LT::Trace;  use LT::Trace;
 use LT::Exec;  use LT::Exec;
 use LT::Util;  use LT::Util;
   use LT::Getopt;
   
 $SIG{__DIE__} = sub {  $SIG{__DIE__} = sub {
         require Carp;          require Carp;
Line 70 
Line 70 
 }  }
   
 package LT::Mode;  package LT::Mode;
   use LT::Util;
   
 sub new  sub new
 {  {
Line 93 
Line 94 
         if (defined $mode_maker->{$mode}) {          if (defined $mode_maker->{$mode}) {
                 return $mode_maker->{$mode}->new($origin);                  return $mode_maker->{$mode}->new($origin);
         } else {          } else {
                 # XXX invokved from getopt, can't die yet.                  shortdie "Mode=$mode not implemented yet.\n";
                 say STDERR "Mode=$mode not implemented yet.\n";  
                 exit 1;  
         }          }
 }  }
   
Line 135 
Line 134 
   
 package LT::Options;  package LT::Options;
 use Getopt::Long;  use Getopt::Long;
   use LT::Util;
   our @ISA = qw(LT::Getopt);
   
 my @valid_modes = qw(compile clean execute finish install link uninstall);  my @valid_modes = qw(compile clean execute finish install link uninstall);
   
Line 157 
Line 158 
 {  {
         my ($self, $value) = @_;          my ($self, $value) = @_;
         if ($value =~ m/[^\-\w,\/]/) {          if ($value =~ m/[^\-\w,\/]/) {
                 # XXX stupid Getopt pre-empts die !                  shortdie "invalid tag name: $value";
                 say STDERR "invalid tag name: $value";  
                 exit 1;                  exit 1;
         }          }
         if (grep {$value eq $_} @known_tags) {          if (grep {$value eq $_} @known_tags) {
Line 228 
Line 228 
 package main;  package main;
   
 use subs qw(  use subs qw(
         create_symlinks  
         help          help
         notyet  
         );          );
   
 my $ltconfig = LT::OSConfig->new;  my $ltconfig = LT::OSConfig->new;
Line 251 
Line 249 
 }  }
   
 my $gp = LT::Options->new;  my $gp = LT::Options->new;
 $gp->getoptions('config' => \&config,  $gp->handle_options('-config' => \&config,
                 'debug' => sub {                  '-debug|x' => sub {
                                 LT::Trace->set($_[1]);                                  LT::Trace->set(1);
                                 LT::Exec->verbose_run;                                  LT::Exec->verbose_run;
                             },                              },
                 'dry-run|n' => sub { LT::Exec->dry_run; },                  '-dry-run|-dryrun|n' => sub { LT::Exec->dry_run; },
                 'features' => sub {                  '-features' => sub {
                             my $v = `uname -r`;                              my $v = `uname -r`;
                             chomp $v;                              chomp $v;
                             say "host: $ltconfig->{gnu_arch}-unknown-openbsd$v";                              say "host: $ltconfig->{gnu_arch}-unknown-openbsd$v";
Line 265 
Line 263 
                             say "enable static libraries";                              say "enable static libraries";
                             exit 0;                              exit 0;
                         },                          },
                 'finish' => sub { $mode = LT::Mode::Finish->new('--finish'); },                  '-finish' => sub { $mode = LT::Mode::Finish->new('--finish'); },
                 'help' => \&help, # does not return                  '-help|?|h' => \&help, # does not return
                 'mode=s{1}' => sub {                  '-mode=' => sub {
                                 $mode = LT::Mode->factory($_[1], "--mode=$_[1]");                                  $mode = LT::Mode->factory($_[2], "--mode=$_[2]");
                             },                              },
                 'quiet' => sub { $verbose = 0; },                  '-quiet|-silent|-no-verbose' => sub { $verbose = 0; },
                 'silent' => sub { $verbose = 0; },                  '-verbose|-no-silent|-no-quiet|v' => sub {$verbose = 1;},
                 'tag=s{1}' => sub { $gp->add_tag($_[1]); },                  '-tag=' => sub { $gp->add_tag($_[2]); },
                 'version' => sub {                  '-version' => sub {
                                 say "libtool (not (GNU libtool)) $version" ;                                  say "libtool (not (GNU libtool)) $version" ;
                                 exit 0;                                  exit 0;
                             },                              },
Line 350 
Line 348 
         exit 0;          exit 0;
 }  }
   
 sub notyet  
 {  
         die "Option not implemented yet.\n";  
 }  
   
 sub config  sub config
 {  {
         $ltconfig->dump;          $ltconfig->dump;
         exit 0;          exit 0;
 }  
   
 sub create_symlinks  
 {  
         my ($dir, $libs) = @_;  
         if (! -d $dir) {  
                 mkdir($dir) or die "Cannot mkdir($dir) : $!\n";  
         }  
   
         foreach my $l (values %$libs) {  
                 my $f = $l->{fullpath};  
                 next if !defined $f;  
                 next if $f =~ m/\.a$/;  
                 my $libnames = [];  
                 if (defined $l->{lafile}) {  
                         require LT::LaFile;  
                         my $lainfo = LT::LaFile->parse($l->{lafile});  
                         my $librarynames = $lainfo->stringize('library_names');  
                         @$libnames = split /\s/, $librarynames;  
                         $libnames = reverse_zap_duplicates_ref($libnames);  
                 } else {  
                         push @$libnames, basename($f);  
                 }  
                 foreach my $libfile (@$libnames) {  
                         my $link = "$dir/$libfile";  
                         tsay {"ln -s $f $link"};  
                         next if -f $link;  
                         my $p = abs_path($f);  
                         if (!symlink($p, $link)) {  
                                 die "Cannot create symlink($p, $link): $!\n"  
                                     unless  $!{EEXIST};  
                         }  
                 }  
         }  
         return $dir;  
 }  }
   

Legend:
Removed from v.1.22  
changed lines
  Added in v.1.23