diff --git a/security/coreconf/jniregen.pl b/security/coreconf/jniregen.pl index 607eaf68b179..05774cff741a 100755 --- a/security/coreconf/jniregen.pl +++ b/security/coreconf/jniregen.pl @@ -32,28 +32,39 @@ # GPL. # -# Input: -d dir foo1 foo2 . . . +# Input: -d dir -j javahcmd foo1 foo2 . . . # Compares generated "_jni/foo1.h" file with "foo1.class", and # generated "_jni/foo2.h" file with "foo2.class", etc. # (NOTE: unlike its closely related cousin, outofdate.pl, # the "-d dir" must always be specified) +# Runs the javahcmd on all files that are different. # # Returns: list of headers which are OLDER than corresponding class # files (non-existant class files are considered to be real old :-) -$found = 1; +my $javah = ""; +my $classdir = ""; -if ($ARGV[0] eq '-d') -{ - $classdir = $ARGV[1]; - $classdir .= "/"; - shift; - shift; +while(1) { + if ($ARGV[0] eq '-d') { + $classdir = $ARGV[1]; + $classdir .= "/"; + shift; + shift; + } elsif($ARGV[0] eq '-j') { + $javah = $ARGV[1]; + shift; + shift; + } else { + last; + } } -else -{ - print STDERR "Usage: perl ", $0, " -d dir foo1 foo2 . . .\n"; - exit -1; + +if( $javah eq "") { + die "Must specify -j "; +} +if( $classdir eq "") { + die "Must specify -d "; } foreach $filename (@ARGV) @@ -81,12 +92,15 @@ foreach $filename (@ARGV) # NOTE: Since this is used by "javah", and "javah" refuses to overwrite # an existing file, we force an unlink from this script, since # we actually want to regenerate the header file at this time. - unlink $headerfilename; - print $filename, " "; - $found = 0; + unlink $headerfilename; + push @filelist, $filename; } } -print "\n"; -exit 0; - +if( @filelist ) { + $cmd = "$javah " . join(" ",@filelist); + print "$cmd\n"; + system("$cmd"); +} else { + print "All JNI header files up to date.\n" +} diff --git a/security/coreconf/rules.mk b/security/coreconf/rules.mk index cac070109cc4..49e637e39d13 100644 --- a/security/coreconf/rules.mk +++ b/security/coreconf/rules.mk @@ -567,7 +567,14 @@ ifdef NETLIBDEPTH CORE_DEPTH := $(NETLIBDEPTH) endif +# !!!!! THIS WILL CRASH SHMSDOS.EXE !!!!! +# shmsdos does not support shell variables. It will crash when it tries +# to parse the '=' character. A solution is to rewrite outofdate.pl so it +# takes the Javac command as an argument and executes the command itself, +# instead of returning a list of files. export:: $(JAVA_DESTPATH) $(JAVA_DESTPATH)/$(PACKAGE) + @echo "!!! THIS COMMAND IS BROKEN ON WINDOWS--SEE rules.mk FOR DETAILS !!!" + return -1 @for d in $(JDIRS); do \ if test -d $$d; then \ set $(EXIT_ON_ERROR); \ @@ -701,14 +708,8 @@ export:: $(JAVAH) -jni -d $(JNI_GEN_DIR) $(JNI_GEN); \ else \ echo "Checking for out of date header files" ; \ - cmd="perl $(CORE_DEPTH)/coreconf/jniregen.pl $(PERLARG) \ - -d $(JAVA_DESTPATH) $(JNI_GEN)"; \ - echo $$cmd; \ - list=`$$cmd`; \ - if test "$${list}x" != "x"; then \ - echo $(JAVAH) -jni -d $(JNI_GEN_DIR) $$list; \ - $(JAVAH) -jni -d $(JNI_GEN_DIR) $$list; \ - fi \ + perl $(CORE_DEPTH)/coreconf/jniregen.pl $(PERLARG) \ + -d $(JAVA_DESTPATH) -j "$(JAVAH) -jni -d $(JNI_GEN_DIR)" $(JNI_GEN);\ fi endif endif