]> git.ipfire.org Git - thirdparty/gcc.git/blame - libjava/HACKING
Fix bug Joern Rennecke reported.
[thirdparty/gcc.git] / libjava / HACKING
CommitLineData
a7e96ed4
MW
1Things libgcj hackers should know
2---------------------------------
3
4If you want to hack on the libgcj files you need to be aware of the
5following things. There are probably lots of other things that should be
6explained in this HACKING file. Please add them if you discover them :)
7
8--
9
10f1f9f7
TT
10If 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,
12you will need to have 'ecj1' and 'gjavah' executables in your PATH at
13build time.
14
15One way to do this is to download ecj.jar (see contrib/download_ecj)
16and write a simple wrapper script like:
17
18 #! /bin/sh
19 gij -cp /home/tromey/gnu/Generics/trunk/ecj.jar \
20 org.eclipse.jdt.internal.compiler.batch.GCCMain \
21 ${1+"$@"}
22
23For gjavah, you can make a tools.zip from the classes in
24classpath/lib/tools/ and write a gjavah script like:
25
26 #! /bin/sh
27 dir=/home/tromey/gnu/Generics/Gcjh
28 gij -cp $dir/tools.zip \
29 gnu.classpath.tools.javah.Main \
30 ${1+"$@"}
31
32Another way to get a version of gjavah is to first do a
33non-maintainer-mode build and use the newly installed gjavah.
34
35--
36
9b40cf16
DD
37To regenerate libjava/configure, first run aclocal passing the flags
38found near the top of Makefile.am, then autoconf. H. J. Lu writes that
39this can be done using these commands:
40
41 cd libjava &&
42 rm -f aclocal.m4 &&
43 ACFLAGS=$(grep "^ACLOCAL_AMFLAGS" Makefile.in | sed -e "s/ACLOCAL_AMFLAGS[ \t ]*=//") &&
44 aclocal-1.9 $ACFLAGS &&
45 rm -f configure &&
46 autoconf-2.59 &&
47 rm -fr autom4te.cache
d94998c9
MK
48
49See the GCC documentation which auto* versions to use.
50
51--
52
b0fa81ee
TT
53libgcj uses GNU Classpath as an upstream provider. Snapshots of
54Classpath are imported into the libgcj source tree. Some classes are
55overridden by local versions; these files still appear in the libgcj
56tree.
57
58To import a new release:
59
6a70560c 60- Check out a classpath snapshot or take a release tar.gz file.
42e13a3f
TT
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
ac1ed908
MW
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).
6a70560c
MW
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:
39897cdc 70 - find classpath -type f | grep -v '/\.svn' | grep -v '/\.cvs' | xargs rm
6a70560c
MW
71 - tar zxf classpath-x.tar.gz
72 - cp -r classpath-x/* classpath
73- Add/Remove files:
74 - svn status classpath | grep ^\! | cut -c8- | xargs svn remove
75 - svn status classpath | grep ^\? | cut -c8- | xargs svn add
ac1ed908
MW
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
6a70560c
MW
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 \
87 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.)
b0fa81ee 93- Use auto* to create configure, Makefile.in, etc
ac1ed908 94 Make sure you have Automake 1.9.6 installed. Exactly that version!
b0fa81ee
TT
95 You have to make sure to use the gcc libtool.m4 and gcc lt* scripts
96 cd .../classpath
97 cp ../../lt* .
e7d15bad 98 cp ../../config.sub ../../config.guess .
df3e8c70 99 aclocal -I m4 -I ../.. -I ../../config
b0fa81ee
TT
100 autoconf
101 autoheader
102 automake
103 rm -rf autom4te.cache
6a70560c
MW
104 cd ..
105 scripts/makemake.tcl > sources.am
106 automake
f06a83c0 107- Remove the generated class and header files:
792046b6 108 find classpath -name '*.class' | xargs -r rm -f
f06a83c0
MK
109 find gnu java javax org sun -name '*.h' \
110 | xargs -r grep -Fl 'DO NOT EDIT THIS FILE - it is machine generated' \
111 | xargs -r rm -f
6a70560c 112- Build, fix, till everything works.
e1bea0c0 113 Be sure to build all peers (--enable-java-awt=gtk,xlib,qt
f06a83c0 114 --enable-gconf-peer --enable-gstreamer-peer)
97b8365c
TT
115 Be sure to update gnu/classpath/Configuration.java to reflect
116 the new version
6a70560c
MW
117 Possibly update the gcj/javaprims.h file with scripts/classes.pl
118 (See below, it can only be done after the first source->bytecode
119 pass has finished.)
f06a83c0 120 You will need to configure with --enable-java-maintainer-mode and you
97b8365c
TT
121 will need to update the .class files and generated CNI header files in
122 your working tree
f06a83c0 123- Add/Remove newly generated files:
39897cdc
RW
124 - svn status classpath | grep '^!.*\.class$' | cut -c8- | xargs svn remove
125 - svn status classpath | grep '^?' | cut -c8- | xargs svn add
126 - svn status gnu java javax org sun | grep '^!.*\.h$' | cut -c8- | xargs svn remove
127 - svn status gnu java javax org sun | grep '^?' | cut -c8- | xargs svn add
b0fa81ee
TT
128
129Over time we plan to remove as many of the remaining divergences as
130possible.
131
132File additions and deletions require running scripts/makemake.tcl
133before running automake.
134
a7e96ed4
MW
135--
136
42e13a3f
TT
137In general you should not make any changes in the classpath/
138directory. Changes here should come via imports from upstream.
10f1f9f7 139However, there are three (known) exceptions to this rule:
42e13a3f
TT
140
141* In an emergency, such as a bootstrap breakage, it is ok to commit a
142 patch provided that the problem is resolved (by fixing a compiler
143 bug or fixing the Classpath bug upstream) somehow and the resolution
144 is later checked in (erasing the local diff).
145
146* On a release branch to fix a bug, where a full-scale import of
147 Classpath is not advisable.
148
10f1f9f7
TT
149* We maintain a fair number of divergences in the build system.
150 This is a pain but they don't seem suitable for upstream.
151
42e13a3f 152--
a7e96ed4 153
aa5190e9
TT
154You can develop in a GCC tree using a CVS checkout of Classpath, most
155of the time. (The exceptions are when an incompatible change has been
156made in Classpath and some core part of libgcj has not yet been
157updated.)
158
159The way to set this up is very similar to importing a new version of
160Classpath into the libgcj tree. In your working tree:
161
162* cd gcc/libjava; rm -rf classpath
163* cvs co classpath
164* cd classpath
165 Now run the auto tools as specified in the import process; then
166 cd ..
167* Run 'scripts/makemake.tcl > sources.am' in the source tree
168* Run automake for libgcj
169
170Now you should be ready to go.
171
172If you are working in a tree like this, you must remember to run
173makemake.tcl and automake whenever you update your embedded classpath
174tree.
175
176--
177
7729617c
MW
178If you add a class to java.lang, java.io, or java.util
179(including sub-packages, like java.lang.ref).
180
181* Edit gcj/javaprims.h
182
183* Go to the `namespace java' line, and delete that entire block (the
184 entire contents of the namespace)
185
b0fa81ee
TT
186* Then insert the output of `perl scripts/classes.pl' into the file
187 at that point. This must be run from the build tree, in
188 <build>/classpath/lib; it uses the .class file name to determine
189 what to print.