Patch: gcj-dbtool -p LIBDIR

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


On Thu, 2005-03-24 at 16:43 -0700, Tom Tromey wrote:
> >>>>> "Anthony" == Anthony Green <green@redhat.com> writes:
> 
> Anthony> Ok for 4.0 branch and HEAD?
> 
> Yes, with a couple nits...

Ok, here's the patch I'm checking in.  Thanks!

AG


-------------- next part --------------
>From libjava...

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.

>From gcc/java...

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

	* gcj.texi (Invoking gcj-dbtool): Document new LIBDIR option to
	'gcj-dbtool -p'.



Index: libjava/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
*** libjava/Makefile.am	22 Mar 2005 22:54:08 -0000	1.455.2.5
--- libjava/Makefile.am	24 Mar 2005 23:59:16 -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: gcc/java/gcj.texi
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/gcj.texi,v
retrieving revision 1.73.2.2
diff -c -p -r1.73.2.2 gcj.texi
*** gcc/java/gcj.texi	11 Mar 2005 16:57:18 -0000	1.73.2.2
--- gcc/java/gcj.texi	24 Mar 2005 23:59:18 -0000
*************** Each time a class is initialized, print 
*** 991,997 ****
  gcj-dbtool @option{OPTION} @var{DBFILE} [@option{MORE}] @dots{}
  
  gcj-dbtool [@option{-n}] [@option{-a}] [@option{-f}]
!   [@option{-t}] [@option{-l}] [@option{-p}]
    [@option{-v}] [@option{--version}] [@option{--help}]
  
  @c man end
--- 991,997 ----
  gcj-dbtool @option{OPTION} @var{DBFILE} [@option{MORE}] @dots{}
  
  gcj-dbtool [@option{-n}] [@option{-a}] [@option{-f}]
!   [@option{-t}] [@option{-l}] [@option{-p} [@var{LIBDIR}]]
    [@option{-v}] [@option{--version}] [@option{--help}]
  
  @c man end
*************** List the contents of a database.
*** 1045,1051 ****
  
  @item -p
  Print the name of the default database.  If there is no default
! database, this prints a blank line.
  
  @item --help
  Print a help message, then exit.
--- 1045,1053 ----
  
  @item -p
  Print the name of the default database.  If there is no default
! database, this prints a blank line.  If @var{LIBDIR} is specified, use
! it instead of the default library directory component of the database
! name.
  
  @item --help
  Print a help message, then exit.
Index: libjava/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
*** libjava/gnu/gcj/tools/gcj_dbtool/Main.java	22 Mar 2005 16:57:39 -0000	1.5.2.3
--- libjava/gnu/gcj/tools/gcj_dbtool/Main.java	24 Mar 2005 23:59:19 -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: libjava/gnu/gcj/tools/gcj_dbtool/natMain.cc
===================================================================
RCS file: libjava/gnu/gcj/tools/gcj_dbtool/natMain.cc
diff -N libjava/gnu/gcj/tools/gcj_dbtool/natMain.cc
*** /dev/null	1 Jan 1970 00:00:00 -0000
--- libjava/gnu/gcj/tools/gcj_dbtool/natMain.cc	24 Mar 2005 23:59:19 -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