From nobody@FreeBSD.org  Fri Apr 13 19:49:02 2007
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id 28E1116A400
	for <freebsd-gnats-submit@FreeBSD.org>; Fri, 13 Apr 2007 19:49:02 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (www.freebsd.org [69.147.83.33])
	by mx1.freebsd.org (Postfix) with ESMTP id 17F3613C457
	for <freebsd-gnats-submit@FreeBSD.org>; Fri, 13 Apr 2007 19:49:02 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.13.1/8.13.1) with ESMTP id l3DJn1q0006028
	for <freebsd-gnats-submit@FreeBSD.org>; Fri, 13 Apr 2007 19:49:01 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.13.1/8.13.1/Submit) id l3DJi0jI005267;
	Fri, 13 Apr 2007 19:44:00 GMT
	(envelope-from nobody)
Message-Id: <200704131944.l3DJi0jI005267@www.freebsd.org>
Date: Fri, 13 Apr 2007 19:44:00 GMT
From: Jonas Wolz<jonas.wolz@freenet.de>
To: freebsd-gnats-submit@FreeBSD.org
Subject: WITH_JAVA_AWT=yes does not work with lang/gcc41
X-Send-Pr-Version: www-3.0

>Number:         111544
>Category:       ports
>Synopsis:       WITH_JAVA_AWT=yes does not work with lang/gcc41
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    gerald
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Apr 13 19:50:01 GMT 2007
>Closed-Date:    Sat Apr 14 15:19:41 GMT 2007
>Last-Modified:  Sat Apr 21 07:50:01 GMT 2007
>Originator:     Jonas Wolz
>Release:        6.2-RELEASE
>Organization:
>Environment:
FreeBSD nobby 6.2-RELEASE FreeBSD 6.2-RELEASE #0: Sun Jan 21 18:11:14 CET 2007     jonas@nobby:/usr/obj/usr/src/sys/JW_NOBBY  i386

>Description:
When building devel/gcc41-withgcjawt or devel/gcc41 with WITH_JAVA_AWT defined the AWT library seems not to be built.
This results in the error "java.awt.AWTError: Cannot load AWT toolkit: gnu.java.awt.peer.gtk.GtkToolkit" when you try to run a java application.

>How-To-Repeat:
Copy the following source code into the file "Hello2.java", compile it with "gcj41 Hello2.java --main=Hello2" and execute ./a.out

//// begin Hello2.java ////
import javax.swing.*;
public class Hello2 extends JFrame {
	public static void main(String[] args) {
		Hello2 h = new Hello2();
		h.setVisible(true);
	}

	public Hello2() {
		super("Hello World");
		setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
		pack();
	}
}
//// end Hello2.java ////
>Fix:
Apply the attached patch to the port's Makefile.
I don't know if it is the cleanest or best solution because I have no experience with creating ports but it works for me.

Patch attached with submission follows:

*** Makefile.old	Tue Apr 10 07:24:27 2007
--- Makefile	Fri Apr 13 18:58:37 2007
***************
*** 40,43 ****
--- 40,51 ----
  NOMANCOMPRESS=	yes	# too hard to deal with differences on 5-cur and releng4
  
+ 
+ .if defined(WITH_JAVA_AWT)
+ LIB_DEPENDS+=	cairo.2:${PORTSDIR}/graphics/cairo
+ USE_GNOME=	gtk20 libartlgpl2
+ CONFIGURE_ARGS+=	--enable-java-awt=gtk,xlib \
+ 			--enable-gtk-cairo
+ .endif
+ 
  .include <bsd.port.pre.mk>
  
***************
*** 113,122 ****
  PLIST_SUB+=	JAVA="@comment "
  
- .if defined(WITH_JAVA_AWT)
- LIB_DEPENDS+=	cairo.2:${PORTSDIR}/graphics/cairo
- USE_GNOME=	gtk20 libartlgpl2
- CONFIGURE_ARGS+=	--enable-java-awt=gtk,xlib \
- 			--enable-gtk-cairo
- .endif
  
  .endif
--- 121,124 ----

>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-ports-bugs->gerald 
Responsible-Changed-By: edwin 
Responsible-Changed-When: Fri Apr 13 19:50:07 UTC 2007 
Responsible-Changed-Why:  
Over to maintainer 

http://www.freebsd.org/cgi/query-pr.cgi?pr=111544 
State-Changed-From-To: open->closed 
State-Changed-By: gerald 
State-Changed-When: Sat Apr 14 15:16:57 UTC 2007 
State-Changed-Why:  
Thanks for the report and the patch.  We could not take the patch in its 
current form since that would have defeated the main purpose of the original 
changes (namely, to use OPTIONS in the future). 

Based on discussions with some fellow FreeBSD ports committers I have, 
however, committed a patch we believe resolves the problem you have seen 
in a different way, keeping the road for the use of OPTIONS open. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=111544 

Adding to audit trail from misfiled email message caught in spamtrap:

From: Jonas Wolz <jonas.wolz@freenet.de>
Date: Mon, 16 Apr 2007 10:50:29 +0200

 I might be wrong, but doesn't the Makefile still have a problem?
 (I haven't tested it so far, but I doubt it will work correctly.)
 The logic currently seems to be:

 .if ! defined(WITHOUT_JAVA)
 	# Java stuff 
 .else # i.e: "if defined(WITHOUT_JAVA)"
 	# Non-Java stuff
 	.if defined(WITH_JAVA_AWT)  # Executed only if WITHOUT_JAVA defined?
 		# ...
 	.endif
 .endif

 I think the WITH_JAVA_AWT block should be moved in the !defined(WITHOUT_JAVA) 
 block (if you want AWT, it doesn't make sense to define WITHOUT_JAVA...).

 Regards,
 Jonas

Date: Mon, 16 Apr 2007 15:04:56 +0200 (CEST)
From: Gerald Pfeifer <gerald@pfeifer.com>

 On Mon, 16 Apr 2007, Jonas Wolz wrote:
 > I might be wrong, but doesn't the Makefile still have a problem?
 
 I'm afraid you're right.  I am not actually using this functionality,
 just hosting it in my lang/gcc ports, and none of those interested have
 spotted the issue so far it seems.
 
 A fix is in testing right now...
 
 Gerald

Date: Mon, 16 Apr 2007 14:26:14 +0000 (UTC)
From: dfilter@FreeBSD.ORG (dfilter service)

 gerald      2007-04-16 14:26:08 UTC
 
   FreeBSD ports repository
 
   Modified files:
     lang/gcc42           Makefile 
   Log:
   Move the WITH_JAVA_AWT bits into the ! WITHOUT_JAVA branch, that is,
   enable this only when Java is enabled.
   
   PR:             111544
   
   Revision  Changes    Path
   1.310     +3 -3      ports/lang/gcc42/Makefile
 _______________________________________________
 cvs-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/cvs-all
 To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: ports/111544: commit references a PR
Date: Tue, 17 Apr 2007 05:23:46 +0000 (UTC)

 gerald      2007-04-17 05:23:40 UTC
 
   FreeBSD ports repository
 
   Modified files:
     lang/gcc41           Makefile distinfo 
   Log:
   Update to the 20070416 snapshot of GCC 4.1.3.
   
   Move the WITH_JAVA_AWT bits into the ! WITHOUT_JAVA branch, that is,
   enable this only when Java is enabled.
   
   PR:             111544
   
   Revision  Changes    Path
   1.320     +4 -4      ports/lang/gcc41/Makefile
   1.198     +15 -18    ports/lang/gcc41/distinfo
 _______________________________________________
 cvs-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/cvs-all
 To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: ports/111544: commit references a PR
Date: Sat, 21 Apr 2007 07:41:10 +0000 (UTC)

 gerald      2007-04-21 07:41:05 UTC
 
   FreeBSD ports repository
 
   Modified files:
     lang/gcc43           Makefile distinfo 
   Log:
   Update to the 20070420 snapshot of GCC 4.3.0.
   
   Move the WITH_JAVA_AWT bits into the ! WITHOUT_JAVA branch, that is,
   enable this only when Java is enabled.
   
   PR:             111544
   
   Revision  Changes    Path
   1.309     +4 -4      ports/lang/gcc43/Makefile
   1.197     +18 -18    ports/lang/gcc43/distinfo
 _______________________________________________
 cvs-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/cvs-all
 To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
 
>Unformatted:
