summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVlastimil Babka <caster@gentoo.org>2009-07-19 10:27:20 +0000
committerVlastimil Babka <caster@gentoo.org>2009-07-19 10:27:20 +0000
commitfce2f43914c073b00dc89ee027864af4818e4a43 (patch)
tree83d3f8c7dd6c19a3bf71beb5965583133e6c4e18 /dev-java/swt
parentVersion bump (diff)
downloadgentoo-2-fce2f43914c073b00dc89ee027864af4818e4a43.tar.gz
gentoo-2-fce2f43914c073b00dc89ee027864af4818e4a43.tar.bz2
gentoo-2-fce2f43914c073b00dc89ee027864af4818e4a43.zip
Version bump to 3.5, new slot, bug #277704. Revbump 3.4-r4 fixes missing symbol issue and adds backported upstream patch for xulrunner-1.9.1 support, both discussed in bug #241400. Older 3.4 versions restrict xulrunner dependency to 1.9.0*.
(Portage version: 2.2_rc33/cvs/Linux x86_64)
Diffstat (limited to 'dev-java/swt')
-rw-r--r--dev-java/swt/ChangeLog15
-rw-r--r--dev-java/swt/files/swt-3.4-xulrunner-1.9.1-amd64.patch325
-rw-r--r--dev-java/swt/files/swt-3.4-xulrunner-1.9.1.patch325
-rw-r--r--dev-java/swt/files/swt-3.5-manifest17
-rw-r--r--dev-java/swt/swt-3.4-r2.ebuild4
-rw-r--r--dev-java/swt/swt-3.4-r3.ebuild4
-rw-r--r--dev-java/swt/swt-3.4-r4.ebuild216
-rw-r--r--dev-java/swt/swt-3.5.ebuild208
8 files changed, 1109 insertions, 5 deletions
diff --git a/dev-java/swt/ChangeLog b/dev-java/swt/ChangeLog
index 888e26376a5d..738b3fe1fb95 100644
--- a/dev-java/swt/ChangeLog
+++ b/dev-java/swt/ChangeLog
@@ -1,6 +1,19 @@
# ChangeLog for dev-java/swt
# Copyright 1999-2009 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/dev-java/swt/ChangeLog,v 1.105 2009/07/05 20:49:47 maekke Exp $
+# $Header: /var/cvsroot/gentoo-x86/dev-java/swt/ChangeLog,v 1.106 2009/07/19 10:27:20 caster Exp $
+
+*swt-3.5 (19 Jul 2009)
+*swt-3.4-r4 (19 Jul 2009)
+
+ 19 Jul 2009; Vlastimil Babka <caster@gentoo.org> swt-3.4-r2.ebuild,
+ swt-3.4-r3.ebuild, +swt-3.4-r4.ebuild,
+ +files/swt-3.4-xulrunner-1.9.1-amd64.patch,
+ +files/swt-3.4-xulrunner-1.9.1.patch, +swt-3.5.ebuild,
+ +files/swt-3.5-manifest:
+ Version bump to 3.5, new slot, bug #277704. Revbump 3.4-r4 fixes missing
+ symbol issue and adds backported upstream patch for xulrunner-1.9.1
+ support, both discussed in bug #241400. Older 3.4 versions restrict
+ xulrunner dependency to 1.9.0*.
05 Jul 2009; Markus Meier <maekke@gentoo.org> swt-3.3.1.1-r1.ebuild:
amd64 stable, bug #275287
diff --git a/dev-java/swt/files/swt-3.4-xulrunner-1.9.1-amd64.patch b/dev-java/swt/files/swt-3.4-xulrunner-1.9.1-amd64.patch
new file mode 100644
index 000000000000..db2536bab3ac
--- /dev/null
+++ b/dev-java/swt/files/swt-3.4-xulrunner-1.9.1-amd64.patch
@@ -0,0 +1,325 @@
+# Patch by Grant Gayed
+# https://bugs.eclipse.org/bugs/show_bug.cgi?id=268651#c18
+# https://bugs.eclipse.org/bugs/attachment.cgi?id=130751
+Index: Eclipse SWT Mozilla/common/org/eclipse/swt/browser/Mozilla.java
+===================================================================
+RCS file: /cvsroot/eclipse/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/browser/Mozilla.java,v
+retrieving revision 1.105.2.3
+diff -u -r1.105.2.3 Mozilla.java
+--- src/org/eclipse/swt/browser/Mozilla.java 21 Aug 2008 16:02:30 -00001.105.2.3
++++ src/org/eclipse/swt/browser/Mozilla.java 2 Apr 2009 19:15:06 -0000
+@@ -47,6 +47,7 @@
+ Shell tip = null;
+ Listener listener;
+ Vector unhookedDOMWindows = new Vector ();
++ byte[] htmlBytes;
+
+ static nsIAppShell AppShell;
+ static AppFileLocProvider LocationProvider;
+@@ -1130,21 +1131,21 @@
+ * Once the client does a proper navigate with either setUrl() or setText() then resume as
+ * normal. The Mozilla bug for this is https://bugzilla.mozilla.org/show_bug.cgi?id=415789.
+ */
+- awaitingNavigate = true;
+- rc = webBrowser.QueryInterface (nsIWebNavigation.NS_IWEBNAVIGATION_IID, result);
+- if (rc != XPCOM.NS_OK) {
+- browser.dispose ();
+- error (rc);
+- }
+- if (result[0] == 0) {
+- browser.dispose ();
+- error (XPCOM.NS_ERROR_NO_INTERFACE);
+- }
+- nsIWebNavigation webNavigation = new nsIWebNavigation (result[0]);
+- char[] uri = new char[ABOUT_BLANK.length () + 1];
+- ABOUT_BLANK.getChars (0, ABOUT_BLANK.length (), uri, 0);
+- rc = webNavigation.LoadURI (uri, nsIWebNavigation.LOAD_FLAGS_NONE, 0, 0, 0);
+- webNavigation.Release ();
++// awaitingNavigate = true;
++// rc = webBrowser.QueryInterface (nsIWebNavigation.NS_IWEBNAVIGATION_IID, result);
++// if (rc != XPCOM.NS_OK) {
++// browser.dispose ();
++// error (rc);
++// }
++// if (result[0] == 0) {
++// browser.dispose ();
++// error (XPCOM.NS_ERROR_NO_INTERFACE);
++// }
++// nsIWebNavigation webNavigation = new nsIWebNavigation (result[0]);
++// char[] uri = new char[ABOUT_BLANK.length () + 1];
++// ABOUT_BLANK.getChars (0, ABOUT_BLANK.length (), uri, 0);
++// rc = webNavigation.LoadURI (uri, nsIWebNavigation.LOAD_FLAGS_NONE, 0, 0, 0);
++// webNavigation.Release ();
+ }
+ }
+ result[0] = 0;
+@@ -1223,6 +1224,7 @@
+ }
+
+ public boolean back () {
++ htmlBytes = null;
+ if (awaitingNavigate) return false;
+
+ long /*int*/[] result = new long /*int*/[1];
+@@ -1425,6 +1427,7 @@
+ }
+
+ public boolean forward () {
++ htmlBytes = null;
+ if (awaitingNavigate) return false;
+
+ long /*int*/[] result = new long /*int*/[1];
+@@ -1635,6 +1638,7 @@
+ webBrowser.Release ();
+ webBrowser = null;
+ webBrowserObject = null;
++ htmlBytes = null;
+
+ if (tip != null && !tip.isDisposed ()) tip.dispose ();
+ tip = null;
+@@ -1696,6 +1700,7 @@
+ }
+
+ public void refresh () {
++ htmlBytes = null;
+ if (awaitingNavigate) return;
+
+ long /*int*/[] result = new long /*int*/[1];
+@@ -1817,11 +1822,45 @@
+ } else {
+ result[0] = 0;
+ rc = interfaceRequestor.GetInterface (nsIDocShell.NS_IDOCSHELL_IID, result);
+- if (rc != XPCOM.NS_OK) error (rc);
+- if (result[0] == 0) error (XPCOM.NS_ERROR_NO_INTERFACE);
+- nsIDocShell docShell = new nsIDocShell (result[0]);
+- rc = docShell.LoadStream (inputStream.getAddress (), uri.getAddress (), aContentType, aContentCharset, 0);
+- docShell.Release ();
++ if (rc == XPCOM.NS_OK) {
++ if (result[0] == 0) error (XPCOM.NS_ERROR_NO_INTERFACE);
++ nsIDocShell docShell = new nsIDocShell (result[0]);
++ rc = docShell.LoadStream (inputStream.getAddress (), uri.getAddress (), aContentType, aContentCharset, 0);
++ docShell.Release ();
++ } else {
++ result[0] = 0;
++ rc = webBrowser.QueryInterface (nsIWebBrowserStream.NS_IWEBBROWSERSTREAM_IID, result);
++ if (rc == XPCOM.NS_OK) {
++ if (result[0] == 0) error (XPCOM.NS_ERROR_NO_INTERFACE);
++ /*
++ * Setting mozilla's content through nsIWebBrowserStream does not cause a page
++ * load to occur, so the events that usually accompany a page change are not
++ * fired. To make this behave as expected, navigate to about:blank first and
++ * then set the html content once the page has loaded.
++ */
++ new nsISupports (result[0]).Release ();
++ result[0] = 0;
++
++ /*
++ * If htmlBytes is not null then the about:blank page is already being loaded,
++ * so no Navigate is required. Just set the html that is to be shown.
++ */
++ boolean blankLoading = htmlBytes != null;
++ htmlBytes = data;
++ if (blankLoading) return true;
++
++ /* navigate to about:blank */
++ rc = webBrowser.QueryInterface (nsIWebNavigation.NS_IWEBNAVIGATION_IID, result);
++ if (rc != XPCOM.NS_OK) error (rc);
++ if (result[0] == 0) error (XPCOM.NS_ERROR_NO_INTERFACE);
++ nsIWebNavigation webNavigation = new nsIWebNavigation (result[0]);
++ result[0] = 0;
++ char[] uriChars = new char[ABOUT_BLANK.length () + 1];
++ ABOUT_BLANK.getChars (0, ABOUT_BLANK.length (), uriChars, 0);
++ rc = webNavigation.LoadURI (uriChars, nsIWebNavigation.LOAD_FLAGS_NONE, 0, 0, 0);
++ webNavigation.Release ();
++ }
++ }
+ }
+ }
+ if (rc != XPCOM.NS_OK) error (rc);
+@@ -1836,6 +1875,7 @@
+ }
+
+ public boolean setUrl (String url) {
++ htmlBytes = null;
+ awaitingNavigate = false;
+
+ long /*int*/[] result = new long /*int*/[1];
+@@ -1852,6 +1892,7 @@
+ }
+
+ public void stop () {
++ htmlBytes = null;
+ if (awaitingNavigate) return;
+
+ long /*int*/[] result = new long /*int*/[1];
+@@ -2174,6 +2215,108 @@
+ unhookedDOMWindows.remove (ptrObject);
+ new nsISupports (ptrObject.value).Release ();
+ }
++
++ /*
++ * If htmlBytes is not null then there is html from a previous setText() call
++ * waiting to be set into the about:blank page once it has completed loading.
++ */
++ if (htmlBytes != null) {
++ nsIRequest req = new nsIRequest (aRequest);
++ long /*int*/ name = XPCOM.nsEmbedCString_new ();
++ rc = req.GetName (name);
++ if (rc != XPCOM.NS_OK) error (rc);
++ int length = XPCOM.nsEmbedCString_Length (name);
++ long /*int*/ buffer = XPCOM.nsEmbedCString_get (name);
++ byte[] dest = new byte[length];
++ XPCOM.memmove (dest, buffer, length);
++ String url = new String (dest);
++ XPCOM.nsEmbedCString_delete (name);
++
++ if (url.startsWith (ABOUT_BLANK)) {
++ /*
++ * Setting mozilla's content with nsIWebBrowserStream invalidates the
++ * DOM listeners that were hooked on it (about:blank), so remove them and
++ * add new ones after the content has been set.
++ */
++ unhookDOMListeners ();
++
++ rc = XPCOM.NS_GetServiceManager (result);
++ if (rc != XPCOM.NS_OK) error (rc);
++ if (result[0] == 0) error (XPCOM.NS_NOINTERFACE);
++
++ nsIServiceManager serviceManager = new nsIServiceManager (result[0]);
++ result[0] = 0;
++ rc = serviceManager.GetService (XPCOM.NS_IOSERVICE_CID, nsIIOService.NS_IIOSERVICE_IID, result);
++ if (rc != XPCOM.NS_OK) error (rc);
++ if (result[0] == 0) error (XPCOM.NS_NOINTERFACE);
++ serviceManager.Release ();
++
++ nsIIOService ioService = new nsIIOService (result[0]);
++ result[0] = 0;
++ /*
++ * Note. Mozilla ignores LINK tags used to load CSS stylesheets
++ * when the URI protocol for the nsInputStreamChannel
++ * is about:blank. The fix is to specify the file protocol.
++ */
++ byte[] aString = MozillaDelegate.wcsToMbcs (null, URI_FROMMEMORY, false);
++ long /*int*/ aSpec = XPCOM.nsEmbedCString_new (aString, aString.length);
++ rc = ioService.NewURI (aSpec, null, 0, result);
++ if (rc != XPCOM.NS_OK) error (rc);
++ if (result[0] == 0) error (XPCOM.NS_NOINTERFACE);
++ XPCOM.nsEmbedCString_delete (aSpec);
++ ioService.Release ();
++
++ nsIURI uri = new nsIURI (result[0]);
++ result[0] = 0;
++
++ rc = webBrowser.QueryInterface (nsIWebBrowserStream.NS_IWEBBROWSERSTREAM_IID, result);
++ if (rc != XPCOM.NS_OK) error (rc);
++ if (result[0] == 0) error (XPCOM.NS_NOINTERFACE);
++
++ nsIWebBrowserStream stream = new nsIWebBrowserStream (result[0]);
++ result[0] = 0;
++
++ byte[] contentTypeBuffer = MozillaDelegate.wcsToMbcs (null, "text/html", true); // $NON-NLS-1$
++ long /*int*/ aContentType = XPCOM.nsEmbedCString_new (contentTypeBuffer, contentTypeBuffer.length);
++
++ rc = stream.OpenStream (uri.getAddress (), aContentType);
++ if (rc != XPCOM.NS_OK) error (rc);
++ long /*int*/ ptr = C.malloc (htmlBytes.length);
++ XPCOM.memmove (ptr, htmlBytes, htmlBytes.length);
++ int pageSize = 8192;
++ int pageCount = htmlBytes.length / pageSize + 1;
++ long /*int*/ current = ptr;
++ for (int i = 0; i < pageCount; i++) {
++ length = i == pageCount - 1 ? htmlBytes.length % pageSize : pageSize;
++ if (length > 0) {
++ rc = stream.AppendToStream (current, length);
++ if (rc != XPCOM.NS_OK) error (rc);
++ }
++ current += pageSize;
++ }
++ rc = stream.CloseStream ();
++ if (rc != XPCOM.NS_OK) error (rc);
++ C.free (ptr);
++ XPCOM.nsEmbedCString_delete (aContentType);
++ stream.Release ();
++ uri.Release ();
++ htmlBytes = null;
++
++ rc = webBrowser.GetContentDOMWindow (result);
++ if (rc != XPCOM.NS_OK) error (rc);
++ if (result[0] == 0) error (XPCOM.NS_ERROR_NO_INTERFACE);
++ boolean isTop = result[0] == domWindow.getAddress ();
++ new nsISupports (result[0]).Release ();
++ result[0] = 0;
++ rc = domWindow.QueryInterface (nsIDOMEventTarget.NS_IDOMEVENTTARGET_IID, result);
++ if (rc != XPCOM.NS_OK) error (rc);
++ if (result[0] == 0) error (XPCOM.NS_ERROR_NO_INTERFACE);
++ nsIDOMEventTarget target = new nsIDOMEventTarget (result[0]);
++ result[0] = 0;
++ hookDOMListeners (target, isTop);
++ target.Release ();
++ }
++ }
+ domWindow.Release ();
+
+ /*
+Index: Eclipse SWT Mozilla/common/org/eclipse/swt/internal/mozilla/nsIWebBrowserStream.java
+===================================================================
+RCS file: Eclipse SWT Mozilla/common/org/eclipse/swt/internal/mozilla/nsIWebBrowserStream.java
+diff -N Eclipse SWT Mozilla/common/org/eclipse/swt/internal/mozilla/nsIWebBrowserStream.java
+--- /dev/null 1 Jan 1970 00:00:00 -0000
++++ src/org/eclipse/swt/internal/mozilla/nsIWebBrowserStream.java 1 Jan 1970 00:00:00 -0000
+@@ -0,0 +1,55 @@
++/* ***** BEGIN LICENSE BLOCK *****
++ * Version: MPL 1.1
++ *
++ * The contents of this file are subject to the Mozilla Public License Version
++ * 1.1 (the "License"); you may not use this file except in compliance with
++ * the License. You may obtain a copy of the License at
++ * http://www.mozilla.org/MPL/
++ *
++ * Software distributed under the License is distributed on an "AS IS" basis,
++ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
++ * for the specific language governing rights and limitations under the
++ * License.
++ *
++ * The Original Code is Mozilla Communicator client code, released March 31, 1998.
++ *
++ * The Initial Developer of the Original Code is
++ * Netscape Communications Corporation.
++ * Portions created by Netscape are Copyright (C) 1998-1999
++ * Netscape Communications Corporation. All Rights Reserved.
++ *
++ * Contributor(s):
++ *
++ * IBM
++ * - Binding to permit interfacing between Mozilla and SWT
++ * - Copyright (C) 2003, 2009 IBM Corp. All Rights Reserved.
++ *
++ * ***** END LICENSE BLOCK ***** */
++package org.eclipse.swt.internal.mozilla;
++
++public class nsIWebBrowserStream extends nsISupports {
++
++ static final int LAST_METHOD_ID = nsISupports.LAST_METHOD_ID + 3;
++
++ public static final String NS_IWEBBROWSERSTREAM_IID_STR =
++ "86d02f0e-219b-4cfc-9c88-bd98d2cce0b8";
++
++ public static final nsID NS_IWEBBROWSERSTREAM_IID =
++ new nsID(NS_IWEBBROWSERSTREAM_IID_STR);
++
++ public nsIWebBrowserStream(long /*int*/ address) {
++ super(address);
++ }
++
++ public int OpenStream(long /*int*/ aBaseURI, long /*int*/ aContentType) {
++ return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 1, getAddress(), aBaseURI, aContentType);
++ }
++
++ public int AppendToStream(long /*int*/ aData, int aLen) {
++ return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 2, getAddress(), aData, aLen);
++ }
++
++ public int CloseStream() {
++ return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 3, getAddress());
++ }
++}
diff --git a/dev-java/swt/files/swt-3.4-xulrunner-1.9.1.patch b/dev-java/swt/files/swt-3.4-xulrunner-1.9.1.patch
new file mode 100644
index 000000000000..8e829943e325
--- /dev/null
+++ b/dev-java/swt/files/swt-3.4-xulrunner-1.9.1.patch
@@ -0,0 +1,325 @@
+# Patch by Grant Gayed
+# https://bugs.eclipse.org/bugs/show_bug.cgi?id=268651#c18
+# https://bugs.eclipse.org/bugs/attachment.cgi?id=130751
+Index: Eclipse SWT Mozilla/common/org/eclipse/swt/browser/Mozilla.java
+===================================================================
+RCS file: /cvsroot/eclipse/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/browser/Mozilla.java,v
+retrieving revision 1.105.2.3
+diff -u -r1.105.2.3 Mozilla.java
+--- src/org/eclipse/swt/browser/Mozilla.java 21 Aug 2008 16:02:30 -00001.105.2.3
++++ src/org/eclipse/swt/browser/Mozilla.java 2 Apr 2009 19:15:06 -0000
+@@ -47,6 +47,7 @@
+ Shell tip = null;
+ Listener listener;
+ Vector unhookedDOMWindows = new Vector ();
++ byte[] htmlBytes;
+
+ static nsIAppShell AppShell;
+ static AppFileLocProvider LocationProvider;
+@@ -1130,21 +1131,21 @@
+ * Once the client does a proper navigate with either setUrl() or setText() then resume as
+ * normal. The Mozilla bug for this is https://bugzilla.mozilla.org/show_bug.cgi?id=415789.
+ */
+- awaitingNavigate = true;
+- rc = webBrowser.QueryInterface (nsIWebNavigation.NS_IWEBNAVIGATION_IID, result);
+- if (rc != XPCOM.NS_OK) {
+- browser.dispose ();
+- error (rc);
+- }
+- if (result[0] == 0) {
+- browser.dispose ();
+- error (XPCOM.NS_ERROR_NO_INTERFACE);
+- }
+- nsIWebNavigation webNavigation = new nsIWebNavigation (result[0]);
+- char[] uri = new char[ABOUT_BLANK.length () + 1];
+- ABOUT_BLANK.getChars (0, ABOUT_BLANK.length (), uri, 0);
+- rc = webNavigation.LoadURI (uri, nsIWebNavigation.LOAD_FLAGS_NONE, 0, 0, 0);
+- webNavigation.Release ();
++// awaitingNavigate = true;
++// rc = webBrowser.QueryInterface (nsIWebNavigation.NS_IWEBNAVIGATION_IID, result);
++// if (rc != XPCOM.NS_OK) {
++// browser.dispose ();
++// error (rc);
++// }
++// if (result[0] == 0) {
++// browser.dispose ();
++// error (XPCOM.NS_ERROR_NO_INTERFACE);
++// }
++// nsIWebNavigation webNavigation = new nsIWebNavigation (result[0]);
++// char[] uri = new char[ABOUT_BLANK.length () + 1];
++// ABOUT_BLANK.getChars (0, ABOUT_BLANK.length (), uri, 0);
++// rc = webNavigation.LoadURI (uri, nsIWebNavigation.LOAD_FLAGS_NONE, 0, 0, 0);
++// webNavigation.Release ();
+ }
+ }
+ result[0] = 0;
+@@ -1223,6 +1224,7 @@
+ }
+
+ public boolean back () {
++ htmlBytes = null;
+ if (awaitingNavigate) return false;
+
+ long /*int*/[] result = new long /*int*/[1];
+@@ -1425,6 +1427,7 @@
+ }
+
+ public boolean forward () {
++ htmlBytes = null;
+ if (awaitingNavigate) return false;
+
+ long /*int*/[] result = new long /*int*/[1];
+@@ -1635,6 +1638,7 @@
+ webBrowser.Release ();
+ webBrowser = null;
+ webBrowserObject = null;
++ htmlBytes = null;
+
+ if (tip != null && !tip.isDisposed ()) tip.dispose ();
+ tip = null;
+@@ -1696,6 +1700,7 @@
+ }
+
+ public void refresh () {
++ htmlBytes = null;
+ if (awaitingNavigate) return;
+
+ long /*int*/[] result = new long /*int*/[1];
+@@ -1817,11 +1822,45 @@
+ } else {
+ result[0] = 0;
+ rc = interfaceRequestor.GetInterface (nsIDocShell.NS_IDOCSHELL_IID, result);
+- if (rc != XPCOM.NS_OK) error (rc);
+- if (result[0] == 0) error (XPCOM.NS_ERROR_NO_INTERFACE);
+- nsIDocShell docShell = new nsIDocShell (result[0]);
+- rc = docShell.LoadStream (inputStream.getAddress (), uri.getAddress (), aContentType, aContentCharset, 0);
+- docShell.Release ();
++ if (rc == XPCOM.NS_OK) {
++ if (result[0] == 0) error (XPCOM.NS_ERROR_NO_INTERFACE);
++ nsIDocShell docShell = new nsIDocShell (result[0]);
++ rc = docShell.LoadStream (inputStream.getAddress (), uri.getAddress (), aContentType, aContentCharset, 0);
++ docShell.Release ();
++ } else {
++ result[0] = 0;
++ rc = webBrowser.QueryInterface (nsIWebBrowserStream.NS_IWEBBROWSERSTREAM_IID, result);
++ if (rc == XPCOM.NS_OK) {
++ if (result[0] == 0) error (XPCOM.NS_ERROR_NO_INTERFACE);
++ /*
++ * Setting mozilla's content through nsIWebBrowserStream does not cause a page
++ * load to occur, so the events that usually accompany a page change are not
++ * fired. To make this behave as expected, navigate to about:blank first and
++ * then set the html content once the page has loaded.
++ */
++ new nsISupports (result[0]).Release ();
++ result[0] = 0;
++
++ /*
++ * If htmlBytes is not null then the about:blank page is already being loaded,
++ * so no Navigate is required. Just set the html that is to be shown.
++ */
++ boolean blankLoading = htmlBytes != null;
++ htmlBytes = data;
++ if (blankLoading) return true;
++
++ /* navigate to about:blank */
++ rc = webBrowser.QueryInterface (nsIWebNavigation.NS_IWEBNAVIGATION_IID, result);
++ if (rc != XPCOM.NS_OK) error (rc);
++ if (result[0] == 0) error (XPCOM.NS_ERROR_NO_INTERFACE);
++ nsIWebNavigation webNavigation = new nsIWebNavigation (result[0]);
++ result[0] = 0;
++ char[] uriChars = new char[ABOUT_BLANK.length () + 1];
++ ABOUT_BLANK.getChars (0, ABOUT_BLANK.length (), uriChars, 0);
++ rc = webNavigation.LoadURI (uriChars, nsIWebNavigation.LOAD_FLAGS_NONE, 0, 0, 0);
++ webNavigation.Release ();
++ }
++ }
+ }
+ }
+ if (rc != XPCOM.NS_OK) error (rc);
+@@ -1836,6 +1875,7 @@
+ }
+
+ public boolean setUrl (String url) {
++ htmlBytes = null;
+ awaitingNavigate = false;
+
+ long /*int*/[] result = new long /*int*/[1];
+@@ -1852,6 +1892,7 @@
+ }
+
+ public void stop () {
++ htmlBytes = null;
+ if (awaitingNavigate) return;
+
+ long /*int*/[] result = new long /*int*/[1];
+@@ -2174,6 +2215,108 @@
+ unhookedDOMWindows.remove (ptrObject);
+ new nsISupports (ptrObject.value).Release ();
+ }
++
++ /*
++ * If htmlBytes is not null then there is html from a previous setText() call
++ * waiting to be set into the about:blank page once it has completed loading.
++ */
++ if (htmlBytes != null) {
++ nsIRequest req = new nsIRequest (aRequest);
++ int /*long*/ name = XPCOM.nsEmbedCString_new ();
++ rc = req.GetName (name);
++ if (rc != XPCOM.NS_OK) error (rc);
++ int length = XPCOM.nsEmbedCString_Length (name);
++ int /*long*/ buffer = XPCOM.nsEmbedCString_get (name);
++ byte[] dest = new byte[length];
++ XPCOM.memmove (dest, buffer, length);
++ String url = new String (dest);
++ XPCOM.nsEmbedCString_delete (name);
++
++ if (url.startsWith (ABOUT_BLANK)) {
++ /*
++ * Setting mozilla's content with nsIWebBrowserStream invalidates the
++ * DOM listeners that were hooked on it (about:blank), so remove them and
++ * add new ones after the content has been set.
++ */
++ unhookDOMListeners ();
++
++ rc = XPCOM.NS_GetServiceManager (result);
++ if (rc != XPCOM.NS_OK) error (rc);
++ if (result[0] == 0) error (XPCOM.NS_NOINTERFACE);
++
++ nsIServiceManager serviceManager = new nsIServiceManager (result[0]);
++ result[0] = 0;
++ rc = serviceManager.GetService (XPCOM.NS_IOSERVICE_CID, nsIIOService.NS_IIOSERVICE_IID, result);
++ if (rc != XPCOM.NS_OK) error (rc);
++ if (result[0] == 0) error (XPCOM.NS_NOINTERFACE);
++ serviceManager.Release ();
++
++ nsIIOService ioService = new nsIIOService (result[0]);
++ result[0] = 0;
++ /*
++ * Note. Mozilla ignores LINK tags used to load CSS stylesheets
++ * when the URI protocol for the nsInputStreamChannel
++ * is about:blank. The fix is to specify the file protocol.
++ */
++ byte[] aString = MozillaDelegate.wcsToMbcs (null, URI_FROMMEMORY, false);
++ int /*long*/ aSpec = XPCOM.nsEmbedCString_new (aString, aString.length);
++ rc = ioService.NewURI (aSpec, null, 0, result);
++ if (rc != XPCOM.NS_OK) error (rc);
++ if (result[0] == 0) error (XPCOM.NS_NOINTERFACE);
++ XPCOM.nsEmbedCString_delete (aSpec);
++ ioService.Release ();
++
++ nsIURI uri = new nsIURI (result[0]);
++ result[0] = 0;
++
++ rc = webBrowser.QueryInterface (nsIWebBrowserStream.NS_IWEBBROWSERSTREAM_IID, result);
++ if (rc != XPCOM.NS_OK) error (rc);
++ if (result[0] == 0) error (XPCOM.NS_NOINTERFACE);
++
++ nsIWebBrowserStream stream = new nsIWebBrowserStream (result[0]);
++ result[0] = 0;
++
++ byte[] contentTypeBuffer = MozillaDelegate.wcsToMbcs (null, "text/html", true); // $NON-NLS-1$
++ int /*long*/ aContentType = XPCOM.nsEmbedCString_new (contentTypeBuffer, contentTypeBuffer.length);
++
++ rc = stream.OpenStream (uri.getAddress (), aContentType);
++ if (rc != XPCOM.NS_OK) error (rc);
++ int /*long*/ ptr = C.malloc (htmlBytes.length);
++ XPCOM.memmove (ptr, htmlBytes, htmlBytes.length);
++ int pageSize = 8192;
++ int pageCount = htmlBytes.length / pageSize + 1;
++ int /*long*/ current = ptr;
++ for (int i = 0; i < pageCount; i++) {
++ length = i == pageCount - 1 ? htmlBytes.length % pageSize : pageSize;
++ if (length > 0) {
++ rc = stream.AppendToStream (current, length);
++ if (rc != XPCOM.NS_OK) error (rc);
++ }
++ current += pageSize;
++ }
++ rc = stream.CloseStream ();
++ if (rc != XPCOM.NS_OK) error (rc);
++ C.free (ptr);
++ XPCOM.nsEmbedCString_delete (aContentType);
++ stream.Release ();
++ uri.Release ();
++ htmlBytes = null;
++
++ rc = webBrowser.GetContentDOMWindow (result);
++ if (rc != XPCOM.NS_OK) error (rc);
++ if (result[0] == 0) error (XPCOM.NS_ERROR_NO_INTERFACE);
++ boolean isTop = result[0] == domWindow.getAddress ();
++ new nsISupports (result[0]).Release ();
++ result[0] = 0;
++ rc = domWindow.QueryInterface (nsIDOMEventTarget.NS_IDOMEVENTTARGET_IID, result);
++ if (rc != XPCOM.NS_OK) error (rc);
++ if (result[0] == 0) error (XPCOM.NS_ERROR_NO_INTERFACE);
++ nsIDOMEventTarget target = new nsIDOMEventTarget (result[0]);
++ result[0] = 0;
++ hookDOMListeners (target, isTop);
++ target.Release ();
++ }
++ }
+ domWindow.Release ();
+
+ /*
+Index: Eclipse SWT Mozilla/common/org/eclipse/swt/internal/mozilla/nsIWebBrowserStream.java
+===================================================================
+RCS file: Eclipse SWT Mozilla/common/org/eclipse/swt/internal/mozilla/nsIWebBrowserStream.java
+diff -N Eclipse SWT Mozilla/common/org/eclipse/swt/internal/mozilla/nsIWebBrowserStream.java
+--- /dev/null 1 Jan 1970 00:00:00 -0000
++++ src/org/eclipse/swt/internal/mozilla/nsIWebBrowserStream.java 1 Jan 1970 00:00:00 -0000
+@@ -0,0 +1,55 @@
++/* ***** BEGIN LICENSE BLOCK *****
++ * Version: MPL 1.1
++ *
++ * The contents of this file are subject to the Mozilla Public License Version
++ * 1.1 (the "License"); you may not use this file except in compliance with
++ * the License. You may obtain a copy of the License at
++ * http://www.mozilla.org/MPL/
++ *
++ * Software distributed under the License is distributed on an "AS IS" basis,
++ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
++ * for the specific language governing rights and limitations under the
++ * License.
++ *
++ * The Original Code is Mozilla Communicator client code, released March 31, 1998.
++ *
++ * The Initial Developer of the Original Code is
++ * Netscape Communications Corporation.
++ * Portions created by Netscape are Copyright (C) 1998-1999
++ * Netscape Communications Corporation. All Rights Reserved.
++ *
++ * Contributor(s):
++ *
++ * IBM
++ * - Binding to permit interfacing between Mozilla and SWT
++ * - Copyright (C) 2003, 2009 IBM Corp. All Rights Reserved.
++ *
++ * ***** END LICENSE BLOCK ***** */
++package org.eclipse.swt.internal.mozilla;
++
++public class nsIWebBrowserStream extends nsISupports {
++
++ static final int LAST_METHOD_ID = nsISupports.LAST_METHOD_ID + 3;
++
++ public static final String NS_IWEBBROWSERSTREAM_IID_STR =
++ "86d02f0e-219b-4cfc-9c88-bd98d2cce0b8";
++
++ public static final nsID NS_IWEBBROWSERSTREAM_IID =
++ new nsID(NS_IWEBBROWSERSTREAM_IID_STR);
++
++ public nsIWebBrowserStream(int /*long*/ address) {
++ super(address);
++ }
++
++ public int OpenStream(int /*long*/ aBaseURI, int /*long*/ aContentType) {
++ return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 1, getAddress(), aBaseURI, aContentType);
++ }
++
++ public int AppendToStream(int /*long*/ aData, int aLen) {
++ return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 2, getAddress(), aData, aLen);
++ }
++
++ public int CloseStream() {
++ return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 3, getAddress());
++ }
++}
diff --git a/dev-java/swt/files/swt-3.5-manifest b/dev-java/swt/files/swt-3.5-manifest
new file mode 100644
index 000000000000..70be33fb8ef8
--- /dev/null
+++ b/dev-java/swt/files/swt-3.5-manifest
@@ -0,0 +1,17 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %pluginName
+Bundle-Vendor: %providerName
+Bundle-Localization: plugin
+Fragment-Host: org.eclipse.swt; bundle-version="[3.0.0,4.0.0)"
+Bundle-SymbolicName: org.eclipse.swt.gtk.linux.SWT_ARCH; singleton:=true
+Bundle-Version: 3.5
+Eclipse-PlatformFilter: (& (osgi.ws=gtk) (osgi.os=linux) (osgi.arch=SWT_ARCH))
+Export-Package: org.eclipse.swt.internal.accessibility.gtk; x-internal:=true,
+ org.eclipse.swt.internal.cairo; x-internal:=true,
+ org.eclipse.swt.internal.cde; x-internal:=true,
+ org.eclipse.swt.internal.gnome; x-internal:=true,
+ org.eclipse.swt.internal.gtk; x-internal:=true,
+ org.eclipse.swt.internal.mozilla; x-internal:=true,
+ org.eclipse.swt.internal.opengl.glx; x-internal:=true
+
diff --git a/dev-java/swt/swt-3.4-r2.ebuild b/dev-java/swt/swt-3.4-r2.ebuild
index bbe874ad8dc3..36ed9392e1a4 100644
--- a/dev-java/swt/swt-3.4-r2.ebuild
+++ b/dev-java/swt/swt-3.4-r2.ebuild
@@ -1,6 +1,6 @@
# Copyright 1999-2009 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/dev-java/swt/swt-3.4-r2.ebuild,v 1.6 2009/06/22 18:39:14 serkan Exp $
+# $Header: /var/cvsroot/gentoo-x86/dev-java/swt/swt-3.4-r2.ebuild,v 1.7 2009/07/19 10:27:20 caster Exp $
EAPI="1"
@@ -42,7 +42,7 @@ COMMON=">=dev-libs/glib-2.6
=gnome-base/gnome-vfs-2*
=gnome-base/libgnomeui-2*
)
- xulrunner? ( net-libs/xulrunner:1.9 )
+ xulrunner? ( =net-libs/xulrunner-1.9.0*:1.9 )
opengl? (
virtual/opengl
virtual/glu
diff --git a/dev-java/swt/swt-3.4-r3.ebuild b/dev-java/swt/swt-3.4-r3.ebuild
index 8c17540113c3..4366f74e1d66 100644
--- a/dev-java/swt/swt-3.4-r3.ebuild
+++ b/dev-java/swt/swt-3.4-r3.ebuild
@@ -1,6 +1,6 @@
# Copyright 1999-2009 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/dev-java/swt/swt-3.4-r3.ebuild,v 1.6 2009/07/05 20:47:59 maekke Exp $
+# $Header: /var/cvsroot/gentoo-x86/dev-java/swt/swt-3.4-r3.ebuild,v 1.7 2009/07/19 10:27:20 caster Exp $
EAPI="1"
@@ -42,7 +42,7 @@ COMMON=">=dev-libs/glib-2.6
=gnome-base/gnome-vfs-2*
=gnome-base/libgnomeui-2*
)
- xulrunner? ( net-libs/xulrunner:1.9 )
+ xulrunner? ( =net-libs/xulrunner-1.9.0*:1.9 )
opengl? (
virtual/opengl
virtual/glu
diff --git a/dev-java/swt/swt-3.4-r4.ebuild b/dev-java/swt/swt-3.4-r4.ebuild
new file mode 100644
index 000000000000..60f63da3d296
--- /dev/null
+++ b/dev-java/swt/swt-3.4-r4.ebuild
@@ -0,0 +1,216 @@
+# Copyright 1999-2009 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/dev-java/swt/swt-3.4-r4.ebuild,v 1.1 2009/07/19 10:27:20 caster Exp $
+
+EAPI="1"
+
+inherit eutils java-pkg-2 java-ant-2 toolchain-funcs java-osgi
+
+MY_PV="${PV/_pre/M}"
+MY_DMF="download.eclipse.org/eclipse/downloads/drops/R-${MY_PV}-200806172000"
+MY_P="${PN}-${MY_PV}"
+
+DESCRIPTION="GTK based SWT Library"
+HOMEPAGE="http://www.eclipse.org/"
+SRC_URI="x86? (
+ http://${MY_DMF}/${MY_P}-gtk-linux-x86.zip
+ )
+ x86-fbsd? (
+ http://${MY_DMF}/${MY_P}-gtk-linux-x86.zip
+ )
+ amd64? (
+ http://${MY_DMF}/${MY_P}-gtk-linux-x86_64.zip
+ )
+ ppc? (
+ http://${MY_DMF}/${MY_P}-gtk-linux-ppc.zip
+ )
+ ppc64? (
+ http://${MY_DMF}/${MY_P}-gtk-linux-x86_64.zip
+ )"
+
+SLOT="3.4"
+LICENSE="CPL-1.0 LGPL-2.1 MPL-1.1"
+KEYWORDS="~amd64 ~ppc ~ppc64 ~x86"
+
+IUSE="cairo gnome opengl xulrunner"
+COMMON=">=dev-libs/glib-2.6
+ >=x11-libs/gtk+-2.6.8
+ >=dev-libs/atk-1.10.2
+ cairo? ( >=x11-libs/cairo-1.4.14 )
+ gnome? (
+ =gnome-base/libgnome-2*
+ =gnome-base/gnome-vfs-2*
+ =gnome-base/libgnomeui-2*
+ )
+ xulrunner? ( net-libs/xulrunner:1.9 )
+ opengl? (
+ virtual/opengl
+ virtual/glu
+ )"
+
+# Use a blocker to avoid file collisions when upgrading to the slotted version
+# We cannot use slotmove, java packages are expected to be in /usr/share/PN-SLOT
+# so this is the only way to prevent collisions
+
+DEPEND=">=virtual/jdk-1.4
+ !=dev-java/swt-3.4*:3
+ app-arch/unzip
+ x11-libs/libX11
+ x11-libs/libXrender
+ x11-libs/libXt
+ x11-proto/xextproto
+ x11-proto/inputproto
+ dev-util/pkgconfig
+ ${COMMON}"
+
+RDEPEND=">=virtual/jre-1.4
+ x11-libs/libXtst
+ ${COMMON}"
+
+S="${WORKDIR}"
+
+src_unpack() {
+ local DISTFILE=${A}
+ unzip -jq "${DISTDIR}"/${DISTFILE} "*src.zip" || die "Unable to extract distfile"
+ unpack "./src.zip"
+
+ # Cleanup the redirtied directory structure
+ rm -rf about_files/ || die
+
+ # Replace the build.xml to allow compilation without Eclipse tasks
+ cp "${FILESDIR}/build.xml" "${S}/build.xml" || die "Unable to update build.xml"
+ mkdir "${S}/src" && mv "${S}/org" "${S}/src" || die "Unable to restructure SWT sources"
+
+ # Fix Makefiles to respect flags and work with --as-needed
+ epatch "${FILESDIR}"/as-needed-and-flag-fixes.patch
+
+ # Kill some strict-aliasing warnings
+ epatch "${FILESDIR}/${PN}-3.3-callback-pointer-dereferencing.patch"
+
+ # bug 241400
+ if use amd64 || use ppc64; then
+ epatch "${FILESDIR}/${PN}-3.4-xulrunner-1.9.1-amd64.patch"
+ else
+ epatch "${FILESDIR}/${PN}-3.4-xulrunner-1.9.1.patch"
+ fi
+}
+
+src_compile() {
+ # Drop jikes support as it seems to be unfriendly with SWT
+ java-pkg_filter-compiler jikes
+
+ local AWT_ARCH
+ local JAWTSO="libjawt.so"
+ if [[ $(tc-arch) == 'x86' ]] ; then
+ AWT_ARCH="i386"
+ elif [[ $(tc-arch) == 'ppc' ]] ; then
+ AWT_ARCH="ppc"
+ elif [[ $(tc-arch) == 'ppc64' ]] ; then
+ AWT_ARCH="ppc64"
+ else
+ AWT_ARCH="amd64"
+ fi
+ if [[ -f "${JAVA_HOME}/jre/lib/${AWT_ARCH}/${JAWTSO}" ]]; then
+ export AWT_LIB_PATH="${JAVA_HOME}/jre/lib/${AWT_ARCH}"
+ elif [[ -f "${JAVA_HOME}/jre/bin/${JAWTSO}" ]]; then
+ export AWT_LIB_PATH="${JAVA_HOME}/jre/bin"
+ elif [[ -f "${JAVA_HOME}/$(get_libdir)/${JAWTSO}" ]] ; then
+ export AWT_LIB_PATH="${JAVA_HOME}/$(get_libdir)"
+ else
+ eerror "${JAWTSO} not found in the JDK being used for compilation!"
+ die "cannot build AWT library"
+ fi
+
+ # Fix the pointer size for AMD64
+ [[ ${ARCH} == "amd64" || ${ARCH} == "ppc64" ]] && export SWT_PTR_CFLAGS=-DSWT_PTR_SIZE_64
+
+ local platform="linux"
+
+ use elibc_FreeBSD && platform="freebsd"
+
+ local make="emake -f make_${platform}.mak NO_STRIP=y CC=$(tc-getCC) CXX=$(tc-getCXX)"
+
+ einfo "Building AWT library"
+ ${make} make_awt || die "Failed to build AWT support"
+
+ einfo "Building SWT library"
+ ${make} make_swt || die "Failed to build SWT support"
+
+ einfo "Building JAVA-AT-SPI bridge"
+ ${make} make_atk || die "Failed to build ATK support"
+
+ if use gnome ; then
+ einfo "Building GNOME VFS support"
+ ${make} make_gnome || die "Failed to build GNOME VFS support"
+ fi
+
+ if use xulrunner ; then
+ einfo "Building the Mozilla component against xulrunner-1.9"
+
+ export MOZILLA_INCLUDES="$(pkg-config --cflags libxul libxul-embedding)"
+ # the -R is a workaround for bug #234934
+ export MOZILLA_LIBS="-Wl,-R$(pkg-config libxul --variable=sdkdir) $(pkg-config --libs libxul libxul-embedding)"
+
+ ${make} make_mozilla || die "Failed to build Mozilla support"
+
+ # upstream ships libswt-xulrunner*.so even though the build.sh does not
+ # build it anymore... missing this file leads to another instance
+ # of bug #234934 so we build it too
+ einfo "Building the xulrunner component against xulrunner-1.9"
+
+ export XULRUNNER_INCLUDES="${MOZILLA_INCLUDES}"
+ export XULRUNNER_LIBS="${MOZILLA_LIBS}"
+
+ ${make} make_xulrunner || die "Failed to build xulrunner support"
+
+ ${make} make_xpcominit || die "Failed to build xpcominit support"
+ fi
+
+ if use cairo ; then
+ einfo "Building CAIRO support"
+ ${make} make_cairo || die "Unable to build CAIRO support"
+ fi
+
+ if use opengl ; then
+ einfo "Building OpenGL component"
+ ${make} make_glx || die "Unable to build OpenGL component"
+ fi
+
+ einfo "Building JNI libraries"
+ eant compile
+
+ einfo "Copying missing files"
+ cp -i "${S}/version.txt" "${S}/build/version.txt"
+ cp -i "${S}/src/org/eclipse/swt/internal/SWTMessages.properties" \
+ "${S}/build/org/eclipse/swt/internal/"
+
+ einfo "Packing JNI libraries"
+ eant jar
+}
+
+src_install() {
+ swtArch=${ARCH}
+ use amd64 && swtArch=x86_64
+ use x86-fbsd && swtArch=x86
+
+ sed "s/SWT_ARCH/${swtArch}/" "${FILESDIR}/${PN}-3.4-manifest" > "MANIFEST_TMP.MF"
+ java-osgi_newjar-fromfile "swt.jar" "MANIFEST_TMP.MF" "Standard Widget Toolkit for GTK 2.0"
+
+ java-pkg_sointo /usr/$(get_libdir)
+ java-pkg_doso *.so
+
+ if use xulrunner; then
+ local gecko_dir="$(pkg-config libxul --variable=sdkdir)"
+ java-pkg_register-environment-variable MOZILLA_FIVE_HOME "${gecko_dir}"
+ fi
+
+ dohtml about.html || die
+}
+
+pkg_postinst() {
+ if use xulrunner; then
+ local gecko_dir="$(pkg-config libxul --variable=sdkdir)"
+ elog "You built swt with xulrunner support. For your custom applications please set"
+ elog "MOZILLA_FIVE_HOME environment variable to ${gecko_dir}"
+ fi
+}
diff --git a/dev-java/swt/swt-3.5.ebuild b/dev-java/swt/swt-3.5.ebuild
new file mode 100644
index 000000000000..6d80be551f2f
--- /dev/null
+++ b/dev-java/swt/swt-3.5.ebuild
@@ -0,0 +1,208 @@
+# Copyright 1999-2009 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/dev-java/swt/swt-3.5.ebuild,v 1.1 2009/07/19 10:27:20 caster Exp $
+
+EAPI=2
+
+inherit eutils java-pkg-2 java-ant-2 toolchain-funcs java-osgi
+
+MY_PV="${PV}"
+MY_DMF="download.eclipse.org/eclipse/downloads/drops/R-${MY_PV}-200906111540"
+MY_P="${PN}-${MY_PV}"
+
+DESCRIPTION="GTK based SWT Library"
+HOMEPAGE="http://www.eclipse.org/"
+SRC_URI="x86? (
+ http://${MY_DMF}/${MY_P}-gtk-linux-x86.zip
+ )
+ x86-fbsd? (
+ http://${MY_DMF}/${MY_P}-gtk-linux-x86.zip
+ )
+ amd64? (
+ http://${MY_DMF}/${MY_P}-gtk-linux-x86_64.zip
+ )
+ ppc? (
+ http://${MY_DMF}/${MY_P}-gtk-linux-ppc.zip
+ )
+ ppc64? (
+ http://${MY_DMF}/${MY_P}-gtk-linux-x86_64.zip
+ )"
+
+SLOT="3.5"
+LICENSE="CPL-1.0 LGPL-2.1 MPL-1.1"
+KEYWORDS="~amd64 ~ppc ~ppc64 ~x86"
+
+IUSE="cairo gnome opengl xulrunner"
+COMMON=">=dev-libs/glib-2.6
+ >=x11-libs/gtk+-2.6.8
+ >=dev-libs/atk-1.10.2
+ cairo? ( >=x11-libs/cairo-1.4.14 )
+ gnome? (
+ =gnome-base/libgnome-2*
+ =gnome-base/gnome-vfs-2*
+ =gnome-base/libgnomeui-2*
+ )
+ xulrunner? ( net-libs/xulrunner:1.9 )
+ opengl? (
+ virtual/opengl
+ virtual/glu
+ )"
+
+# Use a blocker to avoid file collisions when upgrading to the slotted version
+# We cannot use slotmove, java packages are expected to be in /usr/share/PN-SLOT
+# so this is the only way to prevent collisions
+
+DEPEND=">=virtual/jdk-1.4
+ !=dev-java/swt-3.5:*3
+ app-arch/unzip
+ x11-libs/libX11
+ x11-libs/libXrender
+ x11-libs/libXt
+ x11-proto/xextproto
+ x11-proto/inputproto
+ dev-util/pkgconfig
+ ${COMMON}"
+
+RDEPEND=">=virtual/jre-1.4
+ x11-libs/libXtst
+ ${COMMON}"
+
+S="${WORKDIR}"
+
+src_unpack() {
+ local DISTFILE=${A}
+ unzip -jq "${DISTDIR}"/${DISTFILE} "*src.zip" || die "Unable to extract distfile"
+ unpack "./src.zip"
+
+ # Cleanup the redirtied directory structure
+ rm -rf about_files/ || die
+}
+
+src_prepare() {
+ # Replace the build.xml to allow compilation without Eclipse tasks
+ cp "${FILESDIR}/build.xml" "${S}/build.xml" || die "Unable to update build.xml"
+ mkdir "${S}/src" && mv "${S}/org" "${S}/src" || die "Unable to restructure SWT sources"
+
+ # Fix Makefiles to respect flags and work with --as-needed
+ epatch "${FILESDIR}"/as-needed-and-flag-fixes.patch
+}
+
+src_compile() {
+ # Drop jikes support as it seems to be unfriendly with SWT
+ java-pkg_filter-compiler jikes
+
+ local AWT_ARCH
+ local JAWTSO="libjawt.so"
+ if [[ $(tc-arch) == 'x86' ]] ; then
+ AWT_ARCH="i386"
+ elif [[ $(tc-arch) == 'ppc' ]] ; then
+ AWT_ARCH="ppc"
+ elif [[ $(tc-arch) == 'ppc64' ]] ; then
+ AWT_ARCH="ppc64"
+ else
+ AWT_ARCH="amd64"
+ fi
+ if [[ -f "${JAVA_HOME}/jre/lib/${AWT_ARCH}/${JAWTSO}" ]]; then
+ export AWT_LIB_PATH="${JAVA_HOME}/jre/lib/${AWT_ARCH}"
+ elif [[ -f "${JAVA_HOME}/jre/bin/${JAWTSO}" ]]; then
+ export AWT_LIB_PATH="${JAVA_HOME}/jre/bin"
+ elif [[ -f "${JAVA_HOME}/$(get_libdir)/${JAWTSO}" ]] ; then
+ export AWT_LIB_PATH="${JAVA_HOME}/$(get_libdir)"
+ else
+ eerror "${JAWTSO} not found in the JDK being used for compilation!"
+ die "cannot build AWT library"
+ fi
+
+ # Fix the pointer size for AMD64
+ [[ ${ARCH} == "amd64" || ${ARCH} == "ppc64" ]] && export SWT_PTR_CFLAGS=-DSWT_PTR_SIZE_64
+
+ local platform="linux"
+
+ use elibc_FreeBSD && platform="freebsd"
+
+ local make="emake -f make_${platform}.mak NO_STRIP=y CC=$(tc-getCC) CXX=$(tc-getCXX)"
+
+ einfo "Building AWT library"
+ ${make} make_awt || die "Failed to build AWT support"
+
+ einfo "Building SWT library"
+ ${make} make_swt || die "Failed to build SWT support"
+
+ einfo "Building JAVA-AT-SPI bridge"
+ ${make} make_atk || die "Failed to build ATK support"
+
+ if use gnome ; then
+ einfo "Building GNOME VFS support"
+ ${make} make_gnome || die "Failed to build GNOME VFS support"
+ fi
+
+ if use xulrunner ; then
+ einfo "Building the Mozilla component against xulrunner-1.9"
+
+ export MOZILLA_INCLUDES="$(pkg-config --cflags libxul libxul-embedding)"
+ # the -R is a workaround for bug #234934
+ export MOZILLA_LIBS="-Wl,-R$(pkg-config libxul --variable=sdkdir) $(pkg-config --libs libxul libxul-embedding)"
+
+ ${make} make_mozilla || die "Failed to build Mozilla support"
+
+ # upstream ships libswt-xulrunner*.so even though the build.sh does not
+ # build it anymore... missing this file leads to another instance
+ # of bug #234934 so we build it too
+ einfo "Building the xulrunner component against xulrunner-1.9"
+
+ export XULRUNNER_INCLUDES="${MOZILLA_INCLUDES}"
+ export XULRUNNER_LIBS="${MOZILLA_LIBS}"
+
+ ${make} make_xulrunner || die "Failed to build xulrunner support"
+
+ ${make} make_xpcominit || die "Failed to build xpcominit support"
+ fi
+
+ if use cairo ; then
+ einfo "Building CAIRO support"
+ ${make} make_cairo || die "Unable to build CAIRO support"
+ fi
+
+ if use opengl ; then
+ einfo "Building OpenGL component"
+ ${make} make_glx || die "Unable to build OpenGL component"
+ fi
+
+ einfo "Building JNI libraries"
+ eant compile
+
+ einfo "Copying missing files"
+ cp -i "${S}/version.txt" "${S}/build/version.txt"
+ cp -i "${S}/src/org/eclipse/swt/internal/SWTMessages.properties" \
+ "${S}/build/org/eclipse/swt/internal/"
+
+ einfo "Packing JNI libraries"
+ eant jar
+}
+
+src_install() {
+ swtArch=${ARCH}
+ use amd64 && swtArch=x86_64
+ use x86-fbsd && swtArch=x86
+
+ sed "s/SWT_ARCH/${swtArch}/" "${FILESDIR}/${PN}-3.5-manifest" > "MANIFEST_TMP.MF"
+ java-osgi_newjar-fromfile "swt.jar" "MANIFEST_TMP.MF" "Standard Widget Toolkit for GTK 2.0"
+
+ java-pkg_sointo /usr/$(get_libdir)
+ java-pkg_doso *.so
+
+ if use xulrunner; then
+ local gecko_dir="$(pkg-config libxul --variable=sdkdir)"
+ java-pkg_register-environment-variable MOZILLA_FIVE_HOME "${gecko_dir}"
+ fi
+
+ dohtml about.html || die
+}
+
+pkg_postinst() {
+ if use xulrunner; then
+ local gecko_dir="$(pkg-config libxul --variable=sdkdir)"
+ elog "You built swt with xulrunner support. For your custom applications please set"
+ elog "MOZILLA_FIVE_HOME environment variable to ${gecko_dir}"
+ fi
+}