~angelsl/ubuntu/wily/gcc-5/mips-cross

« back to all changes in this revision

Viewing changes to debian/gcjh-wrapper-BV

  • Committer: angelsl
  • Date: 2015-10-30 03:30:35 UTC
  • Revision ID: angelsl-20151030033035-rmug41zm8hyjgisg
Original import

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/perl -w
 
2
#
 
3
# Starts the GNU Java header generator.
 
4
#
 
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
 
7
# gcjh itself.
 
8
#
 
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.
 
13
 
 
14
use strict;
 
15
 
 
16
# The real Java header generator:
 
17
my $javaHeaderGen = '/usr/bin/gcjh-@BV@';
 
18
 
 
19
# The command-line arguments to pass to the real Java compiler:
 
20
my @commandLine;
 
21
 
 
22
# Build the command-line from the arguments given.
 
23
my $parsingOptions = 1;
 
24
my $copyNextArg = 0;
 
25
my $ignoreNextArg = 0;
 
26
my $appendNextArg = '';
 
27
foreach my $arg (@ARGV) {
 
28
    # See if we already know what to do with this argument.
 
29
    if ($ignoreNextArg) {
 
30
        # Throw it away.
 
31
        $ignoreNextArg = 0;
 
32
        next;
 
33
    } elsif ($copyNextArg or not $parsingOptions) {
 
34
        # Copy it directly.
 
35
        push @commandLine, $arg;
 
36
        $copyNextArg = 0;
 
37
        next;
 
38
    } elsif ($appendNextArg) {
 
39
        # Append it to $appendNextArg and then copy directly.
 
40
        push @commandLine, ($appendNextArg . $arg);
 
41
        $appendNextArg = '';
 
42
        next;
 
43
    }
 
44
 
 
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
 
55
             $arg eq '-extdirs') {
 
56
        $appendNextArg = "-".$arg . '=';
 
57
    } elsif ($arg eq '-d') {
 
58
        push @commandLine, '-d';
 
59
        $copyNextArg = 1;
 
60
    } elsif ($arg eq '-o') {
 
61
        push @commandLine, '-o';
 
62
        $copyNextArg = 1;
 
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.
 
72
    } else {
 
73
        # Some non-option argument has been given.
 
74
        # Stop parsing options at this point.
 
75
        push @commandLine, $arg;
 
76
        $parsingOptions = 0;
 
77
    }
 
78
}
 
79
 
 
80
# Was there a partial argument that was never completed?
 
81
push @commandLine, $appendNextArg if ($appendNextArg);
 
82
 
 
83
# Call the real Java header generator.
 
84
my @fullCommandLine = ( $javaHeaderGen );
 
85
push @fullCommandLine, @commandLine;
 
86
exec @fullCommandLine or exit(1);