3
# Starts the GNU Java header generator.
5
# Command-line arguments should be in the style of Sun's javah command;
6
# these will be converted to gcjh arguments before being passed to the
9
# Copyright (C) 2003 by Peter Hawkins <peterh@debian.org>
10
# Haphazardly hacked up based on the gcj-wrapper perl script.
11
# Copyright (C) 2002-2003 by Ben Burton <bab@debian.org>
12
# Based on the original gcj-wrapper-3.2 shell script.
16
# The real Java header generator:
17
my $javaHeaderGen = '/usr/bin/gcjh-@BV@';
19
# The command-line arguments to pass to the real Java compiler:
22
# Build the command-line from the arguments given.
23
my $parsingOptions = 1;
25
my $ignoreNextArg = 0;
26
my $appendNextArg = '';
27
foreach my $arg (@ARGV) {
28
# See if we already know what to do with this argument.
33
} elsif ($copyNextArg or not $parsingOptions) {
35
push @commandLine, $arg;
38
} elsif ($appendNextArg) {
39
# Append it to $appendNextArg and then copy directly.
40
push @commandLine, ($appendNextArg . $arg);
45
# Try to interpret Sun-style options.
46
if ($arg eq '-version') {
47
push @commandLine, '--version';
48
} elsif ($arg eq '-h' or $arg eq '-help') {
49
push @commandLine, '--help';
50
} elsif ($arg eq '-verbose') {
51
push @commandLine, '--verbose';
52
} elsif ($arg eq '-classpath' or $arg eq '--classpath' or $arg eq '--cp') {
53
$appendNextArg = '--classpath=';
54
} elsif ($arg eq '-encoding' or $arg eq '-bootclasspath' or
56
$appendNextArg = "-".$arg . '=';
57
} elsif ($arg eq '-d') {
58
push @commandLine, '-d';
60
} elsif ($arg eq '-o') {
61
push @commandLine, '-o';
63
} elsif ($arg eq '-stubs') {
64
push @commandLine, '-stubs';
65
} elsif ($arg eq '-jni') {
66
push @commandLine, '-jni';
67
} elsif ($arg =~ /^-old/) {
68
# An extended Sun option (which we don't support).
69
push @commandLine, '--help' if ($arg eq '-old');
70
} elsif ($arg =~ /^-/) {
71
# An unsupported standalone option.
73
# Some non-option argument has been given.
74
# Stop parsing options at this point.
75
push @commandLine, $arg;
80
# Was there a partial argument that was never completed?
81
push @commandLine, $appendNextArg if ($appendNextArg);
83
# Call the real Java header generator.
84
my @fullCommandLine = ( $javaHeaderGen );
85
push @fullCommandLine, @commandLine;
86
exec @fullCommandLine or exit(1);