diff options
author | Vlastimil Babka <caster@gentoo.org> | 2012-03-02 23:21:55 +0000 |
---|---|---|
committer | Vlastimil Babka <caster@gentoo.org> | 2012-03-02 23:21:55 +0000 |
commit | 5e200faebfab52ad52b9d8ef765938f6b8a0f4c3 (patch) | |
tree | cf7dad0a1696f954de73adc0b0cf4ae64768e34b /dev-java/icedtea-web | |
parent | Fix uninstall handling to work even after most files are removed. (diff) | |
download | gentoo-2-5e200faebfab52ad52b9d8ef765938f6b8a0f4c3.tar.gz gentoo-2-5e200faebfab52ad52b9d8ef765938f6b8a0f4c3.tar.bz2 gentoo-2-5e200faebfab52ad52b9d8ef765938f6b8a0f4c3.zip |
Revbump with upstream patch to fix plugin initialization.
(Portage version: 2.2.0_alpha89/cvs/Linux x86_64)
Diffstat (limited to 'dev-java/icedtea-web')
-rw-r--r-- | dev-java/icedtea-web/ChangeLog | 8 | ||||
-rw-r--r-- | dev-java/icedtea-web/files/fix-plugin-in-icedtea-7.patch | 388 | ||||
-rw-r--r-- | dev-java/icedtea-web/icedtea-web-1.1.4-r8.ebuild | 139 |
3 files changed, 534 insertions, 1 deletions
diff --git a/dev-java/icedtea-web/ChangeLog b/dev-java/icedtea-web/ChangeLog index d8e9cbf4124b..34ec405b5f0b 100644 --- a/dev-java/icedtea-web/ChangeLog +++ b/dev-java/icedtea-web/ChangeLog @@ -1,6 +1,12 @@ # ChangeLog for dev-java/icedtea-web # Copyright 1999-2012 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/dev-java/icedtea-web/ChangeLog,v 1.16 2012/02/13 21:19:39 caster Exp $ +# $Header: /var/cvsroot/gentoo-x86/dev-java/icedtea-web/ChangeLog,v 1.17 2012/03/02 23:21:54 caster Exp $ + +*icedtea-web-1.1.4-r8 (02 Mar 2012) + + 02 Mar 2012; Vlastimil Babka <caster@gentoo.org> + +icedtea-web-1.1.4-r8.ebuild, +files/fix-plugin-in-icedtea-7.patch: + Revbump with upstream patch to fix plugin initialization. 13 Feb 2012; Vlastimil Babka <caster@gentoo.org> -files/0001-Support-using-NPAPI-SDK-headers-instead-of-whole-xul.patch, diff --git a/dev-java/icedtea-web/files/fix-plugin-in-icedtea-7.patch b/dev-java/icedtea-web/files/fix-plugin-in-icedtea-7.patch new file mode 100644 index 000000000000..9827bcc6bd65 --- /dev/null +++ b/dev-java/icedtea-web/files/fix-plugin-in-icedtea-7.patch @@ -0,0 +1,388 @@ + +# HG changeset patch +# User Denis Lila <dlila@redhat.com> +# Date 1304110685 14400 +# Node ID 77640d74d21c2303b64bbc05583a3850db564894 +# Parent f0647c9385358b4fc3fe747ba7b95b9117c2f681 +Fix appcontext related plugin bugs. + +diff -r f0647c938535 -r 77640d74d21c netx/net/sourceforge/jnlp/Launcher.java +--- a/netx/net/sourceforge/jnlp/Launcher.java Sat Jan 07 02:48:05 2012 -0500 ++++ b/netx/net/sourceforge/jnlp/Launcher.java Fri Apr 29 16:58:05 2011 -0400 +@@ -33,7 +33,6 @@ + + import net.sourceforge.jnlp.cache.CacheUtil; + import net.sourceforge.jnlp.cache.UpdatePolicy; +-import net.sourceforge.jnlp.runtime.AppThreadGroup; + import net.sourceforge.jnlp.runtime.AppletInstance; + import net.sourceforge.jnlp.runtime.ApplicationInstance; + import net.sourceforge.jnlp.runtime.JNLPClassLoader; +@@ -707,7 +706,7 @@ + throw new ClassNotFoundException("Can't do a codebase look up and there are no jars. Failing sooner rather than later"); + } + +- AppThreadGroup group = (AppThreadGroup) Thread.currentThread().getThreadGroup(); ++ ThreadGroup group = Thread.currentThread().getThreadGroup(); + + String appletName = file.getApplet().getMainClass(); + +@@ -723,7 +722,6 @@ + else + appletInstance = new AppletInstance(file, group, loader, applet, cont); + +- group.setApplication(appletInstance); + loader.setApplication(appletInstance); + + setContextClassLoaderForAllThreads(appletInstance.getThreadGroup(), appletInstance.getClassLoader()); +@@ -770,10 +768,9 @@ + protected ApplicationInstance createApplication(JNLPFile file) throws LaunchException { + try { + JNLPClassLoader loader = JNLPClassLoader.getInstance(file, updatePolicy); +- AppThreadGroup group = (AppThreadGroup) Thread.currentThread().getThreadGroup(); ++ ThreadGroup group = Thread.currentThread().getThreadGroup(); + + ApplicationInstance app = new ApplicationInstance(file, group, loader); +- group.setApplication(app); + loader.setApplication(app); + + return app; +@@ -789,16 +786,16 @@ + * then this method simply returns the existing ThreadGroup. The applet + * ThreadGroup has to be created at an earlier point in the applet code. + */ +- protected AppThreadGroup createThreadGroup(JNLPFile file) { +- AppThreadGroup appThreadGroup = null; ++ protected ThreadGroup createThreadGroup(JNLPFile file) { ++ ThreadGroup tg = null; + + if (file instanceof PluginBridge) { +- appThreadGroup = (AppThreadGroup) Thread.currentThread().getThreadGroup(); ++ tg = Thread.currentThread().getThreadGroup(); + } else { +- appThreadGroup = new AppThreadGroup(mainGroup, file.getTitle()); ++ tg = new ThreadGroup(mainGroup, file.getTitle()); + } + +- return appThreadGroup; ++ return tg; + } + + /** +diff -r f0647c938535 -r 77640d74d21c netx/net/sourceforge/jnlp/NetxPanel.java +--- a/netx/net/sourceforge/jnlp/NetxPanel.java Sat Jan 07 02:48:05 2012 -0500 ++++ b/netx/net/sourceforge/jnlp/NetxPanel.java Fri Apr 29 16:58:05 2011 -0400 +@@ -23,12 +23,13 @@ + package net.sourceforge.jnlp; + + import net.sourceforge.jnlp.AppletLog; +-import net.sourceforge.jnlp.runtime.AppThreadGroup; + import net.sourceforge.jnlp.runtime.AppletInstance; + import net.sourceforge.jnlp.runtime.JNLPRuntime; + + import java.net.URL; + import java.util.Hashtable; ++import java.util.concurrent.ConcurrentHashMap; ++import java.util.concurrent.ConcurrentMap; + + import sun.applet.AppletViewerPanel; + import sun.awt.SunToolkit; +@@ -44,9 +45,58 @@ + private boolean exitOnFailure = true; + private AppletInstance appInst = null; + private boolean appletAlive; ++ private final String uKey; ++ ++ // We use this so that we can create exactly one thread group ++ // for all panels with the same uKey. ++ private static final ConcurrentMap<String, ThreadGroup> uKeyToTG = ++ new ConcurrentHashMap<String, ThreadGroup>(); ++ ++ // This map is actually a set (unfortunately there is no ConcurrentSet ++ // in java.util.concurrent). If KEY is in this map, then we know that ++ // an app context has been created for the panel that has uKey.equals(KEY), ++ // so we avoid creating it a second time for panels with the same uKey. ++ // Because it's a set, only the keys matter. However, we can't insert ++ // null values in because if we did, we couldn't use null checks to see ++ // if a key was absent before a putIfAbsent. ++ private static final ConcurrentMap<String, Boolean> appContextCreated = ++ new ConcurrentHashMap<String, Boolean>(); + + public NetxPanel(URL documentURL, Hashtable<String, String> atts) { + super(documentURL, atts); ++ ++ /* According to http://download.oracle.com/javase/6/docs/technotes/guides/deployment/deployment-guide/applet-compatibility.html, ++ * classloaders are shared iff these properties match: ++ * codebase, cache_archive, java_archive, archive ++ * ++ * To achieve this, we create the uniquekey based on those 4 values, ++ * always in the same order. The initial "<NAME>=" parts ensure a ++ * bad tag cannot trick the loader into getting shared with another. ++ */ ++ ++ // Firefox sometimes skips the codebase if it is default -- ".", ++ // so set it that way if absent ++ String codebaseAttr = atts.get("codebase") != null ? ++ atts.get("codebase") : "."; ++ ++ String cache_archiveAttr = atts.get("cache_archive") != null ? ++ atts.get("cache_archive") : ""; ++ ++ String java_archiveAttr = atts.get("java_archive") != null ? ++ atts.get("java_archive") : ""; ++ ++ String archiveAttr = atts.get("archive") != null ? ++ atts.get("archive") : ""; ++ ++ this.uKey = "codebase=" + codebaseAttr + ++ "cache_archive=" + cache_archiveAttr + ++ "java_archive=" + java_archiveAttr + ++ "archive=" + archiveAttr; ++ ++ // when this was being done (incorrectly) in Launcher, the call was ++ // new AppThreadGroup(mainGroup, file.getTitle()); ++ ThreadGroup tg = new ThreadGroup(Launcher.mainGroup, this.documentURL.toString()); ++ uKeyToTG.putIfAbsent(this.uKey, tg); + } + + // overloaded constructor, called when initialized via plugin +@@ -58,18 +108,6 @@ + } + + @Override +- public void run() { +- /* +- * create an AppContext for this thread associated with this particular +- * plugin instance (which runs in a different thread group from the rest +- * of the plugin). +- */ +- SunToolkit.createNewAppContext(); +- +- super.run(); +- } +- +- @Override + protected void showAppletException(Throwable t) { + /* + * Log any exceptions thrown while loading, initializing, starting, +@@ -78,7 +116,7 @@ + AppletLog.log(t); + super.showAppletException(t); + } +- ++ + //Overriding to use Netx classloader. You might need to relax visibility + //in sun.applet.AppletPanel for runLoader(). + protected void runLoader() { +@@ -90,7 +128,7 @@ + getCode(), + getWidth(), + getHeight(), +- atts); ++ atts, uKey); + + doInit = true; + dispatchAppletEvent(APPLET_LOADING, null); +@@ -154,11 +192,7 @@ + } + } + +- // when this was being done (incorrectly) in Launcher, the call was +- // new AppThreadGroup(mainGroup, file.getTitle()); +- ThreadGroup tg = new AppThreadGroup(Launcher.mainGroup, +- this.documentURL.toString()); +- handler = new Thread(tg, this); ++ handler = new Thread(getThreadGroup(), this); + handler.start(); + } + +@@ -174,4 +208,19 @@ + public boolean isAlive() { + return handler != null && handler.isAlive() && this.appletAlive; + } ++ ++ public ThreadGroup getThreadGroup() { ++ return uKeyToTG.get(uKey); ++ } ++ ++ public void createNewAppContext() { ++ if (Thread.currentThread().getThreadGroup() != getThreadGroup()) { ++ throw new RuntimeException("createNewAppContext called from the wrong thread."); ++ } ++ // only create a new context if one hasn't already been created for the ++ // applets with this unique key. ++ if (null == appContextCreated.putIfAbsent(uKey, Boolean.TRUE)) { ++ SunToolkit.createNewAppContext(); ++ } ++ } + } +diff -r f0647c938535 -r 77640d74d21c netx/net/sourceforge/jnlp/PluginBridge.java +--- a/netx/net/sourceforge/jnlp/PluginBridge.java Sat Jan 07 02:48:05 2012 -0500 ++++ b/netx/net/sourceforge/jnlp/PluginBridge.java Fri Apr 29 16:58:05 2011 -0400 +@@ -44,7 +44,8 @@ + private boolean codeBaseLookup; + + public PluginBridge(URL codebase, URL documentBase, String jar, String main, +- int width, int height, Hashtable<String, String> atts) ++ int width, int height, Hashtable<String, String> atts, ++ String uKey) + throws Exception { + specVersion = new Version("1.0"); + fileVersion = new Version("1.1"); +@@ -132,34 +133,7 @@ + else + security = null; + +- /* According to http://download.oracle.com/javase/6/docs/technotes/guides/deployment/deployment-guide/applet-compatibility.html, +- * classloaders are shared iff these properties match: +- * codebase, cache_archive, java_archive, archive +- * +- * To achieve this, we create the uniquekey based on those 4 values, +- * always in the same order. The initial "<NAME>=" parts ensure a +- * bad tag cannot trick the loader into getting shared with another. +- */ +- +- // Firefox sometimes skips the codebase if it is default -- ".", +- // so set it that way if absent +- String codebaseAttr = atts.get("codebase") != null ? +- atts.get("codebase") : "."; +- +- String cache_archiveAttr = atts.get("cache_archive") != null ? +- atts.get("cache_archive") : ""; +- +- String java_archiveAttr = atts.get("java_archive") != null ? +- atts.get("java_archive") : ""; +- +- String archiveAttr = atts.get("archive") != null ? +- atts.get("archive") : ""; +- +- this.uniqueKey = "codebase=" + codebaseAttr + +- "cache_archive=" + cache_archiveAttr + +- "java_archive=" + java_archiveAttr + +- "archive=" + archiveAttr; +- ++ this.uniqueKey = uKey; + usePack = false; + useVersion = false; + String jargs = atts.get("java_arguments"); +diff -r f0647c938535 -r 77640d74d21c netx/net/sourceforge/jnlp/runtime/AppThreadGroup.java +--- a/netx/net/sourceforge/jnlp/runtime/AppThreadGroup.java Sat Jan 07 02:48:05 2012 -0500 ++++ /dev/null Thu Jan 01 00:00:00 1970 +0000 +@@ -1,63 +0,0 @@ +-// Copyright (C) 2001-2003 Jon A. Maxwell (JAM) +-// +-// This library is free software; you can redistribute it and/or +-// modify it under the terms of the GNU Lesser General Public +-// License as published by the Free Software Foundation; either +-// version 2.1 of the License, or (at your option) any later version. +-// +-// This library 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 +-// Lesser General Public License for more details. +-// +-// You should have received a copy of the GNU Lesser General Public +-// License along with this library; if not, write to the Free Software +-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +- +-package net.sourceforge.jnlp.runtime; +- +-/** +- * Thread group for a JNLP application. +- * +- * @author <a href="mailto:jmaxwell@users.sourceforge.net">Jon A. Maxwell (JAM)</a> - initial author +- * @version $Revision: 1.1 $ +- */ +-public class AppThreadGroup extends ThreadGroup { +- +- /** the app */ +- private ApplicationInstance app = null; +- +- /** +- * Creates new JavaAppThreadGroup +- * +- * @param name of the App +- */ +- public AppThreadGroup(ThreadGroup parent, String name) { +- super(parent, name); +- } +- +- /** +- * Sets the JNLP app this group is for; can only be called once. +- */ +- public void setApplication(ApplicationInstance app) { +- if (this.app != null) +- throw new IllegalStateException("Application can only be set once"); +- +- this.app = app; +- } +- +- /** +- * Returns the JNLP app for this thread group. +- */ +- public ApplicationInstance getApplication() { +- return app; +- } +- +- /** +- * Handle uncaught exceptions for the app. +- */ +- public void uncaughtException(Thread t, Throwable e) { +- super.uncaughtException(t, e); +- } +- +-} +diff -r f0647c938535 -r 77640d74d21c plugin/icedteanp/java/sun/applet/PluginAppletViewer.java +--- a/plugin/icedteanp/java/sun/applet/PluginAppletViewer.java Sat Jan 07 02:48:05 2012 -0500 ++++ b/plugin/icedteanp/java/sun/applet/PluginAppletViewer.java Fri Apr 29 16:58:05 2011 -0400 +@@ -123,10 +123,10 @@ + class PluginAppletPanelFactory { + + public AppletPanel createPanel(PluginStreamHandler streamhandler, +- int identifier, +- long handle, int x, int y, +- final URL doc, +- final Hashtable<String, String> atts) { ++ final int identifier, ++ final long handle, int x, int y, ++ final URL doc, ++ final Hashtable<String, String> atts) { + final NetxPanel panel = AccessController.doPrivileged(new PrivilegedAction<NetxPanel>() { + public NetxPanel run() { + NetxPanel panel = new NetxPanel(doc, atts, false); +@@ -136,13 +136,29 @@ + } + }); + +- // create the frame. +- PluginAppletViewer.framePanel(identifier, handle, panel); ++ // Framing the panel needs to happen in a thread whose thread group ++ // is the same as the threadgroup of the applet thread. If this ++ // isn't the case, the awt eventqueue thread's context classloader ++ // won't be set to a JNLPClassLoader, and when an applet class needs ++ // to be loaded from the awt eventqueue, it won't be found. ++ Thread panelInit = new Thread(panel.getThreadGroup(), new Runnable() { ++ @Override public void run() { ++ panel.createNewAppContext(); ++ // create the frame. ++ PluginAppletViewer.framePanel(identifier, handle, panel); ++ panel.init(); ++ // Start the applet ++ initEventQueue(panel); ++ } ++ }, "NetXPanel initializer"); + +- panel.init(); +- +- // Start the applet +- initEventQueue(panel); ++ panelInit.start(); ++ while(panelInit.isAlive()) { ++ try { ++ panelInit.join(); ++ } catch (InterruptedException e) { ++ } ++ } + + // Wait for the panel to initialize + PluginAppletViewer.waitForAppletInit(panel); + diff --git a/dev-java/icedtea-web/icedtea-web-1.1.4-r8.ebuild b/dev-java/icedtea-web/icedtea-web-1.1.4-r8.ebuild new file mode 100644 index 000000000000..789215e5752d --- /dev/null +++ b/dev-java/icedtea-web/icedtea-web-1.1.4-r8.ebuild @@ -0,0 +1,139 @@ +# Copyright 1999-2012 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/dev-java/icedtea-web/icedtea-web-1.1.4-r8.ebuild,v 1.1 2012/03/02 23:21:55 caster Exp $ +# Build written by Andrew John Hughes (ahughes@redhat.com) + +EAPI="4" + +inherit autotools eutils java-pkg-2 java-vm-2 + +DESCRIPTION="FOSS Java browser plugin and Web Start implementation" +HOMEPAGE="http://icedtea.classpath.org" +SRC_URI="http://icedtea.classpath.org/download/source/${P}.tar.gz" + +LICENSE="GPL-2 GPL-2-with-linking-exception LGPL-2" +SLOT="7" +KEYWORDS="~amd64 ~x86" + +IUSE="build doc javascript +nsplugin test" + +RDEPEND="dev-java/icedtea:${SLOT}" +# Need system junit 4.8+. Bug #389795 +DEPEND="${RDEPEND} + javascript? ( dev-java/rhino:1.6 ) + nsplugin? ( + || ( net-misc/npapi-sdk + >=net-libs/xulrunner-1.9.1 ) ) + test? ( >=dev-java/junit-4.8:4 )" + +# a bit of hack so the VM switching is triggered without causing dependency troubles +JAVA_PKG_NV_DEPEND=">=virtual/jdk-1.6" +JAVA_PKG_WANT_SOURCE="1.6" +JAVA_PKG_WANT_TARGET="1.6" + +pkg_setup() { + [[ "${MERGE_TYPE}" == "binary" ]] && return # bug 258423 + + # quite a hack since java-config does not provide a way for a package + # to limit supported VM's for building and their preferred order + if [[ -n "${JAVA_PKG_FORCE_VM}" ]]; then + einfo "Honoring user-set JAVA_PKG_FORCE_VM" + else + # migration logic + if [[ -L /usr/lib/jvm/icedtea${SLOT} ]]; then + JAVA_PKG_FORCE_VM="icedtea${SLOT}" + else + JAVA_PKG_FORCE_VM="icedtea-${SLOT}" + fi + fi + + einfo "Forced vm ${JAVA_PKG_FORCE_VM}" + java-vm-2_pkg_setup + java-pkg-2_pkg_setup +} + +unset_vars() { + unset JAVA_HOME JDK_HOME CLASSPATH JAVAC JAVACFLAGS +} + +src_prepare() { + # bug #356645 + epatch "${FILESDIR}"/0002-Respect-LDFLAGS.patch + # this should be included in next release, plugin doesn't work without it + epatch "${FILESDIR}"/fix-plugin-in-icedtea-7.patch + eautoreconf +} + +src_configure() { + local vmhome=$(java-config -O) + + if use build; then + icedteadir="${ICEDTEA_BIN_DIR}" + [[ -z ${icedteadir} ]] && die "USE=build is an internal flag and should not be enabled" + installdir="/opt/icedtea-web-bin-${SLOT}" + else + icedteadir="/usr/$(get_libdir)/icedtea${SLOT}" + installdir="/usr/$(get_libdir)/icedtea${SLOT}-web" + fi + + unset_vars + + if use build || [[ ${vmhome} == ${icedteadir} ]] ; then + VMHANDLE="icedtea-${SLOT}" + else + die "Unexpected install location of IcedTea${SLOT}" + fi + + einfo "Installing IcedTea-Web in ${installdir}" + einfo "Installing IcedTea-Web for Icedtea${SLOT} in ${icedteadir}" + if [ ! -e ${vmhome} ] ; then + eerror "Could not find JDK install directory ${vmhome}." + die + fi + + # we need to override all *dir variables that econf sets + # man page (javaws) is installed directly to icedteadir because it's easier than symlinking, as we don't know + # the suffix the man page will end up compressed with, anyway + econf \ + --prefix=${installdir} --mandir=${icedteadir}/man --infodir=${installdir}/share/info --datadir=${installdir}/share \ + --with-jdk-home=${icedteadir} \ + $(use_enable doc docs) \ + $(use_enable nsplugin plugin) \ + $(use_with javascript rhino) +} + +src_compile() { + # we need this to override the src_compile from java-pkg-2 + default +} + +src_install() { + # parallel make problem bug #372235 + emake -j1 DESTDIR="${D}" install + dodoc AUTHORS README NEWS + + if use nsplugin; then + install_mozilla_plugin "${installdir}/$(get_libdir)/IcedTeaPlugin.so"; + fi + + for binary in javaws itweb-settings; do + dosym ${installdir}/bin/${binary} ${icedteadir}/bin/${binary} + dosym ${installdir}/bin/${binary} ${icedteadir}/jre/bin/${binary} + done +} + +pkg_postinst() { + java-vm_check-nsplugin + java_mozilla_clean_ + + if use nsplugin; then + elog "The icedtea browser plugin (NPPlugin) can be enabled using eselect java-nsplugin" + elog "Note that the plugin works only in browsers based on xulrunner-1.9.1 or later" + elog "such as Firefox 3.5+, Chromium and perhaps some others too." + fi +} + +pkg_prerm() { + # override the java-vm-2 eclass check for removing a system VM, as it doesn't make sense here + :; +} |