summaryrefslogtreecommitdiff
path: root/lib/gen-classlist.sh.in
diff options
context:
space:
mode:
Diffstat (limited to 'lib/gen-classlist.sh.in')
-rwxr-xr-xlib/gen-classlist.sh.in67
1 files changed, 46 insertions, 21 deletions
diff --git a/lib/gen-classlist.sh.in b/lib/gen-classlist.sh.in
index 4c3a836eb..5f7055ffd 100755
--- a/lib/gen-classlist.sh.in
+++ b/lib/gen-classlist.sh.in
@@ -7,16 +7,34 @@
LC_ALL=C; export LC_ALL
LANG=C; export LANG
-# We use this to decide whether we need to invoke the split script.
-GCJ="@GCJ@"
-
echo "Adding java source files from srcdir '@top_srcdir@'."
-@FIND@ @top_srcdir@/java @top_srcdir@/javax @top_srcdir@/gnu \
- @top_srcdir@/org \
- @top_srcdir@/external/w3c_dom @top_srcdir@/external/sax \
- @top_srcdir@/external/relaxngDatatype \
- -follow -type f -print | sort -r | grep '\.java$' \
- > ${top_builddir}/lib/classes.1
+# We construct 'classes.1' as a series of lines. Each line
+# has three fields, which are separated by spaces. The first
+# field is the package of this class (separated by "/"s).
+# The second field is the name of the top-level directory for
+# this file, relative to the build directory. E.g., it might
+# look like "../../classpath/vm/reference".
+# The third field is the file name, like "java/lang/Object.java".
+# We do this because it makes splitting for the gcj build much
+# cheaper.
+(cd @top_srcdir@
+ @FIND@ java javax gnu org -follow -name '*.java' -print |
+ sort -r | sed -e 's,/\([^/]*\)$, \1,' |
+ while read pkg file; do
+ echo $pkg @top_srcdir@ $pkg/$file
+ done) > ${top_builddir}/lib/classes.1
+
+# The same, but for the external code.
+# Right now all external code is in org/.
+for dir in @top_srcdir@/external/w3c_dom \
+ @top_srcdir@/external/sax @top_srcdir@/external/relaxngDatatype; do
+ (cd $dir
+ @FIND@ org -follow -name '*.java' -print |
+ sort -r | sed -e 's,/\([^/]*\)$, \1,' |
+ while read pkg file; do
+ echo $pkg $dir $pkg/$file
+ done)
+done >> ${top_builddir}/lib/classes.1
# Generate files for the VM classes.
: > vm.omit
@@ -29,18 +47,22 @@ for dir in $vm_dirlist; do
if test -d $subdir; then
@FIND@ $subdir -name '*.java' -print
fi
- done) |
- while read f; do
- echo $dir/$f >> vm.add
- echo $f >> vm.omit
+ done) | sed -e 's,/\([^/]*\)$, \1,' |
+ while read pkg file; do
+ echo $pkg $dir $pkg/$file >> vm.add
+ echo $pkg/$file >> vm.omit
done
done
# Only include generated files once.
if test ! "${top_builddir}" -ef "@top_srcdir@"; then
echo "Adding generated files in builddir '${top_builddir}'."
- @FIND@ ${top_builddir}/gnu ${top_builddir}/java -follow -type f -print \
- | sort | grep '\.java$' >> ${top_builddir}/lib/classes.1
+ # Currently the only generated files are in gnu.*.
+ (cd ${top_builddir}; @FIND@ gnu -follow -name '*.java' -print) |
+ sort | sed -e 's,/\([^/]*\)$, \1,' |
+ while read pkg file; do
+ echo $pkg $top_builddir $pkg/$file
+ done >> ${top_builddir}/lib/classes.1
fi
@@ -51,9 +73,10 @@ for dir in $vm_dirlist; do
fi
done
+# FIXME: could be more efficient by constructing a series of greps.
for filexp in `cat tmp.omit`; do
- grep -v ${filexp} < ${top_builddir}/lib/classes.1 > ${top_builddir}/lib/classes.2
- mv ${top_builddir}/lib/classes.2 ${top_builddir}/lib/classes.1
+ grep -v ${filexp} < ${top_builddir}/lib/classes.1 > ${top_builddir}/lib/classes.tmp
+ mv ${top_builddir}/lib/classes.tmp ${top_builddir}/lib/classes.1
done
@@ -72,18 +95,20 @@ rm vm.add
rm tmp.omit
new=
-if test -e ${top_builddir}/lib/classes; then
- p=`diff ${top_builddir}/lib/classes ${top_builddir}/lib/classes.1`
+if test -e ${top_builddir}/lib/classes.2; then
+ p=`diff ${top_builddir}/lib/classes.2 ${top_builddir}/lib/classes.1`
if test "$p" != ""; then
new="true"
- cp ${top_builddir}/lib/classes.1 ${top_builddir}/lib/classes
fi
else
new="true"
- cp ${top_builddir}/lib/classes.1 ${top_builddir}/lib/classes
fi
if test "$new" = "true"; then
+ cp ${top_builddir}/lib/classes.1 ${top_builddir}/lib/classes.2
+ # Strip the package part.
+ sed -e 's/^[^ ]* //' -e 's, ,/,' < ${top_builddir}/lib/classes.1 \
+ > ${top_builddir}/lib/classes
echo "JAVA_SRCS = \\" > ${top_builddir}/lib/java.dep
for i in `cat ${top_builddir}/lib/classes` ; do
echo $i "\\" >> ${top_builddir}/lib/java.dep