diff options
Diffstat (limited to 'winsup/cygwin/mkstatic')
-rwxr-xr-x | winsup/cygwin/mkstatic | 59 |
1 files changed, 0 insertions, 59 deletions
diff --git a/winsup/cygwin/mkstatic b/winsup/cygwin/mkstatic deleted file mode 100755 index b7a81b0ad..000000000 --- a/winsup/cygwin/mkstatic +++ /dev/null @@ -1,59 +0,0 @@ -#!/usr/bin/perl -use strict; -use Cwd; -use Getopt::Long; -use File::Temp qw/tempdir/; -use File::Basename; - -sub xsystem(@); - -my @exclude = (); -my @library = (); -my $ar; -our $x; -GetOptions('exclude=s'=>\@exclude, 'library=s'=>\@library, 'ar=s'=>\$ar, 'x!'=>\$x); - -die "$0: must specify --ar\n" unless defined $ar; -my $lib = shift or die "$0: missing lib argument\nusage: $0 lib [map-file]\n"; -$lib = Cwd::abs_path($lib); - -my %excludes = map {($_, 1)} @exclude; -my $libraries = join('|', map {quotemeta} @library); - -my %sources = (); -while (<>) { - my ($source, $file, $absfile); - if (m%^($libraries)\(([^)]*)\)%o) { - $source = $1; - $absfile = $file = $2; - } elsif (/^LOAD\s+(.*\.o)$/o) { - $source = '.'; - $file = $1; - $absfile = Cwd::abs_path($file); - } else { - next; - } - push @{$sources{$source}}, $absfile unless $excludes{$file} || $excludes{$source}; -} - -my $here = getcwd(); -my $dir = tempdir(CLEANUP=>1); -chdir $dir; -my @files = (); -for (sort keys %sources) { - if ($_ eq '.') { - xsystem '/bin/cp', '-a', @{$sources{$_}}, '.'; - } else { - xsystem $ar, 'x', $_, @{$sources{$_}}, '.'; - } - push @files, map {basename($_)} @{$sources{$_}}; -} - -unlink $lib; -xsystem $ar, 'crs', $lib, sort @files; -exit 0; - -sub xsystem(@) { - print join(' ', 'x', @_), "\n" if $x; - system(@_) == 0 or die "$0: @_[0] $_[1] $_[2]... exited with non-zero status\n"; -} |