aboutsummaryrefslogtreecommitdiffstats
path: root/java
diff options
context:
space:
mode:
authorjkim <jkim@FreeBSD.org>2010-09-24 05:54:01 +0800
committerjkim <jkim@FreeBSD.org>2010-09-24 05:54:01 +0800
commit937d1133809fd921bd5d52bf0dcaf14c8b0fd682 (patch)
tree8115ab8e9f13d7265d0993a8e0abfe0d10222c11 /java
parent963325f2b45393bfc2b53e54513d606915064619 (diff)
downloadfreebsd-ports-gnome-937d1133809fd921bd5d52bf0dcaf14c8b0fd682.tar.gz
freebsd-ports-gnome-937d1133809fd921bd5d52bf0dcaf14c8b0fd682.tar.zst
freebsd-ports-gnome-937d1133809fd921bd5d52bf0dcaf14c8b0fd682.zip
- Rewrite IcedTea6 plugin patch to improve stability of initialization/shutdown
process. Update comments in the patch accordingly. - Tidy up makefile for the plugin. Remove a hack for include path of libxul, which is correctly patched from libxul 1.9.2.9_1. Remove mozilla-plugin.pc from linker options for pkg-config. Generally speaking, NPAPI plugins do not need to link with Gecko engine directly. - Move run-time dependencies for the plugin to build-time dependencies as it is completely optional any way.
Diffstat (limited to 'java')
-rw-r--r--java/openjdk6/Makefile9
-rw-r--r--java/openjdk6/files/Makefile.plugin15
-rw-r--r--java/openjdk6/files/icedtea.patch83
3 files changed, 65 insertions, 42 deletions
diff --git a/java/openjdk6/Makefile b/java/openjdk6/Makefile
index 7a5a824bbccf..20e88bc5447d 100644
--- a/java/openjdk6/Makefile
+++ b/java/openjdk6/Makefile
@@ -7,7 +7,7 @@
PORTNAME= openjdk6
PORTVERSION= b20
-PORTREVISION= 2
+PORTREVISION= 3
CATEGORIES= java devel
MASTER_SITES= http://download.java.net/openjdk/jdk6/promoted/${PORTVERSION}/ \
https://jaxp.dev.java.net/files/documents/913/150648/:jaxp \
@@ -52,7 +52,6 @@ OPTIONS= DEBUG "Enable legacy debugging support" off \
# java extracts directly to the cwd
WRKSRC= ${WRKDIR}
-WANT_GNOME= yes
USE_GMAKE= yes
USE_MOTIF= yes
USE_XORG= xtst xi xt x11
@@ -149,8 +148,10 @@ OPENJDK_OSARCH= bsd-${ARCH:S/i386/i586/}
DISTFILES+= ${ICEDTEAFILE}:icedtea
EXTRACT_ONLY+= ${ICEDTEAFILE}
EXTRA_PATCHES+= ${FILESDIR}/icedtea.patch ${FILESDIR}/plugin.patch
-USE_GECKO= libxul
-USE_GNOME= glib20 gtk20
+BUILD_DEPENDS+= ${LOCALBASE}/bin/pkg-config:${PORTSDIR}/devel/pkg-config \
+ ${LOCALBASE}/libdata/pkgconfig/glib-2.0.pc:${PORTSDIR}/devel/glib20 \
+ ${LOCALBASE}/libdata/pkgconfig/gtk+-2.0.pc:${PORTSDIR}/x11-toolkits/gtk20 \
+ ${LOCALBASE}/libdata/pkgconfig/mozilla-plugin.pc:${PORTSDIR}/www/libxul
ICEDTEADIR= ${WRKDIR}/icedtea6-${ICEDTEAVERSION}
ICEDTEA_JAVAC= ${WRKSRC}/build/${OPENJDK_OSARCH}/j2sdk-image/bin/javac
ICEDTEA_JAR= ${WRKSRC}/build/${OPENJDK_OSARCH}/j2sdk-image/bin/jar
diff --git a/java/openjdk6/files/Makefile.plugin b/java/openjdk6/files/Makefile.plugin
index b79a58c722d2..be3f8994866e 100644
--- a/java/openjdk6/files/Makefile.plugin
+++ b/java/openjdk6/files/Makefile.plugin
@@ -33,19 +33,18 @@ STRIP= -s
.error "PLUGIN_VERSION not defined"
.endif
-MOZILLA_PKGS= glib-2.0 gtk+-2.0 mozilla-plugin
MOZILLA_VERSION!=${LOCALBASE}/bin/pkg-config --modversion mozilla-plugin
MOZILLA_VERSION2!=/usr/bin/printf "%d%02d%02d%02d" ${MOZILLA_VERSION:C/\./ /g}
-PLUGIN_CFLAGS!= ${LOCALBASE}/bin/pkg-config --cflags ${MOZILLA_PKGS}
-PLUGIN_LIBS!= ${LOCALBASE}/bin/pkg-config --libs ${MOZILLA_PKGS}
+
+PLUGIN_PKG_INC= glib-2.0 gtk+-2.0 mozilla-plugin
+PLUGIN_PKG_LIB= glib-2.0 gtk+-2.0
+PLUGIN_CFLAGS!= ${LOCALBASE}/bin/pkg-config --cflags ${PLUGIN_PKG_INC}
+PLUGIN_LIBS!= ${LOCALBASE}/bin/pkg-config --libs ${PLUGIN_PKG_LIB}
CFLAGS+= -DJDK_UPDATE_VERSION="\"${JDK_UPDATE_VERSION}\"" \
-DPLUGIN_VERSION="\"${PLUGIN_VERSION}\"" \
- -DMOZILLA_VERSION_COLLAPSED="${MOZILLA_VERSION2}"
-
-# XXX Need to fix in ports.
-CFLAGS+= ${PLUGIN_CFLAGS:S,/libxul/stable,/libxul,}
-
+ -DMOZILLA_VERSION_COLLAPSED="${MOZILLA_VERSION2}" \
+ ${PLUGIN_CFLAGS}
LDFLAGS+= ${PLUGIN_LIBS}
.include <bsd.lib.mk>
diff --git a/java/openjdk6/files/icedtea.patch b/java/openjdk6/files/icedtea.patch
index a69d7551c863..e16d7ef75892 100644
--- a/java/openjdk6/files/icedtea.patch
+++ b/java/openjdk6/files/icedtea.patch
@@ -1,70 +1,93 @@
$FreeBSD$
-This patch works around POSIX thread anomalies in the IcedTea6 plugin.
-Somehow Linux can use mutexes and condition variables uninitialized.
+This patch works around POSIX thread implementation differences between
+FreeBSD's libthr and Linux's NPTL:
---- icedtea6-1.9/plugin/icedteanp/IcedTeaNPPlugin.cc.orig 2010-08-06 07:05:21.916103000 -0400
-+++ icedtea6-1.9/plugin/icedteanp/IcedTeaNPPlugin.cc 2010-09-13 12:39:38.000000000 -0400
-@@ -237,6 +237,7 @@ static guint appletviewer_watch_id = -1;
- int plugin_debug = getenv ("ICEDTEAPLUGIN_DEBUG") != NULL;
-
- pthread_cond_t cond_message_available = PTHREAD_COND_INITIALIZER;
-+pthread_mutex_t wait_mutex = PTHREAD_MUTEX_INITIALIZER;
-
- // Functions prefixed by ITNP_ are instance functions. They are called
- // by the browser and operate on instances of ITNPPluginData.
---- icedtea6-1.9/plugin/icedteanp/IcedTeaNPPlugin.h.orig 2010-08-06 07:05:21.942208000 -0400
-+++ icedtea6-1.9/plugin/icedteanp/IcedTeaNPPlugin.h 2010-09-13 12:39:13.000000000 -0400
-@@ -94,6 +94,7 @@ static pthread_t plugin_request_processo
-
- // Condition on which the queue processor waits
- extern pthread_cond_t cond_message_available;
-+extern pthread_mutex_t wait_mutex;
+- We do not support static allocations of mutex and condition variable.
+Thus, we must initialize them explicitly with pthread_mutex_init(3) and
+pthread_cond_init(3), respectively.
+
+- We must initialize mutex before calling pthread_cond_wait(3). Otherwise,
+it fails with EINVAL.
+
+- We must lock mutex before calling pthread_cond_wait(3). Otherwise, it
+fails with EPERM.
+
+- We must join threads via pthread_join(3) after calling pthread_cancel(3).
+Otherwise, we may destroy mutex or condition variable in use.
+
+--- icedtea6-1.9/plugin/icedteanp/IcedTeaNPPlugin.cc.orig 2010-09-23 09:40:49.000000000 -0400
++++ icedtea6-1.9/plugin/icedteanp/IcedTeaNPPlugin.cc 2010-09-23 15:31:27.000000000 -0400
+@@ -2369,6 +2369,10 @@ NP_Shutdown (void)
+ pthread_cancel(plugin_request_processor_thread2);
+ pthread_cancel(plugin_request_processor_thread3);
- // debug switch
- extern int plugin_debug;
---- icedtea6-1.9/plugin/icedteanp/IcedTeaPluginRequestProcessor.cc.orig 2010-08-06 07:05:21.996828000 -0400
-+++ icedtea6-1.9/plugin/icedteanp/IcedTeaPluginRequestProcessor.cc 2010-09-13 12:55:28.000000000 -0400
-@@ -63,6 +63,11 @@ PluginRequestProcessor::PluginRequestPro
++ pthread_join(plugin_request_processor_thread1, NULL);
++ pthread_join(plugin_request_processor_thread2, NULL);
++ pthread_join(plugin_request_processor_thread3, NULL);
++
+ java_to_plugin_bus->unSubscribe(plugin_req_proc);
+ plugin_to_java_bus->unSubscribe(java_req_proc);
+ //internal_bus->unSubscribe(java_req_proc);
+--- icedtea6-1.9/plugin/icedteanp/IcedTeaPluginRequestProcessor.cc.orig 2010-09-23 09:40:49.000000000 -0400
++++ icedtea6-1.9/plugin/icedteanp/IcedTeaPluginRequestProcessor.cc 2010-09-23 15:36:38.000000000 -0400
+@@ -63,6 +63,12 @@ PluginRequestProcessor::PluginRequestPro
this->pendingRequests = new std::map<pthread_t, uintmax_t>();
internal_req_ref_counter = 0;
++
+ pthread_mutex_init(&message_queue_mutex, NULL);
+ pthread_mutex_init(&syn_write_mutex, NULL);
+ pthread_mutex_init(&tc_mutex, NULL);
-+ pthread_mutex_init(&wait_mutex, NULL);
++
+ pthread_cond_init(&cond_message_available, NULL);
}
/**
-@@ -77,6 +82,11 @@ PluginRequestProcessor::~PluginRequestPr
+@@ -77,6 +83,12 @@ PluginRequestProcessor::~PluginRequestPr
if (pendingRequests)
delete pendingRequests;
++
+ pthread_mutex_destroy(&message_queue_mutex);
+ pthread_mutex_destroy(&syn_write_mutex);
+ pthread_mutex_destroy(&tc_mutex);
-+ pthread_mutex_destroy(&wait_mutex);
++
+ pthread_cond_destroy(&cond_message_available);
}
/**
-@@ -709,7 +719,6 @@ queue_processor(void* data)
+@@ -709,10 +721,12 @@ queue_processor(void* data)
PluginRequestProcessor* processor = (PluginRequestProcessor*) data;
std::vector<std::string*>* message_parts = NULL;
std::string command;
- pthread_mutex_t wait_mutex = PTHREAD_MUTEX_INITIALIZER; // This is needed for API compat. and is unused
++ pthread_mutex_t wait_mutex = PTHREAD_MUTEX_INITIALIZER;
PLUGIN_DEBUG("Queue processor initialized. Queue = %p\n", message_queue);
-@@ -780,7 +789,9 @@ queue_processor(void* data)
++ pthread_mutex_init(&wait_mutex, NULL);
++
+ while (true)
+ {
+ pthread_mutex_lock(&message_queue_mutex);
+@@ -780,13 +794,17 @@ queue_processor(void* data)
} else
{
- pthread_cond_wait(&cond_message_available, &wait_mutex);
+- pthread_testcancel();
+ pthread_mutex_lock(&wait_mutex);
+ pthread_cond_wait(&cond_message_available, &wait_mutex);
+ pthread_mutex_unlock(&wait_mutex);
- pthread_testcancel();
++ pthread_testcancel();
}
+ message_parts = NULL;
+ }
+
++ pthread_mutex_destroy(&wait_mutex);
++
+ PLUGIN_DEBUG("Queue processing stopped.\n");
+ }
+