You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
gentoo-overlay/dev-java/icedtea/files/icedtea-6-pass_javac_memory...

100 lines
2.9 KiB

# HG changeset patch
# User Andrew John Hughes <ahughes@redhat.com>
# Date 1336602703 -3600
# Node ID fe14de44c8a8961a9ebc7f9d6a896dea26fa8afb
# Parent 643fb6254e8086111966e01877d19a0deff6dceb
Allow builds where the memory limit of the VM needs to be increased to run javac.
2012-05-09 Andrew John Hughes <ahughes@redhat.com>
* Makefile.am:
(MEMORY_LIMIT): Always set this.
* javac.in:
Split out '-J' prefixed options and pass them
to the VM rather than ecj. Filter out
'-J-Xbootclasspath/p:', which makes no sense
as there's nothing to prepend, and confuses
the VM.
diff --git a/Makefile.am b/Makefile.am
--- a/Makefile.am
+++ b/Makefile.am
@@ -89,6 +89,7 @@
$(SHARE)/com/sun/java/swing/plaf/nimbus/NimbusLookAndFeel.java
# Flags
+MEMORY_LIMIT = -J-Xmx1024m
IT_CFLAGS=$(CFLAGS) $(ARCHFLAG)
IT_JAVAC_SETTINGS=-g -encoding utf-8 $(JAVACFLAGS) $(MEMORY_LIMIT) $(PREFER_SOURCE)
IT_LANGUAGE_SOURCE_VERSION=6
@@ -120,15 +121,6 @@
PULSE_JAVA_CLEAN_TARGET = clean-pulse-java
endif
-# FIXME: This should not depend on bootstrapping
-# but on whether MEMORY_LIMIT is accepted
-# as an argument to javac
-if BOOTSTRAPPING
- MEMORY_LIMIT =
-else
- MEMORY_LIMIT = -J-Xmx1024m
-endif
-
if ENABLE_CACAO
ICEDTEA_BUILD_TARGET=jdk_only
ICEDTEA_DEBUG_BUILD_TARGET = jdk_fastdebug_only
diff --git a/javac.in b/javac.in
--- a/javac.in
+++ b/javac.in
@@ -1,7 +1,7 @@
#!/usr/bin/perl -w
use strict;
use constant NO_DUP_ARGS => qw(-source -target -d -encoding);
-use constant STRIP_ARGS => qw(-Werror -implicit:none);
+use constant STRIP_ARGS => qw(-Werror -implicit:none -J-Xbootclasspath/p:);
my $ECJ_WARNINGS="-nowarn";
@@ -31,24 +31,34 @@
splice @new_args, $_, 1 for @indices;
}
- return @new_args;
+ return \@new_args;
+}
+
+sub split_vm_args
+{
+ my @new_args = @{$_[0]};
+
+ my @vm_args = map { substr $_, 2 } grep $_ =~ /^-J/, @new_args;
+ my @javac_args = grep $_ !~ /^-J/, @new_args;
+
+ return (\@vm_args, \@javac_args);
}
if ( -e "@abs_top_builddir@/native-ecj" )
{
- my @ecj_args = gen_ecj_opts( \@ARGV );
- exec '@abs_top_builddir@/native-ecj', @ecj_parms, @ecj_args ;
+ my $ecj_args = gen_ecj_opts( \@ARGV );
+ exec '@abs_top_builddir@/native-ecj', @ecj_parms, @$ecj_args ;
}
elsif ( -e "@ECJ_JAR@" )
{
- my @ecj_args = gen_ecj_opts( \@ARGV );
+ my ($vm_args, $javac_args) = split_vm_args (gen_ecj_opts( \@ARGV ));
my @CLASSPATH = ('@ECJ_JAR@');
push @CLASSPATH, split /:/, $ENV{"CLASSPATH"} if exists $ENV{"CLASSPATH"};
$ENV{"CLASSPATH"} = join ':', @CLASSPATH;
- exec '@JAVA@', 'org.eclipse.jdt.internal.compiler.batch.Main', @ecj_parms, @ecj_args;
+ exec '@JAVA@', @$vm_args, 'org.eclipse.jdt.internal.compiler.batch.Main', @ecj_parms, @$javac_args;
}
else
{
- my @ecj_args = gen_ecj_opts( \@ARGV );
- exec '@ECJ@', @ecj_parms, @ecj_args ;
+ my $ecj_args = gen_ecj_opts( \@ARGV );
+ exec '@ECJ@', @ecj_parms, @$ecj_args ;
}