~ubuntu-branches/ubuntu/precise/gccgo-4.7/precise

« back to all changes in this revision

Viewing changes to debian/gcj-wrapper-BV

  • Committer: Package Import Robot
  • Author(s): Matthias Klose
  • Date: 2012-03-11 19:37:32 UTC
  • Revision ID: package-import@ubuntu.com-20120311193732-ty08ntcphseuouao
Tags: 4.7.0~rc1-0ubuntu1
* Build standalone gccgo-4.7 packages.
* libgo: Work around parse error of struct timex_ on ARM.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/perl -w
 
2
#
 
3
# Starts the GNU Java compiler.
 
4
#
 
5
# Command-line arguments should be in the style of Sun's Java compiler;
 
6
# these will be converted to gcj arguments before being passed to the
 
7
# gcj itself.
 
8
#
 
9
# Copyright (C) 2002-2003 by Ben Burton <bab@debian.org>
 
10
# Based on the original gcj-wrapper-3.2 shell script.
 
11
 
 
12
use strict;
 
13
 
 
14
# The real Java compiler:
 
15
my $javaCompiler = '/usr/bin/gcj-@BV@';
 
16
 
 
17
# The command-line arguments to pass to the real Java compiler:
 
18
my @commandLine;
 
19
 
 
20
# The warning flags to pass to the GNU Java compiler:
 
21
my $warnings = '-Wall';
 
22
 
 
23
# Build the command-line from the arguments given.
 
24
my $parsingOptions = 1;
 
25
my $copyNextArg = 0;
 
26
my $ignoreNextArg = 0;
 
27
my $appendNextArg = '';
 
28
foreach my $arg (@ARGV) {
 
29
    # See if we already know what to do with this argument.
 
30
    if ($ignoreNextArg) {
 
31
        # Throw it away.
 
32
        $ignoreNextArg = 0;
 
33
        next;
 
34
    } elsif ($copyNextArg or not $parsingOptions) {
 
35
        # Copy it directly.
 
36
        push @commandLine, $arg;
 
37
        $copyNextArg = 0;
 
38
        next;
 
39
    } elsif ($appendNextArg) {
 
40
        # Append it to $appendNextArg and then copy directly.
 
41
        push @commandLine, ($appendNextArg . $arg);
 
42
        $appendNextArg = '';
 
43
        next;
 
44
    }
 
45
 
 
46
    # Try to interpret Sun-style options.
 
47
    if ($arg eq '-version') {
 
48
        push @commandLine, '--version';
 
49
    } elsif ($arg eq '-h' or $arg eq '-help') {
 
50
        push @commandLine, '--help';
 
51
    } elsif ($arg eq '-classpath' or $arg eq '--classpath' or $arg eq '--cp') {
 
52
        $appendNextArg = '--classpath=';
 
53
    } elsif ($arg eq '-encoding' or $arg eq '-bootclasspath' or
 
54
             $arg eq '-extdirs') {
 
55
        $appendNextArg = '-' . $arg . '=';
 
56
    } elsif ($arg eq '-d') {
 
57
        push @commandLine, '-d';
 
58
        $copyNextArg = 1;
 
59
    } elsif ($arg eq '-nowarn') {
 
60
        $warnings = '';
 
61
    } elsif ($arg =~ /^-g/) {
 
62
        # Some kind of debugging option - just switch debugging on.
 
63
        push @commandLine, '-g' if ($arg ne '-g:none');
 
64
    } elsif ($arg eq '-O') {
 
65
        push @commandLine, '-O2';
 
66
    } elsif ($arg eq '-Xss') {
 
67
        push @commandLine, $arg;
 
68
    } elsif ($arg =~ /^-X/) {
 
69
        # An extended Sun option (which we don't support).
 
70
        push @commandLine, '--help' if ($arg eq '-X');
 
71
    } elsif ($arg eq '-source' or $arg eq '-sourcepath' or $arg eq '-target') {
 
72
        # An unsupported option with a following argument.
 
73
        $ignoreNextArg = 1;
 
74
    } elsif ($arg =~ /^-/) {
 
75
        # An unsupported standalone option.
 
76
    } else {
 
77
        # Some non-option argument has been given.
 
78
        # Stop parsing options at this point.
 
79
        push @commandLine, $arg;
 
80
        $parsingOptions = 0;
 
81
    }
 
82
}
 
83
 
 
84
# Was there a partial argument that was never completed?
 
85
push @commandLine, $appendNextArg if ($appendNextArg);
 
86
 
 
87
# Call the real Java compiler.
 
88
my @fullCommandLine = ( $javaCompiler, '-C' );
 
89
push @fullCommandLine, $warnings if ($warnings);
 
90
push @fullCommandLine, @commandLine;
 
91
exec @fullCommandLine or exit(1);