Patch: gcj-dbtool -p LIBDIR

Anthony Green green@redhat.com
Fri Mar 25 00:02:00 GMT 2005


As discussed here:

https://www.redhat.com/archives/fedora-devel-java-list/2005-March/msg00232.html

This patch lets us use an optional LIBDIR command line option with the 
-p option.

Ok for 4.0 branch and HEAD?

Thanks,

AG


-------------- next part --------------
2005-03-24  Anthony Green  <green@redhat.com>

	* gnu/gcj/tools/gcj_dbtool/Main.java: Accept libdir argument with
	-p option.
	(usage): Add [LIBDIR] to help output.
	* gnu/gcj/tools/gcj_dbtool/natMain.cc: New file.
	* Makefile.am (AM_CXXFLAGS): Define
	LIBGCJ_DEFAULT_DATABASE_PATH_TAIL.
	(db_pathtail): New macro.


Index: Makefile.am
===================================================================
RCS file: /cvs/gcc/gcc/libjava/Makefile.am,v
retrieving revision 1.455.2.5
diff -c -p -r1.455.2.5 Makefile.am
*** Makefile.am	22 Mar 2005 22:54:08 -0000	1.455.2.5
--- Makefile.am	24 Mar 2005 20:58:20 -0000
*************** propdir = $(libdir)
*** 127,132 ****
--- 127,134 ----
  dbexecdir = $(libdir)/gcj-@gcc_version@
  ## Name of the default .db.
  db_name = classmap.db
+ ## Compiler specific component of the .db file
+ db_pathtail = gcj-@gcc_version@/$(db_name)
  
  ## For now, only on native systems.  FIXME.
  if NATIVE
*************** AM_CXXFLAGS = \
*** 181,187 ****
  	-DLIBDIR="\"$(libdir)\"" \
  	-DBOOT_CLASS_PATH="\"$(jardir)/$(jar_DATA)\"" \
  	-DJAVA_EXT_DIRS="\"$(jardir)/ext\"" \
! 	-DLIBGCJ_DEFAULT_DATABASE="\"$(dbexecdir)/$(db_name)\""
  
  AM_GCJFLAGS = \
  	@LIBGCJ_JAVAFLAGS@ \
--- 183,190 ----
  	-DLIBDIR="\"$(libdir)\"" \
  	-DBOOT_CLASS_PATH="\"$(jardir)/$(jar_DATA)\"" \
  	-DJAVA_EXT_DIRS="\"$(jardir)/ext\"" \
! 	-DLIBGCJ_DEFAULT_DATABASE="\"$(dbexecdir)/$(db_name)\"" \
! 	-DLIBGCJ_DEFAULT_DATABASE_PATH_TAIL="\"$(db_pathtail)\""
  
  AM_GCJFLAGS = \
  	@LIBGCJ_JAVAFLAGS@ \
*************** inner_nat_headers = java/io/ObjectOutput
*** 666,672 ****
  	gnu/java/nio/PipeImpl$$SourceChannelImpl.h \
  	$(PLATFORM_INNER_NAT_HDRS)
  
! nat_headers = $(ordinary_nat_headers) $(inner_nat_headers)
  nat_headers_install = $(ordinary_nat_headers)
  
  xlib_nat_headers = $(xlib_java_source_files:.java=.h)
--- 669,675 ----
  	gnu/java/nio/PipeImpl$$SourceChannelImpl.h \
  	$(PLATFORM_INNER_NAT_HDRS)
  
! nat_headers = $(ordinary_nat_headers) $(inner_nat_headers) gnu/gcj/tools/gcj_dbtool/Main.h
  nat_headers_install = $(ordinary_nat_headers)
  
  xlib_nat_headers = $(xlib_java_source_files:.java=.h)
*************** jv_convert_LDADD = -L$(here)/.libs libgc
*** 979,985 ****
  ## linking this program.
  jv_convert_DEPENDENCIES = libgcj.la libgcj.spec
  
! gcj_dbtool_SOURCES = gnu/gcj/tools/gcj_dbtool/Main.java
  ## We need -nodefaultlibs because we want to avoid gcj's `-lgcj'.  We
  ## need this because we are explicitly using libtool to link using the
  ## `.la' file.
--- 982,989 ----
  ## linking this program.
  jv_convert_DEPENDENCIES = libgcj.la libgcj.spec
  
! gcj_dbtool_SOURCES = gnu/gcj/tools/gcj_dbtool/Main.java \
! 	gnu/gcj/tools/gcj_dbtool/natMain.cc
  ## We need -nodefaultlibs because we want to avoid gcj's `-lgcj'.  We
  ## need this because we are explicitly using libtool to link using the
  ## `.la' file.
Index: gnu/gcj/tools/gcj_dbtool/Main.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/gnu/gcj/tools/gcj_dbtool/Main.java,v
retrieving revision 1.5.2.3
diff -c -p -r1.5.2.3 Main.java
*** gnu/gcj/tools/gcj_dbtool/Main.java	22 Mar 2005 16:57:39 -0000	1.5.2.3
--- gnu/gcj/tools/gcj_dbtool/Main.java	24 Mar 2005 20:58:20 -0000
*************** public class Main
*** 259,267 ****
  
      if (s[0].equals("-p"))
        {
! 	insist (s.length == 1);
! 	String result = System.getProperty("gnu.gcj.precompiled.db.path",
! 					   "");
  	System.out.println (result);
  	return;
        }
--- 259,274 ----
  
      if (s[0].equals("-p"))
        {
! 	insist (s.length == 1 || s.length == 2);
! 	String result;
! 	
! 	if (s.length == 1)
! 	  result = System.getProperty("gnu.gcj.precompiled.db.path", "");
! 	else 
! 	  result = s[1] 
! 	    + (s[1].endsWith(File.separator) ? "" : File.separator)
! 	    + getDbPathTail ();
! 
  	System.out.println (result);
  	return;
        }
*************** public class Main
*** 270,275 ****
--- 277,284 ----
      System.exit(1);	    
    }
  
+   private static native String getDbPathTail ();
+     
    private static void insist(boolean ok)
    {
      if (! ok)
*************** public class Main
*** 296,302 ****
         + "             - Merge gcj map databases into dest\n"
         + "               Replaces dest\n"
         + "               To add to dest, include dest in the list of sources\n"
!        + "    gcj-dbtool -p                       - Print default database name");
    }
  
    // Add a jar to a map.  This copies the map first and returns a
--- 305,311 ----
         + "             - Merge gcj map databases into dest\n"
         + "               Replaces dest\n"
         + "               To add to dest, include dest in the list of sources\n"
!        + "    gcj-dbtool -p [LIBDIR]              - Print default database name");
    }
  
    // Add a jar to a map.  This copies the map first and returns a
Index: gnu/gcj/tools/gcj_dbtool/natMain.cc
===================================================================
RCS file: gnu/gcj/tools/gcj_dbtool/natMain.cc
diff -N gnu/gcj/tools/gcj_dbtool/natMain.cc
*** /dev/null	1 Jan 1970 00:00:00 -0000
--- gnu/gcj/tools/gcj_dbtool/natMain.cc	24 Mar 2005 20:58:20 -0000
***************
*** 0 ****
--- 1,24 ----
+ // natMain -- gcj-dbtool native code.
+ 
+ /* Copyright (C) 2005  Free Software Foundation
+ 
+    This file is part of gcj-dbtool.
+ 
+ This software is copyrighted work licensed under the terms of the
+ Libgcj License.  Please consult the file "LIBGCJ_LICENSE" for
+ details.  */
+ 
+ /* Author: Anthony Green <green@redhat.com>.  */
+ 
+ #include <config.h>
+ 
+ #include <gcj/cni.h>
+ #include <jvm.h>
+ 
+ #include <gnu/gcj/tools/gcj_dbtool/Main.h>
+ 
+ java::lang::String *
+ gnu::gcj::tools::gcj_dbtool::Main::getDbPathTail ()
+ {
+   return JvNewStringLatin1 (LIBGCJ_DEFAULT_DATABASE_PATH_TAIL);
+ }


More information about the Java-patches mailing list