Subject: Re: SableVM & Cygwin (was: Re: sablevm + windows)
From: "Gerrit P. Haase" <[email-masked]>
To: "Grzegorz B. Prokopski" <[email-masked]>, SableVM-devel ML <[email-masked]>, Peter Lovell <[email-masked]>, [email-masked]
Date: Sat, 16 Oct 2004 10:09:40 +0200

Grzegorz B. Prokopski wrote:

>>Ready compiled SableVM binary and source package:
>>http://anfaenger.de/cygwin/cygwin-1.5/sablevm/
>>
>>The source package includes also the patch and uses a statically libffi,
>>so it doesn't need a FFI DLL.  Could you verify that this SableVM works
>>as expected, please?
> 
> 
> *2*MB diff that puts libffi in SableVM? Ouch!
> 
> .............
> 
> I took a quick look at the non-libffi part of your patche.  In general
> our approach is to integrate all reasonable changes required
> by ports, so that SableVM worked on them out-of-the-box.  (2MB patch
> hardly qualifies as reasonable, at least at the first sight)

Hey, all changes I really needed to make are reasonable.  The huge size 
is because I regenerated configure and Makkefile.in and so on, at least 
1000kb alone is configure, I include always the full changes after 
running autoreconf --ionstall --force --verbose

> Would it be possible to separate the changes you really had to do to
> SableVM (and SableVM Classpath - on which changes I haven't looked yet)
> from the rest, so that we could see clearly what the changes were?

Yes, I'll try to figure out how to do s.th. weird like this, not
counting the libffi stuff, the only relevant change for needed SableVM
is a 1k patch.  SableVM-Classpath is a little larger, timezone needs a 
cast and the -no-undefined LDFLAGS for the native libraries are missing.

I have the *full* minimal patches attached, including the Makefile.am
and configure.ac changes for libffi integration, but without the libffi
subdirectory.

However, the patches are against 1.1.6 and may not apply against the 
latest snapshots.

> Such cleaned-up diffs would really be very helpful.  Given the amount
> of great work you put in porting SableVM to Cygwin - why not have an
> out-of-the box support for Cygwin in the official SableVM?  This is
> somethings that surely "belongs" to SableVM proper.

No, I did nothing, all the work was done by Peter.  The documents
available and the communication.  I have the libffi sources handy.
The only changes I made were to add some lines in configure.in,
Makefile.am and some lines in the source, so libffi sourcetree could be
a subdirectory of sablevm and everything compiles, and I removed all
from libffi Makefile.in & configure.in so it was possible to run 
autoreconf on the whole tree.

Gerrit
-- 
=^..^=
diff -urN -x .build -x .inst -x .sinst -x configure -x aclocal.m4 -x Makefile.in -x libffi-2.00-beta -x INSTALL -x INSTALL.sablevm -x ltmain.sh sablevm-1.1.6-orig/Makefile.am sablevm-1.1.6/Makefile.am
--- sablevm-1.1.6-orig/Makefile.am	2004-07-10 18:28:18.000000000 +0200
+++ sablevm-1.1.6/Makefile.am	2004-10-16 09:40:56.159988800 +0200
@@ -6,8 +6,10 @@
 ## * modification of this source file.                               *
 ## * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 
-SUBDIRS = doc src
+AUTOMAKE_OPTIONS = foreign
 
+SUBDIRS = libffi-2.00-beta doc src
+INCLUDES = -I$(top_srcdir)/libffi-2.00-beta -I$(top_srcdir)/libffi-2.00-beta/include
 pkgdata_DATA = LICENSE AUTHORS LGPL-2.1
 
 EXTRA_DIST = .indent.pro LICENSE java-sablevm.tmpl ChangeLog INSTALL-DEVEL LGPL-2.1
diff -urN -x .build -x .inst -x .sinst -x configure -x aclocal.m4 -x Makefile.in -x libffi-2.00-beta -x INSTALL -x INSTALL.sablevm -x ltmain.sh sablevm-1.1.6-orig/configure.ac sablevm-1.1.6/configure.ac
--- sablevm-1.1.6-orig/configure.ac	2004-07-10 18:28:18.000000000 +0200
+++ sablevm-1.1.6/configure.ac	2004-10-11 16:57:25.000000000 +0200
@@ -201,7 +201,16 @@
 
 dnl Checks for libraries.
 LIBSVMINCLUDE="-lm -lffi -lltdl"
-AC_CHECK_LIB(ffi,ffi_prep_cif,echo -n,echo ***ERROR: libffi is missing; exit 1)
+case $host in
+	*cygwin*)
+	    dnl we need to use libffi_convenience
+		AC_CONFIG_SUBDIRS(libffi-2.00-beta)
+		AM_CONDITIONAL(CYGWIN, test xcygwin = xcygwin)
+	    ;;
+	*)
+		AC_CHECK_LIB(ffi,ffi_prep_cif,echo -n,echo ***ERROR: libffi is missing; exit 1)
+        ;;
+esac
 AC_CHECK_LIB(ltdl,lt_dlinit,echo -n,echo ***ERROR: libltdl is missing; exit 1)
 AC_CHECK_LIB(m,fmod,echo -n,echo ***ERROR: libm is missing; exit 1)
 AC_CHECK_LIB(popt,poptGetContext,echo -n,echo ***ERROR: libpopt is missing; exit 1)
diff -urN -x .build -x .inst -x .sinst -x configure -x aclocal.m4 -x Makefile.in -x libffi-2.00-beta -x INSTALL -x INSTALL.sablevm -x ltmain.sh sablevm-1.1.6-orig/doc/Makefile.am sablevm-1.1.6/doc/Makefile.am
--- sablevm-1.1.6-orig/doc/Makefile.am	2004-07-10 18:28:18.000000000 +0200
+++ sablevm-1.1.6/doc/Makefile.am	2004-10-08 15:32:30.000000000 +0200
@@ -6,6 +6,8 @@
 ## * modification of this source file.                               *
 ## * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 
+AUTOMAKE_OPTIONS = foreign
+
 man_MANS = sablevm.1 java-sablevm.1
 
 EXTRA_DIST = \
diff -urN -x .build -x .inst -x .sinst -x configure -x aclocal.m4 -x Makefile.in -x libffi-2.00-beta -x INSTALL -x INSTALL.sablevm -x ltmain.sh sablevm-1.1.6-orig/src/Makefile.am sablevm-1.1.6/src/Makefile.am
--- sablevm-1.1.6-orig/src/Makefile.am	2004-07-10 18:28:18.000000000 +0200
+++ sablevm-1.1.6/src/Makefile.am	2004-10-12 12:35:08.000000000 +0200
@@ -6,4 +6,7 @@
 ## * modification of this source file.                               *
 ## * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 
+AUTOMAKE_OPTIONS = foreign
+
 SUBDIRS = include libsablevm sablevm
+INCLUDES = -I$(top_srcdir)/libffi-2.00-beta -I$(top_srcdir)/libffi-2.00-beta/include
diff -urN -x .build -x .inst -x .sinst -x configure -x aclocal.m4 -x Makefile.in -x libffi-2.00-beta -x INSTALL -x INSTALL.sablevm -x ltmain.sh sablevm-1.1.6-orig/src/include/Makefile.am sablevm-1.1.6/src/include/Makefile.am
--- sablevm-1.1.6-orig/src/include/Makefile.am	2004-07-10 18:28:18.000000000 +0200
+++ sablevm-1.1.6/src/include/Makefile.am	2004-10-08 15:32:39.000000000 +0200
@@ -5,3 +5,5 @@
 ## * the terms and conditions for copying, distribution and          *
 ## * modification of this source file.                               *
 ## * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+
+AUTOMAKE_OPTIONS = foreign
diff -urN -x .build -x .inst -x .sinst -x configure -x aclocal.m4 -x Makefile.in -x libffi-2.00-beta -x INSTALL -x INSTALL.sablevm -x ltmain.sh sablevm-1.1.6-orig/src/libsablevm/Makefile.am sablevm-1.1.6/src/libsablevm/Makefile.am
--- sablevm-1.1.6-orig/src/libsablevm/Makefile.am	2004-07-10 18:28:18.000000000 +0200
+++ sablevm-1.1.6/src/libsablevm/Makefile.am	2004-10-12 13:40:01.000000000 +0200
@@ -6,6 +6,8 @@
 ## * modification of this source file.                               *
 ## * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 
+AUTOMAKE_OPTIONS = foreign
+
 ## GNU m4 & grep
 M4 = @M4@
 GREP = grep
@@ -350,11 +352,14 @@
 	rm -f vm_args.c
 	rm -f internal_methods.list
 
+if CYGWIN
+libsablevm_la_LIBADD = ../../libffi-2.00-beta/libffi_convenience.la @LIBSVMINCLUDE@
+else
 libsablevm_la_LIBADD = @LIBSVMINCLUDE@
-
+endif
 libsablevm_la_LDFLAGS = -release @LIBRELEASE@ @NO_UNDEFINED@
 
-INCLUDES = \
+INCLUDES = -I$(top_srcdir)/libffi-2.00-beta -I$(top_srcdir)/libffi-2.00-beta/include \
 	-I$(srcdir)/include -I$(srcdir)/inlinability -Iinlinability \
 	-DBOOT_CLASS_PATH=\"$(pkgdatadir)/sablevm-classpath\" \
 	-DBOOT_LIBRARY_PATH=\"$(pkglibdir)/sablevm-classpath\"
diff -urN -x .build -x .inst -x .sinst -x configure -x aclocal.m4 -x Makefile.in -x libffi-2.00-beta -x INSTALL -x INSTALL.sablevm -x ltmain.sh sablevm-1.1.6-orig/src/libsablevm/include/Makefile.am sablevm-1.1.6/src/libsablevm/include/Makefile.am
--- sablevm-1.1.6-orig/src/libsablevm/include/Makefile.am	2004-07-10 18:28:17.000000000 +0200
+++ sablevm-1.1.6/src/libsablevm/include/Makefile.am	2004-10-08 15:32:50.000000000 +0200
@@ -6,4 +6,6 @@
 ## * modification of this source file.                               *
 ## * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 
+AUTOMAKE_OPTIONS = foreign
+
 include_HEADERS = jni.h jni_system_specific.h
diff -urN -x .build -x .inst -x .sinst -x configure -x aclocal.m4 -x Makefile.in -x libffi-2.00-beta -x INSTALL -x INSTALL.sablevm -x ltmain.sh sablevm-1.1.6-orig/src/libsablevm/inlinability/Makefile.am sablevm-1.1.6/src/libsablevm/inlinability/Makefile.am
--- sablevm-1.1.6-orig/src/libsablevm/inlinability/Makefile.am	2004-07-10 18:28:17.000000000 +0200
+++ sablevm-1.1.6/src/libsablevm/inlinability/Makefile.am	2004-10-08 15:32:55.000000000 +0200
@@ -7,3 +7,5 @@
 ## * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 
 # the functionality has been moved to the parent directory
+
+AUTOMAKE_OPTIONS = foreign
diff -urN -x .build -x .inst -x .sinst -x configure -x aclocal.m4 -x Makefile.in -x libffi-2.00-beta -x INSTALL -x INSTALL.sablevm -x ltmain.sh sablevm-1.1.6-orig/src/sablevm/Makefile.am sablevm-1.1.6/src/sablevm/Makefile.am
--- sablevm-1.1.6-orig/src/sablevm/Makefile.am	2004-07-10 18:28:18.000000000 +0200
+++ sablevm-1.1.6/src/sablevm/Makefile.am	2004-10-12 12:36:39.000000000 +0200
@@ -6,6 +6,8 @@
 ## * modification of this source file.                               *
 ## * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 
+AUTOMAKE_OPTIONS = foreign
+
 bin_PROGRAMS = sablevm
 
 sablevm_LDADD = ../libsablevm/libsablevm.la -lpopt
@@ -16,7 +18,7 @@
 SVMCOMPILETIME = \
 	$(shell date --utc '+%F %H:%M:%S UTC')
 
-INCLUDES = \
+INCLUDES = -I$(top_srcdir)/libffi-2.00-beta -I$(top_srcdir)/libffi-2.00-beta/include \
 	-I@top_srcdir@/src/libsablevm/include \
 	-DPKGDATADIR=\"@datadir@/@PACKAGE@\" \
 	-DSYSCONFDIR=\"@sysconfdir@\" \
diff -urN -x .build -x .inst -x .sinst -x configure -x aclocal.m4 -x Makefile.in -x libffi-2.00-beta -x INSTALL -x INSTALL.sablevm -x ltmain.sh sablevm-1.1.6-orig/src/sablevm/sablevm.c sablevm-1.1.6/src/sablevm/sablevm.c
--- sablevm-1.1.6-orig/src/sablevm/sablevm.c	2004-07-10 18:28:18.000000000 +0200
+++ sablevm-1.1.6/src/sablevm/sablevm.c	2004-10-14 18:01:23.000000000 +0200
@@ -972,7 +972,11 @@
 #define ARG_COPYRIGHT 11
 #define ARG_NO_COPYRIGHT 12
 
+#ifndef __CYGWIN__
   static const struct poptOption options[] =	/* description of command line options */
+#else /* __CYGWIN__ */
+  static struct poptOption options[] =	/* description of command line options */
+#endif /* __CYGWIN__ */
   {
     {"classpath", 'c', POPT_ARG_STRING, &argument, ARG_CLASS_PATH, "set class path", "\"PATH\""},
     {"property", 'p', POPT_ARG_STRING, &argument, ARG_PROPERTY, "set system property", "\"NAME=VALUE\""},
diff -urN -x .build -x .inst -x .sinst -x configure -x aclocal.m4 -x Makefile.in -x libffi-2.00-beta -x INSTALL -x INSTALL.sablevm-classpath -x ltmain.sh sablevm-classpath-1.1.6-orig/native/jni/gtk-peer/Makefile.am sablevm-classpath-1.1.6/native/jni/gtk-peer/Makefile.am
--- sablevm-classpath-1.1.6-orig/native/jni/gtk-peer/Makefile.am	2004-07-10 18:31:07.000000000 +0200
+++ sablevm-classpath-1.1.6/native/jni/gtk-peer/Makefile.am	2004-10-15 13:33:54.000000000 +0200
@@ -44,4 +44,4 @@
 
 libgtkpeer_la_CPPFLAGS = $(AM_CPPFLAGS) @GTK_CFLAGS@
 libgtkpeer_la_LIBADD = $(top_builddir)/native/jni/classpath/native_state.lo
-libgtkpeer_la_LDFLAGS = @CLASSPATH_MODULE@ @GTK_LIBS@
+libgtkpeer_la_LDFLAGS = -no-undefined @CLASSPATH_MODULE@ @GTK_LIBS@ -L/usr/X11R6/lib -lX11
diff -urN -x .build -x .inst -x .sinst -x configure -x aclocal.m4 -x Makefile.in -x libffi-2.00-beta -x INSTALL -x INSTALL.sablevm-classpath -x ltmain.sh sablevm-classpath-1.1.6-orig/native/jni/java-awt/Makefile.am sablevm-classpath-1.1.6/native/jni/java-awt/Makefile.am
--- sablevm-classpath-1.1.6-orig/native/jni/java-awt/Makefile.am	2004-07-10 18:31:05.000000000 +0200
+++ sablevm-classpath-1.1.6/native/jni/java-awt/Makefile.am	2004-10-14 17:53:23.000000000 +0200
@@ -2,5 +2,5 @@
 
 libjavaawt_la_SOURCES = gnu_java_awt_EmbeddedWindow.c
 			
-libjavaawt_la_LDFLAGS = @CLASSPATH_MODULE@
+libjavaawt_la_LDFLAGS = -no-undefined @CLASSPATH_MODULE@
 libjavaawt_la_LIBADD = $(top_builddir)/native/jni/classpath/jcl.lo
diff -urN -x .build -x .inst -x .sinst -x configure -x aclocal.m4 -x Makefile.in -x libffi-2.00-beta -x INSTALL -x INSTALL.sablevm-classpath -x ltmain.sh sablevm-classpath-1.1.6-orig/native/jni/java-io/Makefile.am sablevm-classpath-1.1.6/native/jni/java-io/Makefile.am
--- sablevm-classpath-1.1.6-orig/native/jni/java-io/Makefile.am	2004-07-10 18:31:05.000000000 +0200
+++ sablevm-classpath-1.1.6/native/jni/java-io/Makefile.am	2004-10-14 17:53:53.000000000 +0200
@@ -6,5 +6,5 @@
 			java_io_VMFile.c \
 			java_io_VMObjectStreamClass.c
 
-libjavaio_la_LDFLAGS = @CLASSPATH_MODULE@ 
+libjavaio_la_LDFLAGS = -no-undefined @CLASSPATH_MODULE@ 
 libjavaio_la_LIBADD = $(top_builddir)/native/jni/classpath/jcl.lo
diff -urN -x .build -x .inst -x .sinst -x configure -x aclocal.m4 -x Makefile.in -x libffi-2.00-beta -x INSTALL -x INSTALL.sablevm-classpath -x ltmain.sh sablevm-classpath-1.1.6-orig/native/jni/java-lang/Makefile.am sablevm-classpath-1.1.6/native/jni/java-lang/Makefile.am
--- sablevm-classpath-1.1.6-orig/native/jni/java-lang/Makefile.am	2004-07-10 18:31:05.000000000 +0200
+++ sablevm-classpath-1.1.6/native/jni/java-lang/Makefile.am	2004-10-15 18:59:31.000000000 +0200
@@ -11,9 +11,9 @@
 libjavalang_la_CFLAGS = $(AM_CPPFLAGS) -I$(top_srcdir)/native/fdlibm
 libjavalang_la_LIBADD = $(wildcard $(top_builddir)/native/fdlibm/*.lo) \
 			$(top_builddir)/native/jni/classpath/jcl.lo
-libjavalang_la_LDFLAGS = @CLASSPATH_MODULE@
+libjavalang_la_LDFLAGS = -no-undefined @CLASSPATH_MODULE@
 
 libjavalangreflect_la_CFLAGS = $(AM_CPPFLAGS) -I$(top_srcdir)/native/fdlibm
 libjavalangreflect_la_SOURCES = java_lang_reflect_Array.c
 
-libjavalangreflect_la_LDFLAGS = @CLASSPATH_MODULE@
+libjavalangreflect_la_LDFLAGS = -no-undefined @CLASSPATH_MODULE@
diff -urN -x .build -x .inst -x .sinst -x configure -x aclocal.m4 -x Makefile.in -x libffi-2.00-beta -x INSTALL -x INSTALL.sablevm-classpath -x ltmain.sh sablevm-classpath-1.1.6-orig/native/jni/java-net/Makefile.am sablevm-classpath-1.1.6/native/jni/java-net/Makefile.am
--- sablevm-classpath-1.1.6-orig/native/jni/java-net/Makefile.am	2004-07-10 18:31:05.000000000 +0200
+++ sablevm-classpath-1.1.6/native/jni/java-net/Makefile.am	2004-10-14 17:54:42.000000000 +0200
@@ -7,5 +7,5 @@
 			gnu_java_net_PlainDatagramSocketImpl.c \
                         gnu_java_net_PlainSocketImpl.c
 
-libjavanet_la_LDFLAGS = @CLASSPATH_MODULE@
+libjavanet_la_LDFLAGS = -no-undefined @CLASSPATH_MODULE@
 libjavanet_la_LIBADD = $(top_builddir)/native/jni/classpath/jcl.lo
diff -urN -x .build -x .inst -x .sinst -x configure -x aclocal.m4 -x Makefile.in -x libffi-2.00-beta -x INSTALL -x INSTALL.sablevm-classpath -x ltmain.sh sablevm-classpath-1.1.6-orig/native/jni/java-nio/Makefile.am sablevm-classpath-1.1.6/native/jni/java-nio/Makefile.am
--- sablevm-classpath-1.1.6-orig/native/jni/java-nio/Makefile.am	2004-07-10 18:31:05.000000000 +0200
+++ sablevm-classpath-1.1.6/native/jni/java-nio/Makefile.am	2004-10-14 17:55:01.000000000 +0200
@@ -8,5 +8,5 @@
 			java_nio_MappedByteBufferImpl.c \
 			java_nio_channels_Channels.c
 
-libjavanio_la_LDFLAGS = @CLASSPATH_MODULE@
+libjavanio_la_LDFLAGS = -no-undefined @CLASSPATH_MODULE@
 libjavanio_la_LIBADD = $(top_builddir)/native/jni/classpath/jcl.lo
diff -urN -x .build -x .inst -x .sinst -x configure -x aclocal.m4 -x Makefile.in -x libffi-2.00-beta -x INSTALL -x INSTALL.sablevm-classpath -x ltmain.sh sablevm-classpath-1.1.6-orig/native/jni/java-util/Makefile.am sablevm-classpath-1.1.6/native/jni/java-util/Makefile.am
--- sablevm-classpath-1.1.6-orig/native/jni/java-util/Makefile.am	2004-07-10 18:31:05.000000000 +0200
+++ sablevm-classpath-1.1.6/native/jni/java-util/Makefile.am	2004-10-14 17:55:16.000000000 +0200
@@ -1,5 +1,8 @@
+# override FLAGS for Cygwin
+AM_CFLAGS=-pedantic -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wall -Wno-long-long -D_BSD_SOURCE
+
 pkglib_LTLIBRARIES = libjavautil.la
 
 libjavautil_la_SOURCES = java_util_TimeZone.c
 
-libjavautil_la_LDFLAGS = @CLASSPATH_MODULE@
+libjavautil_la_LDFLAGS = -no-undefined @CLASSPATH_MODULE@
diff -urN -x .build -x .inst -x .sinst -x configure -x aclocal.m4 -x Makefile.in -x libffi-2.00-beta -x INSTALL -x INSTALL.sablevm-classpath -x ltmain.sh sablevm-classpath-1.1.6-orig/native/target/generic/target_generic_misc.h sablevm-classpath-1.1.6/native/target/generic/target_generic_misc.h
--- sablevm-classpath-1.1.6-orig/native/target/generic/target_generic_misc.h	2004-07-10 18:31:07.000000000 +0200
+++ sablevm-classpath-1.1.6/native/target/generic/target_generic_misc.h	2004-10-14 14:20:43.000000000 +0200
@@ -7,7 +7,7 @@
 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.
- 
+
 GNU Classpath 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
@@ -213,7 +213,11 @@
   #endif
   #include <string.h>
   #ifndef WITH_TIMEZONE_VARIABLE
-    #define WITH_TIMEZONE_VARIABLE timezone
+   #ifndef __CYGWIN__
+     #define WITH_TIMEZONE_VARIABLE timezone
+   #else
+     #define WITH_TIMEZONE_VARIABLE (int)timezone
+   #endif
   #endif
   #define TARGET_NATIVE_MISC_GET_TIMEZONE_STRING(string,maxStringLength,result) \
     do { \
--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/