3
# Starts the GNU Java compiler.
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
9
# Copyright (C) 2002-2003 by Ben Burton <bab@debian.org>
10
# Based on the original gcj-wrapper-3.2 shell script.
14
# The real Java compiler:
15
my $javaCompiler = '/usr/bin/gcj-@BV@';
17
# The command-line arguments to pass to the real Java compiler:
20
# The warning flags to pass to the GNU Java compiler:
21
my $warnings = '-Wall';
23
# Build the command-line from the arguments given.
24
my $parsingOptions = 1;
26
my $ignoreNextArg = 0;
27
my $appendNextArg = '';
28
foreach my $arg (@ARGV) {
29
# See if we already know what to do with this argument.
34
} elsif ($copyNextArg or not $parsingOptions) {
36
push @commandLine, $arg;
39
} elsif ($appendNextArg) {
40
# Append it to $appendNextArg and then copy directly.
41
push @commandLine, ($appendNextArg . $arg);
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
55
$appendNextArg = '-' . $arg . '=';
56
} elsif ($arg eq '-d') {
57
push @commandLine, '-d';
59
} elsif ($arg eq '-nowarn') {
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.
74
} elsif ($arg =~ /^-/) {
75
# An unsupported standalone option.
77
# Some non-option argument has been given.
78
# Stop parsing options at this point.
79
push @commandLine, $arg;
84
# Was there a partial argument that was never completed?
85
push @commandLine, $appendNextArg if ($appendNextArg);
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);