Subject: Re: pkg/30017 kaffe-1.1.5, patch proposition
To: None <pkg-manager@netbsd.org, gnats-admin@netbsd.org,>
From: Antoine Reilles <Antoine.Reilles@loria.fr>
List: pkgsrc-bugs
Date: 04/24/2005 19:04:01
The following reply was made to PR pkg/30017; it has been noted by GNATS.

From: Antoine Reilles <Antoine.Reilles@loria.fr>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: pkg/30017 kaffe-1.1.5, patch proposition
Date: Sun, 24 Apr 2005 21:00:33 +0200

 Hi,
 
 I investigated the problem a bit more. For the problem pankake reported, using 
 .include "../../devel/libltdl/buildlink3.mk"
 instead of conveniance.mk fixed that.
 
 There was also a problem which prevented kaffe-1.1.5 to be build under -current
 
 I came out with a set of patches which resolves the issue, thanks to dalibor at
 #kaffe
 
 The problem is: i'm not sure those patches will make it possible to build kaffe
 with netbsd<=1.6, and do not have a machine to test that.
 Also, this patch is for i386, and may/should be adapted for other architectures
 as well.
 
 Kaffe 1.1.5 has a really impressing changelog, so the efforts to make it
 working under netbsd are not lost.
 
 antoine
 
 
 Index: Makefile
 ===================================================================
 RCS file: /cvsroot/pkgsrc/lang/kaffe/Makefile,v
 retrieving revision 1.58
 diff -u -r1.58 Makefile
 --- Makefile	30 Jan 2005 23:18:38 -0000	1.58
 +++ Makefile	24 Apr 2005 18:53:59 -0000
 @@ -3,8 +3,6 @@
  
  .include "Makefile.common"
  
 -PKGREVISION=		6
 -
  CONFLICTS+=		kaffe-nox11-[0-9]*
  
  JAVA_WRAPPERS=		appletviewer jar java javac javadoc javah javakey \
 @@ -21,6 +19,6 @@
  post-install:
  	${INSTALL_DATA} ${WRKSRC}/license.terms ${JAVA_HOME}
  
 -.include "../../devel/libltdl/convenience.mk"
 +.include "../../devel/libltdl/buildlink3.mk"
  .include "../../mk/java-env.mk"
  .include "../../mk/bsd.pkg.mk"
 Index: Makefile.common
 ===================================================================
 RCS file: /cvsroot/pkgsrc/lang/kaffe/Makefile.common,v
 retrieving revision 1.4
 diff -u -r1.4 Makefile.common
 --- Makefile.common	11 Apr 2005 21:46:14 -0000	1.4
 +++ Makefile.common	24 Apr 2005 18:53:59 -0000
 @@ -1,6 +1,6 @@
  # $NetBSD: Makefile.common,v 1.4 2005/04/11 21:46:14 tv Exp $
  
 -DISTNAME=		kaffe-1.1.4
 +DISTNAME=		kaffe-1.1.5
  CATEGORIES=		lang java
  MASTER_SITES=		ftp://ftp.kaffe.org/pub/kaffe/v1.1.x-development/
  
 @@ -23,14 +23,15 @@
  
  GNU_CONFIGURE=		yes
  CPPFLAGS+=		-Dunix
 -PATCHDIR=		${.CURDIR}/../../lang/kaffe/patches
 -DISTINFO_FILE=		${.CURDIR}/../../lang/kaffe/distinfo
 +PATCHDIR=		${.CURDIR}/../../lang/kaffe-devel/patches
 +DISTINFO_FILE=		${.CURDIR}/../../lang/kaffe-devel/distinfo
  
  BUILDLINK_PASSTHRU_DIRS+=	${JAVA_HOME}/jre/lib/${MACHINE_ARCH}
  
  CONFIGURE_ARGS+=	--without-alsa
  CONFIGURE_ARGS+=	--without-esd
 -CONFIGURE_ARGS+=	--without-awt
 +CONFIGURE_ARGS+=	--disable-esdtest
 +CONFIGURE_ARGS+=	--disable-native-awt
  
  .include "../../mk/bsd.prefs.mk"
  
 Index: PLIST
 ===================================================================
 RCS file: /cvsroot/pkgsrc/lang/kaffe/PLIST,v
 retrieving revision 1.11
 diff -u -r1.11 PLIST
 --- PLIST	22 Sep 2004 08:09:39 -0000	1.11
 +++ PLIST	24 Apr 2005 18:53:59 -0000
 @@ -1,4 +1,4 @@
 -@comment $NetBSD: PLIST,v 1.11 2004/09/22 08:09:39 jlam Exp $
 +@comment $NetBSD$
  bin/kaffe-appletviewer
  bin/kaffe-jar
  bin/kaffe-java
 @@ -18,17 +18,15 @@
  java/kaffe/bin/javac
  java/kaffe/bin/javadoc
  java/kaffe/bin/javah
 -java/kaffe/bin/javakey
  java/kaffe/bin/javap
 -java/kaffe/bin/jdb
  java/kaffe/bin/kaffe
  java/kaffe/bin/kaffeh
 -java/kaffe/bin/kjc
 -java/kaffe/bin/kopi
  java/kaffe/bin/native2ascii
  java/kaffe/bin/rmic
  java/kaffe/bin/rmiregistry
  java/kaffe/bin/serialver
 +java/kaffe/include/jawt.h
 +java/kaffe/include/jawt_md.h
  java/kaffe/include/jni.h
  java/kaffe/include/jni_cpp.h
  java/kaffe/include/jvmpi.h
 @@ -40,27 +38,35 @@
  java/kaffe/include/kaffe/java_lang_Throwable.h
  java/kaffe/include/kaffe/java_lang_VMThrowable.h
  java/kaffe/include/kaffe/jmalloc.h
 -java/kaffe/include/kaffe/jtypes.h
 +java/kaffe/include/kaffe/jni_md.h
 +java/kaffe/include/kaffe_jni.h
  java/kaffe/jre/bin/java
  java/kaffe/jre/bin/kaffe
  java/kaffe/jre/bin/kaffe-bin
  java/kaffe/jre/bin/rmiregistry
 +java/kaffe/jre/lib/gmpjavamath.jar
 +java/kaffe/jre/lib/${MACHINE_ARCH}/libclasspath.la
  java/kaffe/jre/lib/${MACHINE_ARCH}/libio.la
 +java/kaffe/jre/lib/${MACHINE_ARCH}/libkaffegc.la
 +java/kaffe/jre/lib/${MACHINE_ARCH}/libkaffeverifier.la
  java/kaffe/jre/lib/${MACHINE_ARCH}/libkaffevm.la
  java/kaffe/jre/lib/${MACHINE_ARCH}/libmanagement.la
  java/kaffe/jre/lib/${MACHINE_ARCH}/libmath.la
  java/kaffe/jre/lib/${MACHINE_ARCH}/libnative.la
  java/kaffe/jre/lib/${MACHINE_ARCH}/libnet.la
  java/kaffe/jre/lib/${MACHINE_ARCH}/libnio.la
 +java/kaffe/jre/lib/${MACHINE_ARCH}/libreplace.la
  java/kaffe/jre/lib/${MACHINE_ARCH}/libsecurity.la
  java/kaffe/jre/lib/${MACHINE_ARCH}/libzip.la
 +java/kaffe/jre/lib/security/java.security
 +java/kaffe/jre/lib/logging.properties
  java/kaffe/jre/lib/rt.jar
 -java/kaffe/jre/lib/security/java.security.default
 -java/kaffe/lib/kjc.jar
 +java/kaffe/jre/lib/tools.jar
  java/kaffe/license.terms
  java/kaffe/man/man1/kaffe.1
  @dirrm java/kaffe/man/man1
  @dirrm java/kaffe/man
 +@exec ${MKDIR} %D/java/kaffe/lib
  @dirrm java/kaffe/lib
  @dirrm java/kaffe/jre/lib/security
  @dirrm java/kaffe/jre/lib/${MACHINE_ARCH}
 Index: distinfo
 ===================================================================
 RCS file: /cvsroot/pkgsrc/lang/kaffe/distinfo,v
 retrieving revision 1.12
 diff -u -r1.12 distinfo
 --- distinfo	24 Feb 2005 09:03:08 -0000	1.12
 +++ distinfo	24 Apr 2005 18:53:59 -0000
 @@ -1,8 +1,8 @@
  $NetBSD: distinfo,v 1.12 2005/02/24 09:03:08 agc Exp $
  
 -SHA1 (kaffe-1.1.4.tar.gz) = fb7a6ac27d82e1854de07422c46ce5e17beda58b
 -RMD160 (kaffe-1.1.4.tar.gz) = 5bb8b0c9a338a3bd05f9fdc2a3f94c297489a7db
 -Size (kaffe-1.1.4.tar.gz) = 8891220 bytes
 -SHA1 (patch-aa) = 7b5dde8d984e8ee2d474d4e54d064562a5535533
 -SHA1 (patch-ac) = 5a4cd4ee913b7d4277cc10c38a7c4a810ba258f1
 -SHA1 (patch-ae) = f7d6ff1e9356f6ba00c23c2ab0a1682aa9ccc003
 +SHA1 (kaffe-1.1.5.tar.gz) = ebd8da490783ed189fb25fad0d674f384194e2f3
 +RMD160 (kaffe-1.1.5.tar.gz) = 516b5dbaa13efed099f59ff9b7121700ef6ad13b
 +Size (kaffe-1.1.5.tar.gz) = 9796278 bytes
 +SHA1 (patch-aa) = 781e2f93253611b13ce517e75ff3205946eb38bc
 +SHA1 (patch-ab) = 0142d8db49e37d62c9a877c2fb4b19af7398b853
 +SHA1 (patch-ac) = e52335ec4de81a2f88ec846b92026d3e09e0c34f
 Index: patches/patch-aa
 ===================================================================
 RCS file: /cvsroot/pkgsrc/lang/kaffe/patches/patch-aa,v
 retrieving revision 1.12
 diff -u -r1.12 patch-aa
 --- patches/patch-aa	22 Sep 2003 03:04:17 -0000	1.12
 +++ patches/patch-aa	24 Apr 2005 18:53:59 -0000
 @@ -1,18 +1,26 @@
 -$NetBSD: patch-aa,v 1.12 2003/09/22 03:04:17 jschauma Exp $
 -
 ---- configure.orig	2003-08-03 19:15:52.000000000 -0400
 -+++ configure	2003-09-21 18:22:14.000000000 -0400
 -@@ -22916,11 +22916,11 @@
 - #endif
 - /* We use char because int might match the return type of a gcc2
 -    builtin and then its argument prototype would still apply.  */
 --char mpz_get_d ();
 -+char __mpz_get_d ();
 - int
 - main ()
 - {
 --mpz_get_d ();
 -+__mpz_get_d ();
 -   ;
 -   return 0;
 - }
 +--- config/i386/netbsd1/md.h.orig	2005-04-24 19:53:29.000000000 +0200
 ++++ config/i386/netbsd1/md.h	2005-04-24 19:58:35.000000000 +0200
 +@@ -17,6 +17,7 @@
 + 
 + #include "i386/common.h"
 + #include "i386/threads.h"
 ++#include  <sys/ucontext.h>
 + 
 + #if defined(HAVE_SYS_RESOURCE_H)
 + #include <sys/resource.h>
 +@@ -31,11 +32,11 @@
 + #undef SP_OFFSET
 + #define SP_OFFSET 2
 + 
 +-#define SIGNAL_ARGS(sig, sc) int sig, int __code, struct sigcontext *sc
 +-#define SIGNAL_CONTEXT_POINTER(scp) struct sigcontext *scp
 ++#define SIGNAL_ARGS(sig, sc) int sig, int __code, struct __ucontext *sc
 ++#define SIGNAL_CONTEXT_POINTER(scp) struct __ucontext *scp
 + #define GET_SIGNAL_CONTEXT_POINTER(sc) (sc)
 +-#define SIGNAL_PC(scp) (scp)->sc_pc
 +-#define STACK_POINTER(scp) (scp)->sc_sp
 ++#define SIGNAL_PC(scp) ((scp)->uc_mcontext.__gregs[_REG_EIP])
 ++#define STACK_POINTER(scp) ((scp)->uc_mcontext.__gregs[_REG_ESP])
 + 
 + #if defined(TRANSLATOR)
 + #include "jit-md.h"
 Index: patches/patch-ac
 ===================================================================
 RCS file: /cvsroot/pkgsrc/lang/kaffe/patches/patch-ac,v
 retrieving revision 1.7
 diff -u -r1.7 patch-ac
 --- patches/patch-ac	6 Apr 2004 17:08:01 -0000	1.7
 +++ patches/patch-ac	24 Apr 2005 18:53:59 -0000
 @@ -1,25 +1,12 @@
 -$NetBSD: patch-ac,v 1.7 2004/04/06 17:08:01 xtraeme Exp $
 -
 ---- libraries/clib/security/Makefile.in.orig	2004-04-06 17:39:24.000000000 +0200
 -+++ libraries/clib/security/Makefile.in	2004-04-06 17:42:21.000000000 +0200
 -@@ -453,16 +453,16 @@
 - 	@list='$(security_DATA)'; for p in $$list; do \
 - 	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
 - 	  f="`echo $$p | sed -e 's|^.*/||'`"; \
 --	  echo " $(securityDATA_INSTALL) $$d$$p $(DESTDIR)$(securitydir)/$$f"; \
 --	  $(securityDATA_INSTALL) $$d$$p $(DESTDIR)$(securitydir)/$$f; \
 -+	  echo " $(securityDATA_INSTALL) $$d$$p $(DESTDIR)$(securitydir)/$$f.default"; \
 -+	  $(securityDATA_INSTALL) $$d$$p $(DESTDIR)$(securitydir)/$$f.default; \
 - 	done
 +--- config/i386/netbsd1/jit-md.h.orig	2005-04-24 20:01:15.000000000 +0200
 ++++ config/i386/netbsd1/jit-md.h	2005-04-24 20:01:46.000000000 +0200
 +@@ -26,7 +26,7 @@
   
 - uninstall-securityDATA:
 - 	@$(NORMAL_UNINSTALL)
 - 	@list='$(security_DATA)'; for p in $$list; do \
 - 	  f="`echo $$p | sed -e 's|^.*/||'`"; \
 --	  echo " rm -f $(DESTDIR)$(securitydir)/$$f"; \
 --	  rm -f $(DESTDIR)$(securitydir)/$$f; \
 -+	  echo " rm -f $(DESTDIR)$(securitydir)/$$f.default"; \
 -+	  rm -f $(DESTDIR)$(securitydir)/$$f.default; \
 - 	done
 + /* Get the first exception frame from a signal handler */
 + #define	EXCEPTIONFRAME(f, c)						\
 +-	(f).retbp = (c)->sc_ebp;					\
 +-	(f).retpc = (c)->sc_eip + 1
 ++       (f).retbp = (c)->uc_mcontext.__gregs[_REG_EBP];                 \
 ++       (f).retpc = (c)->uc_mcontext.__gregs[_REG_EIP] + 1
   
 - ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
 + #endif
 --- /dev/null	2005-04-24 20:51:18.000000000 +0200
 +++ patches/patch-ab	2005-04-24 19:50:42.000000000 +0200
 @@ -0,0 +1,83 @@
 +--- ./kaffe/kaffevm/systems/unix-pthreads/signal.c.orig	2005-04-24 19:46:52.000000000 +0200
 ++++ ./kaffe/kaffevm/systems/unix-pthreads/signal.c	2005-04-24 19:50:12.000000000 +0200
 +@@ -47,8 +47,6 @@
 + #define SIG_T   void*
 + #endif
 + 
 +-static void nullException(SIGNAL_ARGS(sig, sc));
 +-static void floatingException(EXCEPTIONPROTO);
 + static void ignoreSignal(int sig);
 + 
 + static exchandler_t nullHandler;
 +@@ -56,35 +54,6 @@
 + static exchandler_t stackOverflowHandler;
 + 
 + /*
 +- * Setup the internal exceptions.
 +- */
 +-void
 +-jthread_initexceptions(exchandler_t _nullHandler,
 +-		       exchandler_t _floatingHandler,
 +-		       exchandler_t _stackOverflowHandler)
 +-{
 +-	nullHandler = _nullHandler;
 +-	floatingHandler = _floatingHandler;
 +-	stackOverflowHandler = _stackOverflowHandler;
 +-
 +-	if (DBGEXPR(EXCEPTION, false, true)) {
 +-		/* Catch signals we need to convert to exceptions */
 +-#if defined(SIGSEGV)
 +-		registerSyncSignalHandler(SIGSEGV, nullException);
 +-#endif
 +-#if defined(SIGBUS)
 +-		registerSyncSignalHandler(SIGBUS, nullException);
 +-#endif
 +-#if defined(SIGFPE)
 +-		registerSyncSignalHandler(SIGFPE, floatingException);
 +-#endif
 +-#if defined(SIGPIPE)
 +-		ignoreSignal(SIGPIPE);
 +-#endif
 +-	}
 +-}
 +-
 +-/*
 +  * Null exception - catches bad memory accesses.
 +  */
 + static void
 +@@ -141,6 +110,35 @@
 + 	floatingHandler(EXCEPTIONFRAMEPTR);
 + }
 + 
 ++/*
 ++ * Setup the internal exceptions.
 ++ */
 ++void
 ++jthread_initexceptions(exchandler_t _nullHandler,
 ++		       exchandler_t _floatingHandler,
 ++		       exchandler_t _stackOverflowHandler)
 ++{
 ++	nullHandler = _nullHandler;
 ++	floatingHandler = _floatingHandler;
 ++	stackOverflowHandler = _stackOverflowHandler;
 ++
 ++	if (DBGEXPR(EXCEPTION, false, true)) {
 ++		/* Catch signals we need to convert to exceptions */
 ++#if defined(SIGSEGV)
 ++		registerSyncSignalHandler(SIGSEGV, nullException);
 ++#endif
 ++#if defined(SIGBUS)
 ++		registerSyncSignalHandler(SIGBUS, nullException);
 ++#endif
 ++#if defined(SIGFPE)
 ++		registerSyncSignalHandler(SIGFPE, floatingException);
 ++#endif
 ++#if defined(SIGPIPE)
 ++		ignoreSignal(SIGPIPE);
 ++#endif
 ++	}
 ++}
 ++
 + /* -----------------------------------------------
 +  * OS signal handling code.  See FAQ/FAQ.jsignal for information.
 +  * ----------------------------------------------- */