summaryrefslogtreecommitdiff
path: root/packages/cacao
diff options
context:
space:
mode:
authorPhilip Balister <philip@balister.org>2007-08-08 23:08:32 +0000
committerPhilip Balister <philip@balister.org>2007-08-08 23:08:32 +0000
commit1c512d6f768199951cc7e0b97576761a0700776e (patch)
tree7d910c7325be8179b8a18692dbec25e7b8d52c78 /packages/cacao
parentd3187fcd902902b9a371f981e9a84016520271b2 (diff)
parent614090f5ecd4f17a53dfad97f4dfa1f335ed2256 (diff)
merge of '122762c7f94c2245c6d7d2b16bc8ae60ba8edab2'
and '36843ed17320bc85c468fd1b0c75b2458b55b8ac'
Diffstat (limited to 'packages/cacao')
-rw-r--r--packages/cacao/.mtn2git_empty0
-rw-r--r--packages/cacao/cacao-cldc_0.98.bb35
-rw-r--r--packages/cacao/cacao.inc15
-rw-r--r--packages/cacao/cacaoh-cldc-native_0.98.bb16
-rw-r--r--packages/cacao/files/.mtn2git_empty0
-rw-r--r--packages/cacao/files/arm_mmap.patch21
-rw-r--r--packages/cacao/files/classpath_var.patch66
-rw-r--r--packages/cacao/files/libmath.patch53
-rw-r--r--packages/cacao/files/midpath.patch372
-rw-r--r--packages/cacao/files/offset.h_arm.patch35
-rw-r--r--packages/cacao/files/offsets_make.patch25
11 files changed, 638 insertions, 0 deletions
diff --git a/packages/cacao/.mtn2git_empty b/packages/cacao/.mtn2git_empty
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/packages/cacao/.mtn2git_empty
diff --git a/packages/cacao/cacao-cldc_0.98.bb b/packages/cacao/cacao-cldc_0.98.bb
new file mode 100644
index 0000000000..f7797206de
--- /dev/null
+++ b/packages/cacao/cacao-cldc_0.98.bb
@@ -0,0 +1,35 @@
+
+require cacao.inc
+
+SRC_URI +="file://midpath.patch;patch=1 \
+ file://offsets_make.patch;patch=1 \
+ file://classpath_var.patch;patch=1 \
+ file://libmath.patch;patch=1 \
+ file://arm_mmap.patch;patch=1 \
+ "
+SRC_URI_append_arm = "file://offset.h_arm.patch;patch=1"
+
+DEPENDS = "cacaoh-cldc-native ecj-native classpath-minimal-native virtual/cldc-api-1.1 libtool zlib"
+RDEPENDS = "virtual/cldc-api-1.1"
+RPROVIDES = "virtual/java"
+
+EXTRA_OECONF += "--with-classpath-libdir=${STAGING_LIBDIR}/classpath-minimal \
+ --with-classpath-includedir=${STAGING_INCDIR}/classpath-minimal \
+ --enable-jni \
+ --enable-java=cldc1.1 \
+ --with-classpath=cldc1.1 \
+ --with-classpath-classes=${STAGING_LIBDIR}/java/cldc1.1.jar \
+ --with-target-classpath-classes=${libdir}/java/cldc1.1.jar \
+ --with-cacaoh=${STAGING_BINDIR_NATIVE}/cacaoh \
+ --disable-libjvm \
+ "
+
+PACKAGES = "${PN} ${PN}-doc ${PN}-dbg"
+
+FILES_${PN} = "${bindir}/cacao"
+FILES_${PN}-doc = "${datadir}/man"
+FILES_${PN}-dbg = "${bindir}/.debug ${libdir}/.debug/lib*.so*"
+
+ALTERNATIVE_NAME = "java"
+ALTERNATIVE_PATH = "${bindir}/cacao"
+ALTERNATIVE_PRIORITY = "10"
diff --git a/packages/cacao/cacao.inc b/packages/cacao/cacao.inc
new file mode 100644
index 0000000000..1f783b8238
--- /dev/null
+++ b/packages/cacao/cacao.inc
@@ -0,0 +1,15 @@
+DESCRIPTION = "cacao is a Java Virtual Machine, which uses GNU Classpath as default Java core library"
+HOMEPAGE = "http://www.cacaojvm.org/"
+LICENSE = "GPL"
+PRIORITY = "optional"
+SECTION = "interpreters"
+
+inherit autotools
+
+SRC_URI = "http://www.complang.tuwien.ac.at/cacaojvm/download/cacao-0.98/cacao-${PV}.tar.bz2;md5sum=8b8907c8b925761c9410bcadb9705346"
+
+S = "${WORKDIR}/cacao-${PV}"
+
+EXTRA_OECONF = "--disable-debug \
+ ${@['','--enable-softfloat'][bb.data.getVar('TARGET_FPU',d,1) == 'soft']} \
+ "
diff --git a/packages/cacao/cacaoh-cldc-native_0.98.bb b/packages/cacao/cacaoh-cldc-native_0.98.bb
new file mode 100644
index 0000000000..e24225a042
--- /dev/null
+++ b/packages/cacao/cacaoh-cldc-native_0.98.bb
@@ -0,0 +1,16 @@
+
+require cacao.inc
+
+DEPENDS = "ecj-native classpath-minimal-native virtual/cldc-api-1.1 libtool-native zlib-native"
+
+inherit native
+
+EXTRA_OECONF += "--with-classpath-includedir=${STAGING_INCDIR}/classpath-minimal \
+ --enable-jni \
+ --enable-java=cldc1.1 \
+ --with-classpath=cldc1.1 \
+ --with-classpath-classes=${STAGING_LIBDIR}/java/cldc1.1.jar \
+ "
+do_stage() {
+ install -m 0755 src/cacaoh/.libs/cacaoh ${STAGING_BINDIR}/
+}
diff --git a/packages/cacao/files/.mtn2git_empty b/packages/cacao/files/.mtn2git_empty
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/packages/cacao/files/.mtn2git_empty
diff --git a/packages/cacao/files/arm_mmap.patch b/packages/cacao/files/arm_mmap.patch
new file mode 100644
index 0000000000..e34c7b7802
--- /dev/null
+++ b/packages/cacao/files/arm_mmap.patch
@@ -0,0 +1,21 @@
+--- cacao-0.98/src/vm/exceptions.c 2007/06/27 09:04:17 8146
++++ cacao-0.98/src/vm/exceptions.c 2007/07/02 14:07:24 8175
+@@ -92,6 +92,10 @@
+
+ bool exceptions_init(void)
+ {
++#if !(defined(__ARM__) && defined(__LINUX__))
++ /* On arm-linux the first memory page can't be mmap'ed, as it
++ contains the exception vectors. */
++
+ int pagesize;
+
+ /* mmap a memory page at address 0x0, so our hardware-exceptions
+@@ -100,6 +104,7 @@
+ pagesize = getpagesize();
+
+ (void) memory_mmap_anon(NULL, pagesize, PROT_NONE, MAP_PRIVATE | MAP_FIXED);
++#endif
+
+ /* check if we get into trouble with our hardware-exceptions */
+
diff --git a/packages/cacao/files/classpath_var.patch b/packages/cacao/files/classpath_var.patch
new file mode 100644
index 0000000000..a2a69f9d1c
--- /dev/null
+++ b/packages/cacao/files/classpath_var.patch
@@ -0,0 +1,66 @@
+Index: cacao-0.98/configure.ac
+===================================================================
+--- cacao-0.98.orig/configure.ac 2007-06-06 11:24:23.000000000 +0200
++++ cacao-0.98/configure.ac 2007-07-18 23:26:43.000000000 +0200
+@@ -842,6 +842,7 @@
+ AC_CHECK_WITH_CLASSPATH
+ AC_CHECK_WITH_CLASSPATH_PREFIX
+ AC_CHECK_WITH_CLASSPATH_CLASSES
++AC_CHECK_WITH_TARGET_CLASSPATH_CLASSES
+ AC_CHECK_WITH_CLASSPATH_LIBDIR
+ AC_CHECK_WITH_CLASSPATH_INCLUDEDIR
+
+Index: cacao-0.98/src/vm/vm.c
+===================================================================
+--- cacao-0.98.orig/src/vm/vm.c 2007-06-05 09:44:38.000000000 +0200
++++ cacao-0.98/src/vm/vm.c 2007-07-18 23:26:43.000000000 +0200
+@@ -621,7 +621,7 @@
+ #if defined(WITH_CLASSPATH_GNU)
+ puts(" java.boot.class.path : "CACAO_VM_ZIP":"CLASSPATH_CLASSES"");
+ #else
+- puts(" java.boot.class.path : "CLASSPATH_CLASSES"");
++ puts(" java.boot.class.path : "TARGET_CLASSPATH_CLASSES"");
+ #endif
+ puts(" gnu.classpath.boot.library.path: "CLASSPATH_LIBDIR"/classpath\n");
+
+@@ -873,7 +873,7 @@
+ strlen(CACAO_VM_ZIP) +
+ strlen(":") +
+ # endif
+- strlen(CLASSPATH_CLASSES) +
++ strlen(TARGET_CLASSPATH_CLASSES) +
+ strlen("0");
+
+ _Jv_bootclasspath = MNEW(char, len);
+@@ -881,7 +881,7 @@
+ strcat(_Jv_bootclasspath, CACAO_VM_ZIP);
+ strcat(_Jv_bootclasspath, ":");
+ # endif
+- strcat(_Jv_bootclasspath, CLASSPATH_CLASSES);
++ strcat(_Jv_bootclasspath, TARGET_CLASSPATH_CLASSES);
+ #endif
+ }
+
+Index: cacao-0.98/m4/classpath.m4
+===================================================================
+--- cacao-0.98.orig/m4/classpath.m4 2007-04-23 22:06:07.000000000 +0200
++++ cacao-0.98/m4/classpath.m4 2007-07-18 23:38:06.000000000 +0200
+@@ -82,6 +82,18 @@
+ AC_SUBST(CLASSPATH_CLASSES)
+ ])
+
++dnl where are Java core library classes installed on the target
++
++AC_DEFUN([AC_CHECK_WITH_TARGET_CLASSPATH_CLASSES],[
++AC_MSG_CHECKING(where Java core library classes are installed on the target)
++AC_ARG_WITH([target-classpath-classes],
++ [AS_HELP_STRING(--with-target-classpath-classes=<path>,path to Java core library classes (includes the name of the file and may be flat) [[default=/usr/local/classpath/share/classpath/glibj.zip]])],
++ [TARGET_CLASSPATH_CLASSES=${withval}],
++ [TARGET_CLASSPATH_CLASSES=${CLASSPATH_PREFIX}/share/classpath/glibj.zip])
++AC_MSG_RESULT(${TARGET_CLASSPATH_CLASSES})
++AC_DEFINE_UNQUOTED([TARGET_CLASSPATH_CLASSES], "${TARGET_CLASSPATH_CLASSES}", [Java core library classes on the target])
++AC_SUBST(TARGET_CLASSPATH_CLASSES)
++])
+
+ dnl where are Java core library native libraries installed
+
diff --git a/packages/cacao/files/libmath.patch b/packages/cacao/files/libmath.patch
new file mode 100644
index 0000000000..f8a4e837e2
--- /dev/null
+++ b/packages/cacao/files/libmath.patch
@@ -0,0 +1,53 @@
+Index: cacao-0.98/configure.ac
+===================================================================
+--- cacao-0.98.orig/configure.ac 2007-07-21 12:11:47.000000000 +0200
++++ cacao-0.98/configure.ac 2007-07-21 13:36:40.000000000 +0200
+@@ -234,6 +234,48 @@
+ AC_EGREP_HEADER(u_int32_t, sys/types.h, AC_DEFINE(HAVE_BSD_INT32_DEFINED, 1, [Define to 1 if you have BSD u_int32_t]))
+ AC_EGREP_HEADER(u_int32_t, sys/config.h, AC_DEFINE(HAVE_BSD_INT32_DEFINED, 1, [Define to 1 if you have BSD u_int32_t]))
+
++dnl The idea of this solutions comes from bochs-project configure.in
++dnl
++dnl Add the -lm library if math functions cannot be used without it.
++dnl This check is important on cygwin because of the bizarre way that they
++dnl have organized functions into libraries. On cygwin, both libc.a and
++dnl libm.a are symbolic links to a single lib libcygwin.a. This means that
++dnl 1) linking with -lm is not necessary, and
++dnl 2) linking with -lm is dangerous if the order of libraries is wrong
++dnl In particular, if you compile any program with -mno-cygwin and link with
++dnl -lm, it will crash instantly when it is run. This happens because the
++dnl linker incorrectly links the Cygwin libm.a (==libcygwin.a), which replaces
++dnl the ___main function instead of allowing it to be defined by
++dnl /usr/lib/mingw/libmingw32.a as it should be.
++dnl
++dnl On MacOS X, this test will find that -lm is unnecessary and leave it out.
++dnl
++dnl With uClibc and without libjvm cacao needs to be linked with -lm because of
++dnl the function scalbn
++dnl
++dnl Just check this math functions. If it is found without
++dnl -lm, then we must not need -lm.
++have_scalbn=0
++AC_CHECK_FUNCS(scalbn, have_scalbn=1)
++AC_MSG_CHECKING(if math functions link without -lm)
++if test "$have_scalbn" = 1; then
++ AC_MSG_RESULT(yes)
++else
++ AC_MSG_RESULT(no)
++ LIBS="$LIBS -lm"
++ # use different functions to bypass configure caching
++ have_scalbl=0
++ AC_CHECK_FUNCS(scalbl, have_scalbl=1)
++ AC_MSG_CHECKING(if math functions link with -lm)
++ if test "$have_scalbl" = 1; then
++ AC_MSG_RESULT(yes)
++ else
++ AC_MSG_RESULT(no)
++ # not sure we should warn the user, crash, etc.
++ # expect link failure
++ fi
++fi
++
+ dnl Checks for typedefs, structures, and compiler characteristics.
+ AC_C_CONST
+ AC_C_INLINE
diff --git a/packages/cacao/files/midpath.patch b/packages/cacao/files/midpath.patch
new file mode 100644
index 0000000000..b905f774af
--- /dev/null
+++ b/packages/cacao/files/midpath.patch
@@ -0,0 +1,372 @@
+Index: cacao-0.98/src/native/vm/cldc1.1/com_sun_cldc_io_ResourceInputStream.c
+===================================================================
+--- cacao-0.98.orig/src/native/vm/cldc1.1/com_sun_cldc_io_ResourceInputStream.c 2007-05-16 10:06:15.000000000 +0200
++++ cacao-0.98/src/native/vm/cldc1.1/com_sun_cldc_io_ResourceInputStream.c 2007-07-22 00:15:55.000000000 +0200
+@@ -26,25 +26,53 @@
+
+ */
+
++#include <sys/stat.h>
++#include <stdlib.h>
+
+ #include "config.h"
+-#include "vm/types.h"
++
++#include "arch.h"
++#include "mm/memory.h"
+
+ #include "native/jni.h"
+ #include "native/native.h"
+
+ #include "native/include/java_lang_Object.h"
+ #include "native/include/java_lang_String.h"
+-
++#include "native/include/java_lang_Integer.h"
+ #include "native/include/com_sun_cldc_io_ResourceInputStream.h"
++#include "native/include/com_sun_cldchi_jvm_FileDescriptor.h"
+
++#include "vm/types.h"
++#include "vm/builtin.h"
+ #include "vm/vm.h" /* REMOVE ME: temporarily */
++#include "vm/exceptions.h"
++#include "vm/initialize.h"
++#include "vm/stringlocal.h"
++#include "vm/properties.h"
++
++#include "vmcore/class.h"
++#include "vmcore/classcache.h"
++#include "vmcore/linker.h"
++#include "vmcore/loader.h"
++#include "vmcore/options.h"
++#include "vmcore/statistics.h"
++#include "vmcore/suck.h"
++#include "vmcore/zip.h"
++
++#include "toolbox/list.h"
++#include "toolbox/logging.h"
++#include "toolbox/util.h"
+
+
+ /* native methods implemented by this file ************************************/
+
+ static JNINativeMethod methods[] = {
+ { "open", "(Ljava/lang/String;)Ljava/lang/Object;", (void *) (ptrint) &Java_com_sun_cldc_io_ResourceInputStream_open },
++ { "bytesRemain", "(Ljava/lang/Object;)I", (void *) (ptrint) &Java_com_sun_cldc_io_ResourceInputStream_bytesRemain },
++ { "readByte", "(Ljava/lang/Object;)I", (void *) (ptrint) &Java_com_sun_cldc_io_ResourceInputStream_readByte },
++ { "readBytes", "(Ljava/lang/Object;[BII)I", (void *) (ptrint) &Java_com_sun_cldc_io_ResourceInputStream_readBytes },
++ { "clone", "(Ljava/lang/Object;)Ljava/lang/Object;", (void *) (ptrint) &Java_com_sun_cldc_io_ResourceInputStream_clone },
+ };
+
+ /* _Jv_com_sun_cldc_io_ResourceInputStream_init ********************************
+@@ -68,13 +96,209 @@
+ * Method: open
+ * Signature: (Ljava/lang/String;)Ljava/lang/Object;
+ */
+-JNIEXPORT java_lang_Object* JNICALL Java_com_sun_cldc_io_ResourceInputStream_open(JNIEnv *env, jclass clazz, java_lang_String *name)
++JNIEXPORT struct java_lang_Object* JNICALL Java_com_sun_cldc_io_ResourceInputStream_open(JNIEnv *env, jclass clazz, java_lang_String *name)
+ {
+- vm_abort("Java_com_sun_cldc_io_ResourceInputStream_open: IMPLEMENT ME!");
++
++ list_classpath_entry *lce;
++ char *filename;
++ s4 filenamelen;
++ char *path;
++ FILE *classfile;
++ /*struct stat statBuffer;
++ int bufferSize = -1;*/
++ utf *uname;
++ /*java_lang_Integer *fhandler;*/
++ com_sun_cldchi_jvm_FileDescriptor *fileDescriptor;
++ classinfo *ci;
++
++
++ /* get the classname as char string (do it here for the warning at
++ the end of the function) */
++
++ uname = javastring_toutf((java_objectheader *)name, false);
++ filenamelen = utf_bytes(uname) + strlen("0");
++ filename = MNEW(char, filenamelen);
++ utf_copy(filename, uname);
++ classfile = NULL;
++
++
++ /* walk through all classpath entries */
++
++ for (lce = list_first(list_classpath_entries); lce != NULL;
++ lce = list_next(list_classpath_entries, lce)) {
++
++ path = MNEW(char, lce->pathlen + filenamelen);
++ strcpy(path, lce->path);
++ strcat(path, filename);
++
++ classfile = fopen(path, "r");
++
++ MFREE(path, char, lce->pathlen + filenamelen);
++
++ if (classfile) { /* file exists */
++ break;
++ }
++ }
++
++ MFREE(filename, char, filenamelen);
++
++ if (classfile) {
++ ci = load_class_bootstrap(utf_new_char("com/sun/cldchi/jvm/FileDescriptor"));
++ fileDescriptor = (com_sun_cldchi_jvm_FileDescriptor *) native_new_and_init(ci);
++ fileDescriptor->handle = (int) classfile;
++ fileDescriptor->valid = (int) 0;
++ return (java_lang_Object*) fileDescriptor;
++ } else {
++ return NULL;
++ }
++
++}
++
++
++/*
++ * Class: com_sun_cldc_io_ResourceInputStream
++ * Method: bytesRemain
++ * Signature: (Ljava/lang/Object;)I
++ */
++JNIEXPORT s4 JNICALL Java_com_sun_cldc_io_ResourceInputStream_bytesRemain(JNIEnv *env, jclass clazz, struct java_lang_Object* jobj) {
++
++ com_sun_cldchi_jvm_FileDescriptor *fileDescriptor;
++ struct stat statBuffer;
++ FILE *file;
++ int fd;
++ int position;
++ int hposition;
++
++ fileDescriptor = (com_sun_cldchi_jvm_FileDescriptor *) jobj;
++ file = (FILE *)fileDescriptor->handle;
++
++ /* Change access position if needed */
++ hposition = fileDescriptor->valid;
++ position = ftell(file);
++ if (position != hposition) {
++ fseek(file, hposition, SEEK_SET);
++ }
++
++ fd = fileno(file);
++ if (fstat(fd, &statBuffer) != -1) {
++ return (statBuffer.st_size - hposition);
++ } else {
++ /* TODO Throw an IOException */
++ return 0;
++ }
+
+- return NULL;
+ }
+
++/*
++ * Class: com_sun_cldc_io_ResourceInputStream
++ * Method: readByte
++ * Signature: (Ljava/lang/Object;)I
++ */
++JNIEXPORT s4 JNICALL Java_com_sun_cldc_io_ResourceInputStream_readByte(JNIEnv *env, jclass clazz, struct java_lang_Object* jobj) {
++
++ com_sun_cldchi_jvm_FileDescriptor *fileDescriptor;
++ int readBytes = -1;
++ char byte;
++ FILE * file;
++ int position;
++ int hposition;
++
++ fileDescriptor = (com_sun_cldchi_jvm_FileDescriptor *) jobj;
++ file = (FILE *)fileDescriptor->handle;
++
++ /* Change access position if needed */
++ hposition = fileDescriptor->valid;
++ position = ftell(file);
++ if (position != hposition) {
++ fseek(file, hposition, SEEK_SET);
++ }
++
++ readBytes = fread(&byte, 1, 1, file);
++
++ /* Check if EOF or an error occurred */
++ if (readBytes != 1) {
++ if (feof(file)) {
++ return -1;
++ } else if (ferror(file)) {
++ /* TODO: throw an IOException */
++ }
++ }
++
++ /* Update access position */
++ fileDescriptor->valid = ftell(file);
++
++ return (byte & 0xFF);
++
++}
++
++/*
++ * Class: com_sun_cldc_io_ResourceInputStream
++ * Method: readBytes
++ * Signature: (Ljava/lang/Object;[BII)I
++ */
++JNIEXPORT s4 JNICALL Java_com_sun_cldc_io_ResourceInputStream_readBytes(JNIEnv *env, jclass clazz, struct java_lang_Object* jobj, java_bytearray* byteArray, s4 off, s4 len) {
++
++ com_sun_cldchi_jvm_FileDescriptor *fileDescriptor;
++ int readBytes = -1;
++ FILE * file;
++ int position;
++ int hposition;
++ void *buf;
++
++ /* get pointer to the buffer */
++ buf = &(byteArray->data[off]);
++
++ fileDescriptor = (com_sun_cldchi_jvm_FileDescriptor *) jobj;
++ file = (FILE *)fileDescriptor->handle;
++
++ /* Change access position if needed */
++ hposition = fileDescriptor->valid;
++ position = ftell(file);
++ if (position != hposition) {
++ fseek(file, hposition, SEEK_SET);
++ }
++
++ readBytes = fread(buf, 1, len, file);
++
++ /* Check if EOF or an error occurred */
++ if (readBytes != len) {
++ if ((readBytes == 0) && feof(file)) {
++ return -1;
++ } else if (ferror(file)) {
++ /* TODO: throw an IOException */
++ }
++ }
++
++ /* Update access position */
++ fileDescriptor->valid = ftell(file);
++
++ return readBytes;
++}
++
++/*
++ * Class: com_sun_cldc_io_ResourceInputStream
++ * Method: clone
++ * Signature: (Ljava/lang/Object;)Ljava/lang/Object;
++ */
++JNIEXPORT struct java_lang_Object* JNICALL Java_com_sun_cldc_io_ResourceInputStream_clone(JNIEnv *env, jclass clazz, struct java_lang_Object* jobj) {
++
++ classinfo *ci;
++ com_sun_cldchi_jvm_FileDescriptor *srcFileDescriptor;
++ com_sun_cldchi_jvm_FileDescriptor *dstFileDescriptor;
++
++ srcFileDescriptor = (com_sun_cldchi_jvm_FileDescriptor *) jobj;
++
++ ci = load_class_bootstrap(utf_new_char("com/sun/cldchi/jvm/FileDescriptor"));
++ dstFileDescriptor = (com_sun_cldchi_jvm_FileDescriptor *) native_new_and_init(ci);
++ dstFileDescriptor->handle = srcFileDescriptor->handle;
++ dstFileDescriptor->valid = srcFileDescriptor->valid;
++
++ return (java_lang_Object*) dstFileDescriptor;
++
++}
++
++
++
+
+ /*
+ * These are local overrides for various environment variables in Emacs.
+Index: cacao-0.98/src/native/vm/cldc1.1/Makefile.am
+===================================================================
+--- cacao-0.98.orig/src/native/vm/cldc1.1/Makefile.am 2007-04-02 13:23:24.000000000 +0200
++++ cacao-0.98/src/native/vm/cldc1.1/Makefile.am 2007-07-22 00:15:55.000000000 +0200
+@@ -38,6 +38,7 @@
+ com_sun_cldc_io_j2me_socket_Protocol.c \
+ com_sun_cldchi_io_ConsoleOutputStream.c \
+ com_sun_cldchi_jvm_JVM.c \
++ com_sun_cldchi_jvm_FileDescriptor.c \
+ java_lang_Class.c \
+ java_lang_Double.c \
+ java_lang_Float.c \
+Index: cacao-0.98/src/native/include/Makefile.am
+===================================================================
+--- cacao-0.98.orig/src/native/include/Makefile.am 2007-05-23 20:15:07.000000000 +0200
++++ cacao-0.98/src/native/include/Makefile.am 2007-07-22 00:15:55.000000000 +0200
+@@ -74,6 +74,7 @@
+ com_sun_cldc_io_j2me_socket_Protocol.h \
+ com_sun_cldchi_io_ConsoleOutputStream.h \
+ com_sun_cldchi_jvm_JVM.h \
++ com_sun_cldchi_jvm_FileDescriptor.h \
+ java_lang_Math.h \
+ java_lang_Runtime.h \
+ java_lang_System.h
+Index: cacao-0.98/src/native/vm/cldc1.1/com_sun_cldchi_jvm_FileDescriptor.c
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ cacao-0.98/src/native/vm/cldc1.1/com_sun_cldchi_jvm_FileDescriptor.c 2007-07-22 00:18:01.000000000 +0200
+@@ -0,0 +1,70 @@
++/* src/native/vm/cldc1.1/com_sun_cldchi_jvm_FileDescriptor.c
++
++ Copyright (C) 2006, 2007 R. Grafl, A. Krall, C. Kruegel, C. Oates,
++ R. Obermaisser, M. Platter, M. Probst, S. Ring, E. Steiner,
++ C. Thalinger, D. Thuernbeck, P. Tomsich, C. Ullrich, J. Wenninger,
++ Institut f. Computersprachen - TU Wien
++
++ This file is part of CACAO.
++
++ This program is free software; you can redistribute it and/or
++ modify it under the terms of the GNU General Public License as
++ published by the Free Software Foundation; either version 2, or (at
++ your option) any later version.
++
++ This program is distributed in the hope that it will be useful, but
++ WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ General Public License for more details.
++
++ You should have received a copy of the GNU General Public License
++ along with this program; if not, write to the Free Software
++ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
++ 02110-1301, USA.
++
++ $Id: java_lang_VMRuntime.c 5900 2006-11-04 17:30:44Z michi $
++
++*/
++
++#include "config.h"
++
++#include <stdio.h>
++
++#include "vm/types.h"
++
++#include "native/jni.h"
++#include "native/native.h"
++
++#include "native/include/com_sun_cldchi_jvm_FileDescriptor.h"
++
++/* native methods implemented by this file ************************************/
++
++static JNINativeMethod methods[] = {
++ { "finalize", "()V", (void *) (ptrint) &Java_com_sun_cldchi_jvm_FileDescriptor_finalize },
++};
++
++/* _Jv_com_sun_cldchi_jvm_FileDescriptor_init ******************************
++
++ Register native functions.
++
++*******************************************************************************/
++
++void _Jv_com_sun_cldchi_jvm_FileDescriptor_init(void)
++{
++ utf *u;
++
++ u = utf_new_char("com/sun/cldchi/jvm/FileDescriptor");
++
++ native_method_register(u, methods, NATIVE_METHODS_COUNT);
++}
++
++/*
++ * Class: com/sun/cldchi/jvm/FileDescriptor
++ * Method: finalize
++ * Signature: ()V
++ */
++JNIEXPORT void JNICALL Java_com_sun_cldchi_jvm_FileDescriptor_finalize(JNIEnv *env, struct com_sun_cldchi_jvm_FileDescriptor* this) {
++ /* printf("close\n"); */
++ fclose((FILE *)this->handle);
++
++}
diff --git a/packages/cacao/files/offset.h_arm.patch b/packages/cacao/files/offset.h_arm.patch
new file mode 100644
index 0000000000..7011527540
--- /dev/null
+++ b/packages/cacao/files/offset.h_arm.patch
@@ -0,0 +1,35 @@
+Index: cacao-0.98/src/vm/jit/arm/offsets.h
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ cacao-0.98/src/vm/jit/arm/offsets.h 2007-07-17 23:35:56.000000000 +0200
+@@ -0,0 +1,30 @@
++/* This file is machine generated, don't edit it! */
++
++/* define some sizeof()'s */
++
++#define sizevmarg 16
++
++
++/* define some offsets */
++
++#define offobjvftbl 0
++
++
++/* vftbl_t */
++
++#define offbaseval 20
++#define offdiffval 24
++
++
++/* classinfo */
++
++#define offclassvftbl 124
++
++
++#define offvmargtype 0
++#define offvmargdata 8
++
++
++#define offcast_super_baseval 0
++#define offcast_super_diffval 4
++#define offcast_sub_baseval 8
diff --git a/packages/cacao/files/offsets_make.patch b/packages/cacao/files/offsets_make.patch
new file mode 100644
index 0000000000..d6f9dbef3a
--- /dev/null
+++ b/packages/cacao/files/offsets_make.patch
@@ -0,0 +1,25 @@
+Index: cacao-0.98/src/vm/jit/arm/Makefile.am
+===================================================================
+--- cacao-0.98.orig/src/vm/jit/arm/Makefile.am 2007-04-02 13:23:22.000000000 +0200
++++ cacao-0.98/src/vm/jit/arm/Makefile.am 2007-07-17 23:26:33.000000000 +0200
+@@ -40,10 +40,6 @@
+ AM_CPPFLAGS = -I$(top_srcdir)/src -I$(top_builddir) -I$(top_builddir)/src
+ AM_CCASFLAGS = $(AM_CPPFLAGS)
+
+-BUILT_SOURCES = offsets.h
+-
+-CLEANFILES = offsets.h
+-
+ noinst_HEADERS = \
+ arch.h \
+ machine-instr.h \
+@@ -72,9 +68,6 @@
+
+ $(srcdir)/asmpart.S: $(top_builddir)/config.h offsets.h
+
+-offsets.h: $(top_builddir)/src/vm/jit/tools/genoffsets $(top_builddir)/config.h
+- $(top_builddir)/src/vm/jit/tools/genoffsets > offsets.h
+-
+
+ ## Local variables:
+ ## mode: Makefile