1 Things libgcj hackers should know
2 ---------------------------------
4 If you want to hack on the libgcj files you need to be aware of the
5 following things. There are probably lots of other things that should be
6 explained in this HACKING file. Please add them if you discover them :)
10 If you plan to modify a .java file, you will need to configure with
11 --enable-java-maintainer-mode. In order to make this work properly,
12 you will need to have 'ecj1' and 'gjavah' executables in your PATH at
15 One way to do this is to download ecj.jar (see contrib/download_ecj)
16 and write a simple wrapper script like:
19 gij -cp /home/tromey/gnu/Generics/trunk/ecj.jar \
20 org.eclipse.jdt.internal.compiler.batch.GCCMain \
23 For gjavah, you can make a tools.zip from the classes in
24 classpath/lib/tools/ and write a gjavah script like:
27 dir=/home/tromey/gnu/Generics/Gcjh
28 gij -cp $dir/tools.zip \
29 gnu.classpath.tools.javah.Main \
32 Another way to get a version of gjavah is to first do a
33 non-maintainer-mode build and use the newly installed gjavah.
37 To regenerate libjava/configure, first run aclocal passing the flags
38 found near the top of Makefile.am, then autoconf. H. J. Lu writes that
39 this can be done using these commands:
43 ACFLAGS=$(grep "^ACLOCAL_AMFLAGS" Makefile.in | sed -e "s/ACLOCAL_AMFLAGS[ \t ]*=//") &&
44 aclocal-1.9 $ACFLAGS &&
49 See the GCC documentation which auto* versions to use.
53 libgcj uses GNU Classpath as an upstream provider. Snapshots of
54 Classpath are imported into the libgcj source tree. Some classes are
55 overridden by local versions; these files still appear in the libgcj
58 To import a new release:
60 - Check out a classpath snapshot or take a release tar.gz file.
61 I use 'cvs export' for this. Make a tag to ensure future hackers
62 know exactly what revision was checked out; tags are of the form
63 'libgcj-import-DATE' (when using a tagged checkout do:
64 - ./autogen.sh && ./configure && make dist
65 to get a proper .tar.gz for importing below).
66 - Get a svn checkout of
67 svn+ssh://gcc.gnu.org/svn/gcc/branches/CLASSPATH/libjava/classpath
68 this contains "pure" GNU Classpath inside the GCC tree.
69 - Clean it up and get the files from a new version:
70 - find classpath -type f | grep -v /\.svn | grep -v /\.cvs | xargs rm
71 - tar zxf classpath-x.tar.gz
72 - cp -r classpath-x/* classpath
74 - svn status classpath | grep ^\! | cut -c8- | xargs svn remove
75 - svn status classpath | grep ^\? | cut -c8- | xargs svn add
76 - If there are any empty directories now they can be removed. You can find
77 candidates (dirs with files removed) with:
78 - for i in `svn status classpath | grep ^D | cut -c8-`; \
79 do ls -d `dirname $i`; done | uniq
80 - Update vendor branch
81 - svn commit classpath
82 - Note the new revision number (Xrev)
83 - Get a fresh svn trunk checkout and cd gcc/libjava
84 - Merge the changes between classpath versions into the trunk.
85 svn merge -rXrev-1:Xrev \
86 svn+ssh://gcc.gnu.org/svn/gcc/branches/CLASSPATH/libjava/classpath \
88 - Resolve any conflicts pointed out by svn status classpath | grep ^C
89 - Makefile.in files will be regenerated in the next step.
90 - Other files should have a "GCJ LOCAL" comment, and/or are mentioned
91 in the classpath/ChangeLog.gcj file.
92 (Don't forget to svn resolved files.)
93 - Use auto* to create configure, Makefile.in, etc
94 Make sure you have Automake 1.9.6 installed. Exactly that version!
95 You have to make sure to use the gcc libtool.m4 and gcc lt* scripts
98 cp ../../config.sub ../../config.guess .
99 aclocal -I m4 -I ../.. -I ../../config
103 rm -rf autom4te.cache
105 scripts/makemake.tcl > sources.am
107 - Build, fix, till everything works.
108 Be sure to build all peers (--enable-java-awt=gtk,xlib,qt
110 Be sure to update gnu/classpath/Configuration.java to reflect
112 Possibly update the gcj/javaprims.h file with scripts/classes.pl
113 (See below, it can only be done after the first source->bytecode
115 You will need to configure with --enable-maintainer-mode and you
116 will need to update the .class files and generated CNI header files in
119 Over time we plan to remove as many of the remaining divergences as
122 File additions and deletions require running scripts/makemake.tcl
123 before running automake.
127 In general you should not make any changes in the classpath/
128 directory. Changes here should come via imports from upstream.
129 However, there are three (known) exceptions to this rule:
131 * In an emergency, such as a bootstrap breakage, it is ok to commit a
132 patch provided that the problem is resolved (by fixing a compiler
133 bug or fixing the Classpath bug upstream) somehow and the resolution
134 is later checked in (erasing the local diff).
136 * On a release branch to fix a bug, where a full-scale import of
137 Classpath is not advisable.
139 * We maintain a fair number of divergences in the build system.
140 This is a pain but they don't seem suitable for upstream.
144 You can develop in a GCC tree using a CVS checkout of Classpath, most
145 of the time. (The exceptions are when an incompatible change has been
146 made in Classpath and some core part of libgcj has not yet been
149 The way to set this up is very similar to importing a new version of
150 Classpath into the libgcj tree. In your working tree:
152 * cd gcc/libjava; rm -rf classpath
155 Now run the auto tools as specified in the import process; then
157 * Run 'scripts/makemake.tcl > sources.am' in the source tree
158 * Run automake for libgcj
160 Now you should be ready to go.
162 If you are working in a tree like this, you must remember to run
163 makemake.tcl and automake whenever you update your embedded classpath
168 If you add a class to java.lang, java.io, or java.util
169 (including sub-packages, like java.lang.ref).
171 * Edit gcj/javaprims.h
173 * Go to the `namespace java' line, and delete that entire block (the
174 entire contents of the namespace)
176 * Then insert the output of `perl scripts/classes.pl' into the file
177 at that point. This must be run from the build tree, in
178 <build>/classpath/lib; it uses the .class file name to determine