aboutsummaryrefslogtreecommitdiff
path: root/libjava/HACKING
blob: 3c07e5ab4d99c39c205db69f68406c3d23884159 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
Things libgcj hackers should know
---------------------------------

If you want to hack on the libgcj files you need to be aware of the
following things. There are probably lots of other things that should be
explained in this HACKING file. Please add them if you discover them :)

--

libgcj uses GNU Classpath as an upstream provider.  Snapshots of
Classpath are imported into the libgcj source tree.  Some classes are
overridden by local versions; these files still appear in the libgcj
tree.

To import a new release:

- Check out a classpath snapshot or take a release tar.gz file.
  I use 'cvs export' for this.  Make a tag to ensure future hackers
  know exactly what revision was checked out; tags are of the form
  'libgcj-import-DATE' (when using a tagged checkout do:
  - ./autogen.sh && ./configure && make dist
  to get a proper .tar.gz for importing below).
- Get a svn checkout of
  svn+ssh://gcc.gnu.org/svn/gcc/branches/CLASSPATH/libjava/classpath
  this contains "pure" GNU Classpath inside the GCC tree.
- Clean it up and get the files from a new version:
  - find classpath -type f | grep -v /\.svn | grep -v /\.cvs | xargs rm
  - tar zxf classpath-x.tar.gz
  - cp -r classpath-x/* classpath
- Add/Remove files:
  - svn status classpath | grep ^\! | cut -c8- | xargs svn remove
  - svn status classpath | grep ^\? | cut -c8- | xargs svn add
- If there are any empty directories now they can be removed. You can find
  candidates (dirs with files removed) with:
  - for i in `svn status classpath | grep ^D | cut -c8-`; \
      do ls -d `dirname $i`; done | uniq
- Update vendor branch
  - svn commit classpath
- Note the new revision number (Xrev)
- Get a fresh svn trunk checkout and cd gcc/libjava
- Merge the changes between classpath versions into the trunk.
  svn merge -rXrev-1:Xrev \
  svn+ssh://gcc.gnu.org/svn/gcc/branches/CLASSPATH/libjava/classpath \
  classpath
- Resolve any conflicts pointed out by svn status classpath | grep ^C
  - Makefile.in files will be regenerated in the next step.
  - Other files should have a "GCJ LOCAL" comment, and/or are mentioned
    in the classpath/ChangeLog.gcj file.
   (Don't forget to svn resolved files.)
- Use auto* to create configure, Makefile.in, etc
  Make sure you have Automake 1.9.6 installed. Exactly that version!
  You have to make sure to use the gcc libtool.m4 and gcc lt* scripts
  cd .../classpath
  cp ../../lt* .
  cp ../../config.sub ../../config.guess .
  aclocal -I m4 -I ../.. -I ../../config
  autoconf
  autoheader
  automake
  rm -rf autom4te.cache
  cd ..
  scripts/makemake.tcl > sources.am
  automake
- Build, fix, till everything works.
  Be sure to update gnu/classpath/Configuration.java to reflect
    the new version
  Possibly update the gcj/javaprims.h file with scripts/classes.pl
  (See below, it can only be done after the first source->bytecode
   pass has finished.)
  You will need to configure with --enable-maintainer-mode and you
  will need to update the .class files and generated CNI header files in
  your working tree

Over time we plan to remove as many of the remaining divergences as
possible.

File additions and deletions require running scripts/makemake.tcl
before running automake.

--

In general you should not make any changes in the classpath/
directory.  Changes here should come via imports from upstream.
However, there are two (known) exceptions to this rule:

* In an emergency, such as a bootstrap breakage, it is ok to commit a
  patch provided that the problem is resolved (by fixing a compiler
  bug or fixing the Classpath bug upstream) somehow and the resolution
  is later checked in (erasing the local diff).

* On a release branch to fix a bug, where a full-scale import of
  Classpath is not advisable.

--

You can develop in a GCC tree using a CVS checkout of Classpath, most
of the time.  (The exceptions are when an incompatible change has been
made in Classpath and some core part of libgcj has not yet been
updated.)

The way to set this up is very similar to importing a new version of
Classpath into the libgcj tree.  In your working tree:

* cd gcc/libjava; rm -rf classpath
* cvs co classpath
* cd classpath
  Now run the auto tools as specified in the import process; then
  cd ..
* Run 'scripts/makemake.tcl > sources.am' in the source tree
* Run automake for libgcj

Now you should be ready to go.

If you are working in a tree like this, you must remember to run
makemake.tcl and automake whenever you update your embedded classpath
tree.

--

If you add a class to java.lang, java.io, or java.util
(including sub-packages, like java.lang.ref).

* Edit gcj/javaprims.h

* Go to the `namespace java' line, and delete that entire block (the   
  entire contents of the namespace)

* Then insert the output of `perl scripts/classes.pl' into the file
  at that point.  This must be run from the build tree, in
  <build>/classpath/lib; it uses the .class file name to determine
  what to print.

If you're generating a patch there is a program you can get to do an
offline `cvs add' (it will fake an `add' if you don't have write
permission yet).  Then you can use `cvs diff -N' to generate the
patch.  See http://www.red-bean.com/cvsutils/