]>
sourceware.org Git - newlib-cygwin.git/blob - winsup/cygwin/mkstatic
5 use File
::Temp qw
/tempdir/;
14 GetOptions
('exclude=s'=>\
@exclude, 'library=s'=>\
@library, 'ar=s'=>\
$ar, 'x!'=>\
$x);
16 die "$0: must specify --ar\n" unless defined $ar;
17 my $lib = shift or die "$0: missing lib argument\nusage: $0 lib [map-file]\n";
18 $lib = Cwd
::abs_path
($lib);
20 my %excludes = map {($_, 1)} @exclude;
21 my $libraries = join('|', map {quotemeta} @library);
25 my ($source, $file, $absfile);
26 if (m
%^($libraries)\
(([^)]*)\
)%o) {
28 $absfile = $file = $2;
29 } elsif (/^LOAD\s+(.*\.o)$/o) {
32 $absfile = Cwd
::abs_path
($file);
36 push @{$sources{$source}}, $absfile unless $excludes{$file} || $excludes{$source};
40 my $dir = tempdir
(CLEANUP
=>1);
43 for (sort keys %sources) {
45 xsystem
'/bin/cp', '-a', @{$sources{$_}}, '.';
47 xsystem
$ar, 'x', $_, @{$sources{$_}}, '.';
49 push @files, map {basename
($_)} @{$sources{$_}};
53 xsystem
$ar, 'crs', $lib, sort @files;
57 print join(' ', 'x', @_), "\n" if $x;
58 system(@_) == 0 or die "$0: $_[0] $_[1] $_[2]... exited with non-zero status\n";
62 chdir '/tmp'; # Allow $dir directory removal on Windows
This page took 0.041676 seconds and 5 git commands to generate.