--- camljava-0.3.orig/debian/changelog +++ camljava-0.3/debian/changelog @@ -0,0 +1,47 @@ +camljava (0.3-1build7) artful; urgency=high + + * No change rebuild against ocaml 4.04. + + -- Dimitri John Ledkov Tue, 27 Jun 2017 13:37:43 +0100 + +camljava (0.3-1build6) xenial; urgency=medium + + * No-change rebuild against ocaml 4.02. + + -- Ɓukasz 'sil2100' Zemczak Mon, 02 Nov 2015 16:55:52 -0600 + +camljava (0.3-1build5) trusty; urgency=medium + + * Rebuild for ocaml-4.01. + + -- Matthias Klose Mon, 23 Dec 2013 16:15:50 +0000 + +camljava (0.3-1build4) precise; urgency=low + + * Rebuild for OCaml 3.12.1. + + -- Colin Watson Sat, 19 Nov 2011 00:39:58 +0000 + +camljava (0.3-1build3) oneiric; urgency=low + + * Rebuild to pick up ocaml fixes on armel. + + -- Adam Conrad Wed, 24 Aug 2011 16:26:31 -0600 + +camljava (0.3-1build2) oneiric; urgency=low + + * Rebuild for OCaml 3.12.0. + + -- Colin Watson Mon, 16 May 2011 20:30:57 +0100 + +camljava (0.3-1build1) lucid; urgency=low + + * No-change rebuild for OCaml 3.11.2 transition (LP: #526073). + + -- Ilya Barygin Wed, 24 Feb 2010 21:06:12 +0300 + +camljava (0.3-1) unstable; urgency=low + + * Initial Release (Closes: #558090). + + -- Stefano Zacchiroli Tue, 01 Dec 2009 11:19:13 +0100 --- camljava-0.3.orig/debian/compat +++ camljava-0.3/debian/compat @@ -0,0 +1 @@ +7 --- camljava-0.3.orig/debian/control +++ camljava-0.3/debian/control @@ -0,0 +1,45 @@ +Source: camljava +Section: ocaml +Priority: optional +Maintainer: Ubuntu Developers +XSBC-Original-Maintainer: Debian OCaml Maintainers +Uploaders: Stefano Zacchiroli +Build-Depends: + debhelper (>= 7), + ocaml-nox, + default-jdk, + ocaml-findlib, + cdbs, + quilt, + dh-ocaml (>= 0.9) +Standards-Version: 3.8.3 +Vcs-Git: git://git.debian.org/git/pkg-ocaml-maint/packages/camljava.git +Vcs-Browser: http://git.debian.org/?p=pkg-ocaml-maint/packages/camljava.git +Homepage: http://pauillac.inria.fr/~xleroy/software.html#camljava + +Package: libcamljava-ocaml-dev +Architecture: any +Depends: + ${ocaml:Depends}, + default-jdk, + ${shlibs:Depends}, + ${misc:Depends} +Provides: ${ocaml:Provides} +Description: interface between OCaml and Java via Caml/C interface and JNI + CamlJava is an interface between OCaml and Java allowing programs written in + one of the two languages to call code written in the other. + . + Interaction among the two languages happen via the respective C interfaces: + Caml/C interface for OCaml and JNI (Java Native Interface) for Java. + . + Currently, CamlJava provides a low-level, weakly-typed OCaml interface very + similar to the JNI. Java object references are mapped to an abstract type, and + various JNI-like operations are provided to allow Java method invocation, + field access, and more. + . + A basic callback facility (allowing Java code to invoke methods on OCaml + objects) is also provided, although some stub Java code must be written by + hand. + . + This package contain all the development stuff needed to use CamlJava from + OCaml programs. --- camljava-0.3.orig/debian/copyright +++ camljava-0.3/debian/copyright @@ -0,0 +1,19 @@ +Format-Specification: http://svn.debian.org/wsvn/dep/web/deps/dep5.mdwn?op-file&rev=59 +Name: camljava +Maintainer: Xavier Leroy +Source: http://pauillac.inria.fr/~xleroy/software.html#camljava + +Files: * +Copyright: 2001, Institut National de Recherche en Informatique et en Automatique +License: LGPL-2 + CamlJava is distributed under the terms of the GNU Library General Public + License, version 2. + + On Debian systems the full text of the license can be found at + /usr/share/common-licenses/LGPL-2 . + +Files: debian/* +Copyright: 2009, Stefano Zacchiroli +License: LGPL-2 + The Debian packaging is distributed under the same terms than CamlJava itself, + whereas is copyright by the package maintainer. --- camljava-0.3.orig/debian/gbp.conf +++ camljava-0.3/debian/gbp.conf @@ -0,0 +1,2 @@ +[DEFAULT] +pristine-tar = True --- camljava-0.3.orig/debian/libcamljava-ocaml-dev.ocamldoc +++ camljava-0.3/debian/libcamljava-ocaml-dev.ocamldoc @@ -0,0 +1 @@ +# generate documentation with dh_ocamldoc --- camljava-0.3.orig/debian/patches/0001-ldflags-for-recent-JDK.patch +++ camljava-0.3/debian/patches/0001-ldflags-for-recent-JDK.patch @@ -0,0 +1,44 @@ +From: Stefano Zacchiroli +Date: Thu, 26 Nov 2009 13:55:49 +0100 +Subject: [PATCH] ldflags for recent JDK + +--- + Makefile.config | 17 ++++++++++++----- + 1 files changed, 12 insertions(+), 5 deletions(-) + +diff --git a/Makefile.config b/Makefile.config +index 5cd82d8..133cd2d 100644 +--- a/Makefile.config ++++ b/Makefile.config +@@ -17,7 +17,13 @@ JAVAC=javac -g + ## For other platforms, adjust as required and tell us about it. + + # Home location for the JDK. Only used for setting other variables below. +-JDKHOME=/usr/local/java_1.4.2 ++JDKHOME=/usr/lib/jvm/java-6-sun ++ ++# Current architecture identification string, as intended by the JDK. ++# Common values for x86 architectures are "i386" or "amd64". You can find it ++# out by looking for the "*" patch component in the following pattern: ++# $(JDKHOME)/jre/lib/*/libjava.so ++ARCH=amd64 + + # Where to find the JNI include files (for compiling the OCaml-JNI C stubs) + JNIINCLUDES=-I$(JDKHOME)/include -I$(JDKHOME)/include/linux +@@ -26,10 +32,11 @@ JNIINCLUDES=-I$(JDKHOME)/include -I$(JDKHOME)/include/linux + JNILIBS=-ljava + + # Additional link-time options to pass to $(CC) when linking with $(JNILIBS) +-JNILIBOPTS=-L$(JDKHOME)/jre/lib/i386/ \ +- -Wl,-rpath,$(JDKHOME)/jre/lib/i386/ \ +- -Wl,-rpath,$(JDKHOME)/jre/lib/i386/client \ +- -Wl,-rpath,$(JDKHOME)/jre/lib/i386/native_threads ++JNILIBOPTS=-L$(JDKHOME)/jre/lib/$(ARCH)/ \ ++ -L$(JDKHOME)/jre/lib/$(ARCH)/server \ ++ -Wl,-rpath,$(JDKHOME)/jre/lib/$(ARCH)/ \ ++ -Wl,-rpath,$(JDKHOME)/jre/lib/$(ARCH)/server \ ++ -Wl,-rpath,$(JDKHOME)/jre/lib/$(ARCH)/native_threads + + # Additional options when compiling the OCaml-JNI C stubs. + # -DJDK122_LINUX_HACK works around a nasty thread-related bug of +-- --- camljava-0.3.orig/debian/patches/0002-Makefile-misc-fixes.patch +++ camljava-0.3/debian/patches/0002-Makefile-misc-fixes.patch @@ -0,0 +1,69 @@ +From: Stefano Zacchiroli +Date: Thu, 26 Nov 2009 14:01:59 +0100 +Subject: [PATCH] Makefile misc fixes + +- ensure files created during build are removed upon clean +- split byte/opt targets to ease build and install on non-native archs +--- + Makefile | 2 ++ + lib/Makefile | 5 +++-- + test/Makefile | 3 ++- + 3 files changed, 7 insertions(+), 3 deletions(-) + +diff --git a/Makefile b/Makefile +index be1060f..6dc07b8 100644 +--- a/Makefile ++++ b/Makefile +@@ -1,5 +1,7 @@ + all: + cd lib; $(MAKE) all ++byte: ++ cd lib; $(MAKE) byte + + install: + cd lib; $(MAKE) install +diff --git a/lib/Makefile b/lib/Makefile +index bf56bcc..9f63867 100644 +--- a/lib/Makefile ++++ b/lib/Makefile +@@ -7,10 +7,11 @@ OCAMLLIB=`ocamlc -where` + CAMLJAVALIB=$(OCAMLLIB)/camljava + + all: jni.cma jni.cmxa javaclasses ++byte: jni.cma javaclasses + + install: + mkdir -p $(CAMLJAVALIB) +- cp jni.cma jni.cmi jni.cmxa jni.a libcamljni.a jni.mli $(CAMLJAVALIB) ++ cp jni.cma jni.cmi $(wildcard jni.cmxa jni.a) libcamljni.a jni.mli $(CAMLJAVALIB) + jar cf $(CAMLJAVALIB)/camljava.jar fr/inria/caml/camljava/*.class + + jni.cma: jni.cmo libcamljni.a +@@ -46,7 +47,7 @@ clean:: + rm -f fr/inria/caml/camljava/*.class + + clean:: +- rm -f *.cm? *.[oa] ++ rm -f *.cm? *.[oa] *.cmxa + + .SUFFIXES: .ml .mli .cmo .cmi .cmx + +diff --git a/test/Makefile b/test/Makefile +index 78eca4c..2e1be64 100644 +--- a/test/Makefile ++++ b/test/Makefile +@@ -3,7 +3,7 @@ include ../Makefile.config + CAMLJAVA=`ocamlc -where`/camljava/camljava.jar + + all: jnitest Test.class Testcb.class +- ./jnitest ++ CLASSPATH=. ./jnitest + + jnitest: jnitest.ml + ocamlc -ccopt -g -o jnitest -I +camljava jni.cma jnitest.ml +@@ -18,3 +18,4 @@ clean:: + + clean:: + rm -f *.cm? ++ rm -f *.class +-- --- camljava-0.3.orig/debian/patches/0003-GC-global-reference-fix-for-JDK-1.6.patch +++ camljava-0.3/debian/patches/0003-GC-global-reference-fix-for-JDK-1.6.patch @@ -0,0 +1,27 @@ +From: Gregoire Henry +Date: Thu, 26 Nov 2009 14:15:43 +0100 +Subject: [PATCH] GC global reference fix for JDK 1.6 + +Starting from JDK 1.6, local references might be cleaned up by the Garbage +Collector at the end of native methods. Since classes representing OCaml types +are long lived for CamlJava, they can't be local references otherwise they will +be collected. + +This fix turns references to OCaml type classes into global references. +--- + lib/jnistubs.c | 1 + + 1 files changed, 1 insertions(+), 0 deletions(-) + +diff --git a/lib/jnistubs.c b/lib/jnistubs.c +index 368c03e..5d6b92e 100644 +--- a/lib/jnistubs.c ++++ b/lib/jnistubs.c +@@ -735,6 +735,7 @@ static int init_caml_classes(JNIEnv * env) + { + #define INIT_CAML_CLASS(cls,fld,cname,fsig) \ + cls = (*env)->FindClass(env, cname); \ ++ cls = (*env)->NewGlobalRef(env, cls); \ + if (cls == NULL) return -1; \ + fld = (*env)->GetFieldID(env, cls, "contents", fsig); \ + if (fld == NULL) return -1; +-- --- camljava-0.3.orig/debian/patches/0004-enforce-callback-invocation-from-main-thread.patch +++ camljava-0.3/debian/patches/0004-enforce-callback-invocation-from-main-thread.patch @@ -0,0 +1,58 @@ +From: Gregoire Henry +Date: Thu, 26 Nov 2009 18:00:50 +0100 +Subject: [PATCH] enforce callback invocation from main thread + +ensure that all callbacks are executed from the main thread +(patch from O'Jacare) +--- + lib/jnistubs.c | 22 ++++++++++++++++++++++ + 1 files changed, 22 insertions(+), 0 deletions(-) + +diff --git a/lib/jnistubs.c b/lib/jnistubs.c +index 5d6b92e..e1659f8 100644 +--- a/lib/jnistubs.c ++++ b/lib/jnistubs.c +@@ -14,6 +14,24 @@ static JNIEnv * jenv; + #define Val_jboolean(b) ((b) == JNI_FALSE ? Val_false : Val_true) + #define Jboolean_val(v) (Val_bool(v) ? JNI_TRUE : JNI_FALSE) + ++/********** Threading *************/ ++ ++static JNIEnv * g_jenv; ++ ++void init_threading() { ++ g_jenv = jenv; ++} ++ ++void camljava_check_main_thread() { ++ if(jenv != g_jenv) { ++ fprintf(stderr, "CamlJava: callbacks from threads other than main are not allowed: ABORT.\n"); ++ fflush(stderr); ++ // raise a Java exception would be better ++ exit(2); ++ } ++ return; ++} ++ + /************ Wrapping of Java objects as Caml values *************/ + + #define JObject(v) (*((jobject *) Data_custom_val(v))) +@@ -680,6 +698,7 @@ value camljava_Init(value vclasspath) + retcode = JNI_CreateJavaVM(&jvm, (void **) &jenv, &vm_args); + stat_free(classpath); + if (retcode < 0) failwith("Java.init"); ++ init_threading(); // by O'Jacare + return Val_unit; + } + +@@ -781,6 +800,9 @@ static value camljava_callback(JNIEnv * env, + + savedenv = jenv; + jenv = env; ++ ++ camljava_check_main_thread(); // by O'Jacare ++ + if (!caml_classes_initialized) { + if (init_caml_classes(env) == -1) return -1; + caml_classes_initialized = 1; +-- --- camljava-0.3.orig/debian/patches/0005-debugging-facility-for-Java-exceptions.patch +++ camljava-0.3/debian/patches/0005-debugging-facility-for-Java-exceptions.patch @@ -0,0 +1,71 @@ +From: Gregoire Henry +Date: Sat, 28 Nov 2009 10:15:23 +0100 +Subject: [PATCH] debugging facility for Java exceptions + +debugging is togglable at runtime, without needing to recompile CamlJava +--- + lib/jni.mli | 2 ++ + lib/jni.mlp | 2 ++ + lib/jnistubs.c | 15 +++++++++++---- + 3 files changed, 15 insertions(+), 4 deletions(-) + +diff --git a/lib/jni.mli b/lib/jni.mli +index 2a593f0..ad829b3 100644 +--- a/lib/jni.mli ++++ b/lib/jni.mli +@@ -14,6 +14,8 @@ + + (* Low-level Java interface (JNI level) *) + ++external set_debug: bool -> unit = "camljava_set_debug" ++ + (* Object operations *) + + type obj +diff --git a/lib/jni.mlp b/lib/jni.mlp +index 9005e65..d1febac 100644 +--- a/lib/jni.mlp ++++ b/lib/jni.mlp +@@ -14,6 +14,8 @@ + + (* Low-level Java interface (JNI level) *) + ++external set_debug: bool -> unit = "camljava_set_debug" ++ + external init: string -> unit = "camljava_Init" + external shutdown: unit -> unit = "camljava_Shutdown" + +diff --git a/lib/jnistubs.c b/lib/jnistubs.c +index e1659f8..27ff365 100644 +--- a/lib/jnistubs.c ++++ b/lib/jnistubs.c +@@ -74,6 +74,13 @@ value camljava_IsNull(value vobj) + + /*********** Reflecting Java exceptions as Caml exceptions *************/ + ++static int debug = 0; ++ ++value camljava_set_debug(value v) { ++ debug = Bool_val(v); ++ return Val_unit; ++} ++ + static void check_java_exception(void) + { + jthrowable exn; +@@ -82,10 +89,10 @@ static void check_java_exception(void) + + exn = (*jenv)->ExceptionOccurred(jenv); + if (exn != NULL) { +-#if 0 +- /* For debugging */ +- (*jenv)->ExceptionDescribe(jenv); +-#endif ++ if(debug) { ++ /* For debugging */ ++ (*jenv)->ExceptionDescribe(jenv); ++ } + (*jenv)->ExceptionClear(jenv); + /* TODO: check Caml exception embedded into Java exception */ + if (camljava_raise_exception == NULL) { +-- --- camljava-0.3.orig/debian/patches/0006-ability-to-inhibit-automatic-string-convertion.patch +++ camljava-0.3/debian/patches/0006-ability-to-inhibit-automatic-string-convertion.patch @@ -0,0 +1,73 @@ +From: Stefano Zacchiroli +Date: Sat, 28 Nov 2009 10:38:01 +0100 +Subject: [PATCH] ability to inhibit automatic string convertion + +Rationale: automatic convertion of Java string to OCaml string is not always +desirable (e.g. because Java strings are real Unicode string whereas OCaml's +are not). Using this patch automatic conversion can be globally disabled by +CamlJava users. + +This ability is used by O'Jacare. +--- + lib/jni.mli | 2 ++ + lib/jni.mlp | 2 ++ + lib/jnistubs.c | 12 +++++++++++- + 3 files changed, 15 insertions(+), 1 deletions(-) + +diff --git a/lib/jni.mli b/lib/jni.mli +index ad829b3..db71589 100644 +--- a/lib/jni.mli ++++ b/lib/jni.mli +@@ -16,6 +16,8 @@ + + external set_debug: bool -> unit = "camljava_set_debug" + ++external set_string_auto_conv: bool -> unit = "camljava_set_strconv" ++ + (* Object operations *) + + type obj +diff --git a/lib/jni.mlp b/lib/jni.mlp +index d1febac..108f97d 100644 +--- a/lib/jni.mlp ++++ b/lib/jni.mlp +@@ -16,6 +16,8 @@ + + external set_debug: bool -> unit = "camljava_set_debug" + ++external set_string_auto_conv: bool -> unit = "camljava_set_strconv" ++ + external init: string -> unit = "camljava_Init" + external shutdown: unit -> unit = "camljava_Shutdown" + +diff --git a/lib/jnistubs.c b/lib/jnistubs.c +index 27ff365..bfc6c9d 100644 +--- a/lib/jnistubs.c ++++ b/lib/jnistubs.c +@@ -523,6 +523,15 @@ value camljava_MakeJavaString (value vstr) + return alloc_jobject(jstr); + } + ++/* Automatically convert Java string to Caml string? ++ True by default; globally set to false by O'Jacare. */ ++static int string_auto_conv = 1; ++ ++value camljava_set_strconv(value v) { ++ string_auto_conv = Bool_val(v); ++ return Val_unit; ++} ++ + static value extract_java_string (JNIEnv * env, jstring jstr) + { + jsize len; +@@ -852,7 +861,8 @@ static value camljava_callback(JNIEnv * env, + else if ((*env)->IsInstanceOf(env, arg, caml_double)) + carg = copy_double((*env)->GetDoubleField(env, arg, + caml_double_contents)); +- else if ((*env)->IsInstanceOf(env, arg, java_lang_string)) ++ else if (string_auto_conv ++ && (*env)->IsInstanceOf(env, arg, java_lang_string)) + carg = extract_java_string(env, (jstring) arg); + else + carg = alloc_jobject(arg); +-- --- camljava-0.3.orig/debian/patches/series +++ camljava-0.3/debian/patches/series @@ -0,0 +1,6 @@ +0001-ldflags-for-recent-JDK.patch +0002-Makefile-misc-fixes.patch +0003-GC-global-reference-fix-for-JDK-1.6.patch +0004-enforce-callback-invocation-from-main-thread.patch +0005-debugging-facility-for-Java-exceptions.patch +0006-ability-to-inhibit-automatic-string-convertion.patch --- camljava-0.3.orig/debian/rules +++ camljava-0.3/debian/rules @@ -0,0 +1,25 @@ +#!/usr/bin/make -f +include /usr/share/cdbs/1/rules/patchsys-quilt.mk +include /usr/share/cdbs/1/rules/debhelper.mk +include /usr/share/cdbs/1/class/makefile.mk +include /usr/share/cdbs/1/rules/ocaml.mk + +PKGNAME = libcamljava-ocaml-dev +DESTDIR := $(CURDIR)/debian/$(PKGNAME)/$(OCAML_STDLIB_DIR)/camljava + +DEFJAVA_DIR = /usr/lib/jvm/default-java + +# /usr/lib/jvm/default-java/jre/lib/amd64/server/libjvm.so -> amd64 +# XXX horrible way to retrieve Java arch, but unfortunately there is no +# reliable mapping available yet (see #558109) +JAVA_ARCH := $(shell find $(DEFJAVA_DIR)/ -path '*jre/lib/*/server/libjvm.so' | cut -f 8 -d /) + +BUILD_TARGET_FLAGS = JDKHOME=$(DEFJAVA_DIR) +BUILD_TARGET_FLAGS += ARCH=$(JAVA_ARCH) +DEB_MAKE_INSTALL_TARGET = install CAMLJAVALIB=$(DESTDIR) +ifeq ($(OCAML_HAVE_OCAMLOPT),yes) +DEB_MAKE_BUILD_TARGET = all $(BUILD_TARGET_FLAGS) +else +DEB_MAKE_BUILD_TARGET = byte $(BUILD_TARGET_FLAGS) +endif + --- camljava-0.3.orig/debian/watch +++ camljava-0.3/debian/watch @@ -0,0 +1,2 @@ +version=3 +http://caml.inria.fr/distrib/bazar-ocaml/camljava-(.*)\.tar\.gz