From 066a856e1f294f10c2e2816ae7f09211be7a051e Mon Sep 17 00:00:00 2001 From: Eric Hameleers Date: Sat, 25 Feb 2012 23:44:07 +0000 Subject: Initial revision --- icedtea-web/build/icedtea-web_ff10crash.patch | 333 ++++++++++++++++++++++++++ openjdk/build/create_gcj_jvm.sh | 95 ++++++++ openjdk/build/fix_seamonkey_pkgconfig.sh | 48 ++++ 3 files changed, 476 insertions(+) create mode 100644 icedtea-web/build/icedtea-web_ff10crash.patch create mode 100644 openjdk/build/create_gcj_jvm.sh create mode 100644 openjdk/build/fix_seamonkey_pkgconfig.sh diff --git a/icedtea-web/build/icedtea-web_ff10crash.patch b/icedtea-web/build/icedtea-web_ff10crash.patch new file mode 100644 index 00000000..16e76ca9 --- /dev/null +++ b/icedtea-web/build/icedtea-web_ff10crash.patch @@ -0,0 +1,333 @@ +diff -r 360bd0a75304 plugin/icedteanp/IcedTeaJavaRequestProcessor.cc +--- a/plugin/icedteanp/IcedTeaJavaRequestProcessor.cc Mon Jan 09 18:45:31 2012 -0500 ++++ b/plugin/icedteanp/IcedTeaJavaRequestProcessor.cc Fri Feb 17 18:24:39 2012 -0500 +@@ -921,6 +921,7 @@ + { + PLUGIN_DEBUG("NPObject is not a Java object\n"); + NPIdentifier length_id = browser_functions.getstringidentifier("length"); ++ bool isJSObjectArray = false; + + // FIXME: We currently only handle <= 2 dim arrays. Do we really need more though? + +@@ -936,7 +937,7 @@ + std::string length_str = std::string(); + IcedTeaPluginUtilities::itoa(NPVARIANT_TO_INT32(length), &length_str); + +- if (NPVARIANT_TO_INT32(length) > 0) ++ if (NPVARIANT_TO_INT32(length) >= 0) + { + NPIdentifier id_0 = browser_functions.getintidentifier(0); + NPVariant first_element = NPVariant(); +@@ -956,8 +957,14 @@ + { + getArrayTypeForJava(instance, first_element, &java_array_type); + } +- } else +- java_array_type.append("jsobject"); ++ } ++ ++ // For JSObject arrays, we create a regular object (accessible via JSObject.getSlot()) ++ if (NPVARIANT_TO_INT32(length) < 0 || !java_array_type.compare("jsobject")) ++ { ++ isJSObjectArray = true; ++ goto createRegularObject; ++ } + + java_result = java_request.newArray(java_array_type, length_str); + +@@ -995,7 +1002,10 @@ + + // Got here => no errors above. We're good to return! + return; +- } else // Else it is not an array ++ } ++ ++ createRegularObject: ++ if (!IcedTeaPluginUtilities::isObjectJSArray(instance, obj) || isJSObjectArray) // Else it is not an array + { + + NPVariant* variant_copy = new NPVariant(); +diff -r 360bd0a75304 plugin/icedteanp/IcedTeaPluginRequestProcessor.cc +--- a/plugin/icedteanp/IcedTeaPluginRequestProcessor.cc Mon Jan 09 18:45:31 2012 -0500 ++++ b/plugin/icedteanp/IcedTeaPluginRequestProcessor.cc Fri Feb 17 18:24:39 2012 -0500 +@@ -123,6 +123,12 @@ + // returns immediately, so we do it in the same thread. + this->sendWindow(message_parts); + return true; ++ } else if (!command->find("Finalize")) ++ { ++ // Object can be finalized from the main thread only. And this ++ // call returns immediately, so we do it in the same thread. ++ this->finalize(message_parts); ++ return true; + } else if (!command->find("GetMember") || + !command->find("SetMember") || + !command->find("ToString") || +@@ -130,7 +136,6 @@ + !command->find("GetSlot") || + !command->find("SetSlot") || + !command->find("Eval") || +- !command->find("Finalize") || + !command->find("LoadURL")) + { + +@@ -241,19 +246,9 @@ + + IcedTeaPluginUtilities::callAndWaitForResult(instance, &_eval, &thread_data); + +- NPVariant* result_variant = (NPVariant*) IcedTeaPluginUtilities::stringToJSID(thread_data.result); +- std::string result_variant_jniid = std::string(); +- if (result_variant) +- { +- createJavaObjectFromVariant(instance, *result_variant, &result_variant_jniid); +- } else +- { +- result_variant_jniid = "0"; +- } +- + IcedTeaPluginUtilities::constructMessagePrefix(0, reference, &response); + response += " JavaScriptEval "; +- response += result_variant_jniid; ++ response += thread_data.result; + + plugin_to_java_bus->post(response.c_str()); + } +@@ -336,19 +331,9 @@ + + IcedTeaPluginUtilities::callAndWaitForResult(instance, &_call, &thread_data); + +- result_variant = (NPVariant*) IcedTeaPluginUtilities::stringToJSID(thread_data.result); +- +- if (result_variant) +- { +- createJavaObjectFromVariant(instance, *result_variant, &result_variant_jniid); +- } else +- { +- result_variant_jniid = "0"; +- } +- + IcedTeaPluginUtilities::constructMessagePrefix(0, reference, &response); + response += " JavaScriptCall "; +- response += result_variant_jniid; ++ response += thread_data.result; + + plugin_to_java_bus->post(response.c_str()); + +@@ -415,7 +400,8 @@ + + NPP instance; + NPVariant* member; +- NPIdentifier property_identifier; ++ std::string property_id = std::string(); ++ bool int_identifier; + + JavaRequestProcessor java_request = JavaRequestProcessor(); + JavaResultData* java_result; +@@ -445,7 +431,8 @@ + + if (*(message_parts->at(4)) == "SetSlot") + { +- property_identifier = browser_functions.getintidentifier(atoi(message_parts->at(6)->c_str())); ++ property_id.append(*(message_parts->at(6))); ++ int_identifier = true; + } else + { + java_result = java_request.getString(propertyNameID); +@@ -457,7 +444,8 @@ + //goto cleanup; + } + +- property_identifier = browser_functions.getstringidentifier(java_result->return_string->c_str()); ++ property_id.append(*(java_result->return_string)); ++ int_identifier = false; + } + + AsyncCallThreadData thread_data = AsyncCallThreadData(); +@@ -467,8 +455,9 @@ + + thread_data.parameters.push_back(instance); + thread_data.parameters.push_back(NPVARIANT_TO_OBJECT(*member)); +- thread_data.parameters.push_back(&property_identifier); ++ thread_data.parameters.push_back(&property_id); + thread_data.parameters.push_back(&value); ++ thread_data.parameters.push_back(&int_identifier); + + IcedTeaPluginUtilities::callAndWaitForResult(instance, &_setMember, &thread_data); + +@@ -508,6 +497,7 @@ + int method_id; + int instance_id; + int reference; ++ bool int_identifier; + + // debug printout of parent thread data + IcedTeaPluginUtilities::printStringPtrVector("PluginRequestProcessor::getMember:", message_parts); +@@ -522,7 +512,7 @@ + /** Request data from Java if necessary **/ + if (*(message_parts->at(4)) == "GetSlot") + { +- member_identifier = browser_functions.getintidentifier(atoi(member_id.c_str())); ++ int_identifier=true; + } else + { + // make a new request for getString, to get the name of the identifier +@@ -535,7 +525,8 @@ + //goto cleanup; + } + +- member_identifier = browser_functions.getstringidentifier(java_result->return_string->c_str()); ++ member_id.assign(*(java_result->return_string)); ++ int_identifier=false; + } + + AsyncCallThreadData thread_data = AsyncCallThreadData(); +@@ -551,16 +542,11 @@ + + thread_data.parameters.push_back(instance); + thread_data.parameters.push_back(NPVARIANT_TO_OBJECT(*parent_ptr)); +- thread_data.parameters.push_back(&member_identifier); ++ thread_data.parameters.push_back(&member_id); ++ thread_data.parameters.push_back(&int_identifier); + + IcedTeaPluginUtilities::callAndWaitForResult(instance, &_getMember, &thread_data); + +- PLUGIN_DEBUG("Member PTR after internal request: %s\n", thread_data.result.c_str()); +- +- member_ptr = (NPVariant*) IcedTeaPluginUtilities::stringToJSID(thread_data.result); +- +- createJavaObjectFromVariant(instance, *member_ptr, &result_id); +- + IcedTeaPluginUtilities::constructMessagePrefix(0, reference, &response); + if (*(message_parts->at(4)) == "GetSlot") + { +@@ -568,7 +554,7 @@ + } else { + response.append(" JavaScriptGetMember "); + } +- response.append(result_id.c_str()); ++ response.append(thread_data.result); + plugin_to_java_bus->post(response.c_str()); + } + +@@ -768,19 +754,26 @@ + NPP instance; + NPVariant value_variant = NPVariant(); + NPObject* member; +- NPIdentifier* property; ++ NPIdentifier property_identifier; ++ + + std::vector parameters = ((AsyncCallThreadData*) data)->parameters; + instance = (NPP) parameters.at(0); + member = (NPObject*) parameters.at(1); +- property = (NPIdentifier*) parameters.at(2); ++ std::string* property_id = (std::string*) parameters.at(2); + value = (std::string*) parameters.at(3); ++ bool* int_identifier = (bool*) parameters.at(4); + +- PLUGIN_DEBUG("Setting %s on instance %p, object %p to value %s\n", browser_functions.utf8fromidentifier(*property), instance, member, value->c_str()); ++ if(*int_identifier==true) ++ property_identifier = browser_functions.getintidentifier(atoi(property_id->c_str())); ++ else ++ property_identifier = browser_functions.getstringidentifier(property_id->c_str()); ++ ++ PLUGIN_DEBUG("Setting %s on instance %p, object %p to value %s\n", browser_functions.utf8fromidentifier(property_identifier), instance, member, value->c_str()); + + IcedTeaPluginUtilities::javaResultToNPVariant(instance, value, &value_variant); + +- ((AsyncCallThreadData*) data)->call_successful = browser_functions.setproperty(instance, member, *property, &value_variant); ++ ((AsyncCallThreadData*) data)->call_successful = browser_functions.setproperty(instance, member, property_identifier, &value_variant); + + ((AsyncCallThreadData*) data)->result_ready = true; + } +@@ -797,23 +790,32 @@ + + instance = (NPP) parameters.at(0); + parent_ptr = (NPObject*) parameters.at(1); +- NPIdentifier* member_identifier = (NPIdentifier*) parameters.at(2); ++ std::string* member_id = (std::string*) parameters.at(2); ++ NPIdentifier member_identifier; ++ ++ bool* int_identifier = (bool*) parameters.at(3); ++ ++ if(*int_identifier==true) ++ member_identifier = browser_functions.getintidentifier(atoi(member_id->c_str())); ++ else ++ member_identifier = browser_functions.getstringidentifier(member_id->c_str()); + + // Get the NPVariant corresponding to this member +- PLUGIN_DEBUG("Looking for %p %p %p (%s)\n", instance, parent_ptr, member_identifier, browser_functions.utf8fromidentifier(*member_identifier)); ++ PLUGIN_DEBUG("Looking for %p %p %p (%s)\n", instance, parent_ptr, member_identifier, browser_functions.utf8fromidentifier(member_identifier)); + +- if (!browser_functions.hasproperty(instance, parent_ptr, *member_identifier)) ++ if (!browser_functions.hasproperty(instance, parent_ptr, member_identifier)) + { +- printf("%s not found!\n", browser_functions.utf8fromidentifier(*member_identifier)); ++ printf("%s not found!\n", browser_functions.utf8fromidentifier(member_identifier)); + } +- ((AsyncCallThreadData*) data)->call_successful = browser_functions.getproperty(instance, parent_ptr, *member_identifier, member_ptr); ++ ((AsyncCallThreadData*) data)->call_successful = browser_functions.getproperty(instance, parent_ptr, member_identifier, member_ptr); + + IcedTeaPluginUtilities::printNPVariant(*member_ptr); + + if (((AsyncCallThreadData*) data)->call_successful) + { +- IcedTeaPluginUtilities::JSIDToString(member_ptr, &member_ptr_str); ++ createJavaObjectFromVariant(instance, *member_ptr, &member_ptr_str); + ((AsyncCallThreadData*) data)->result.append(member_ptr_str); ++ + } + ((AsyncCallThreadData*) data)->result_ready = true; + +@@ -831,8 +833,8 @@ + std::string* script_str; + NPIdentifier script_identifier; + NPString script = NPString(); +- NPVariant* eval_result = new NPVariant(); +- std::string eval_result_ptr_str = std::string(); ++ NPVariant* eval_variant = new NPVariant(); ++ std::string eval_variant_str = std::string(); + + PLUGIN_DEBUG("_eval called\n"); + +@@ -854,13 +856,19 @@ + PLUGIN_DEBUG("Evaluating: %s\n", script.UTF8Characters); + #endif + +- ((AsyncCallThreadData*) data)->call_successful = browser_functions.evaluate(instance, window_ptr, &script, eval_result); +- IcedTeaPluginUtilities::printNPVariant(*eval_result); ++ ((AsyncCallThreadData*) data)->call_successful = browser_functions.evaluate(instance, window_ptr, &script, eval_variant); ++ IcedTeaPluginUtilities::printNPVariant(*eval_variant); + + if (((AsyncCallThreadData*) data)->call_successful) + { +- IcedTeaPluginUtilities::JSIDToString(eval_result, &eval_result_ptr_str); +- ((AsyncCallThreadData*) data)->result.append(eval_result_ptr_str); ++ if (eval_variant) ++ { ++ createJavaObjectFromVariant(instance, *eval_variant, &eval_variant_str); ++ } else ++ { ++ eval_variant_str = "0"; ++ } ++ ((AsyncCallThreadData*) data)->result.append(eval_variant_str); + } + ((AsyncCallThreadData*) data)->result_ready = true; + +@@ -904,7 +912,15 @@ + + if (((AsyncCallThreadData*) data)->call_successful) + { +- IcedTeaPluginUtilities::JSIDToString(call_result, &call_result_ptr_str); ++ ++ if (call_result) ++ { ++ createJavaObjectFromVariant(instance, *call_result, &call_result_ptr_str); ++ } else ++ { ++ call_result_ptr_str = "0"; ++ } ++ + ((AsyncCallThreadData*) data)->result.append(call_result_ptr_str); + } + diff --git a/openjdk/build/create_gcj_jvm.sh b/openjdk/build/create_gcj_jvm.sh new file mode 100644 index 00000000..08f3e4a7 --- /dev/null +++ b/openjdk/build/create_gcj_jvm.sh @@ -0,0 +1,95 @@ +#!/bin/bash + +# --------------------------------------------------------------------------- +# This script creates a directory structure below /usr/lib/jvm and populates +# it with symlinks to GCC binaries. +# This will work as a compatibility layer to emulate an Oracle JDK/JRE. +# This emulation is required in order to compile OpenJDK using GNU java. +# +# The same can automatically be achieved in Slackware's gcc packages if +# the 'configure' command is called with the following additional parameters: +# --enable-java-home \ +# --with-java-home=/usr/lib$LIBDIRSUFFIX/jvm/jre \ +# --with-jvm-root-dir=/usr/lib$LIBDIRSUFFIX/jvm \ +# --with-jvm-jar-dir=/usr/lib$LIBDIRSUFFIX/jvm/jvm-exports \ +# --with-arch-directory=$LIB_ARCH \ +# +# Author: Eric Hameleers December 2011 +# --------------------------------------------------------------------------- + +# Automatically determine the architecture we're building on: +if [ -z "$ARCH" ]; then + case "$( uname -m )" in + i?86) export ARCH=i486 ;; + arm*) export ARCH=arm ;; + # Unless $ARCH is already set, use uname -m for all other archs: + *) export ARCH=$( uname -m ) ;; + esac +fi + +if [ "$ARCH" = "i486" ]; then + SLKCFLAGS="-O2 -march=i486 -mtune=i686" + LIBDIRSUFFIX="" + LIB_ARCH=i386 +elif [ "$ARCH" = "i686" ]; then + SLKCFLAGS="-O2 -march=i686 -mtune=i686" + LIBDIRSUFFIX="" + LIB_ARCH=i386 +elif [ "$ARCH" = "x86_64" ]; then + SLKCFLAGS="-O2 -fPIC" + LIBDIRSUFFIX="64" + LIB_ARCH=amd64 +else + SLKCFLAGS="-O2" + LIBDIRSUFFIX="" + LIB_ARCH=$ARCH +fi + +# Where does the OpenJDK SlackBuild expect the GNU java compatibility symlinks: +JVM=${1:-/usr/lib${LIBDIRSUFFIX}/jvm} +BINDIR=/usr/bin + +# What version of GCC do we have installed: +GCJVER=$(gcj -dumpversion) + +# First, remove the old set of symlinks if they should exist: +rm -fr $JVM + +# Create a JDK compatible directory structure for GNU java: +mkdir -p $JVM +mkdir -p $JVM/bin +mkdir -p $JVM/jre/bin +mkdir -p $JVM/jre/lib/${LIB_ARCH}/client +mkdir -p $JVM/jre/lib/${LIB_ARCH}/server +mkdir -p $JVM/lib + +ln -sf $BINDIR/gjar $JVM/bin/jar +ln -sf $BINDIR/grmic $JVM/bin/rmic +ln -sf $BINDIR/gjavah $JVM/bin/javah +ln -sf $BINDIR/jcf-dump $JVM/bin/javap +ln -sf $BINDIR/gappletviewer $JVM/bin/appletviewer +ln -sf $BINDIR/grmiregistry $JVM/bin/rmiregistry +ln -sf $BINDIR/grmiregistry $JVM/jre/bin/rmiregistry +ln -sf $BINDIR/gkeytool $JVM/bin/keytool +ln -sf $BINDIR/gkeytool $JVM/jre/bin/keytool +ln -sf $BINDIR/gij $JVM/bin/java +ln -sf $BINDIR/ecj $JVM/bin/javac +ln -sf /usr/lib/gcj-${GCJVER}-11/libjvm.so $JVM/jre/lib/${LIB_ARCH}/client/libjvm.so +ln -sf /usr/lib/gcj-${GCJVER}-11/libjvm.so $JVM/jre/lib/${LIB_ARCH}/server/libjvm.so +ln -sf /usr/lib/gcj-${GCJVER}-11/libjawt.so $JVM/jre/lib/${LIB_ARCH}/libjawt.so +ln -sf /usr/share/java/libgcj-${GCJVER}.jar $JVM/jre/lib/rt.jar +ln -sf /usr/share/java/libgcj-tools-${GCJVER}.jar $JVM/lib/tools.jar +ln -sf /usr/include/c++/${GCJVER}/gnu/java $JVM/include + +# Add a Eclipse Java Compiler wrapper which is required +# for bootstrapping OpenJDK using GNU java: +cat < /usr/bin/ecj +#!/bin/sh + +CLASSPATH=/usr/share/java/ecj.jar\${CLASSPATH:+:}\$CLASSPATH \ + java org.eclipse.jdt.internal.compiler.batch.Main "\$@" + +EOT +chmod 755 /usr/bin/ecj + + diff --git a/openjdk/build/fix_seamonkey_pkgconfig.sh b/openjdk/build/fix_seamonkey_pkgconfig.sh new file mode 100644 index 00000000..671d227b --- /dev/null +++ b/openjdk/build/fix_seamonkey_pkgconfig.sh @@ -0,0 +1,48 @@ +#!/bin/bash + +# --------------------------------------------------------------------------- +# This script fixes the seamonkye-plugin.pc file and adds libxul.pc. +# These changes enable the compilation of OpenJDK and its browser plugin. +# It will probably also be beneficial to the compilation of browser plugins +# in general. +# +# Author: Eric Hameleers December 2011 +# --------------------------------------------------------------------------- + +# Automatically determine the architecture we're building on: +if [ -z "$ARCH" ]; then + case "$( uname -m )" in + i?86) export ARCH=i486 ;; + arm*) export ARCH=arm ;; + # Unless $ARCH is already set, use uname -m for all other archs: + *) export ARCH=$( uname -m ) ;; + esac +fi + +if [ "$ARCH" = "x86_64" ]; then + LIBDIRSUFFIX="64" +else + LIBDIRSUFFIX="" +fi + +# Fix the seamonkey-plugin.pc file: +sed -i -e '/^Cflags: /s, -I${includedir}/java -I${includedir}/plugin, -I${includedir} -DXP_UNIX,' /usr/lib${LIBDIRSUFFIX}/pkgconfig/seamonkey-plugin.pc + +# Add a libxul.pc file if needed: +if [ ! -f /usr/lib${LIBDIRSUFFIX}/pkgconfig/libxul.pc ]; then + SEAMONKEY=$(echo /usr/lib${LIBDIRSUFFIX}/seamonkey-* | tail -1 | cut -f2 -d-) + cat < /usr/lib${LIBDIRSUFFIX}/pkgconfig/libxul.pc +prefix=/usr +libdir=/usr/lib${LIBDIRSUFFIX}/seamonkey-$SEAMONKEY +includedir=/usr/include/seamonkey-$SEAMONKEY +idldir=/usr/share/idl/seamonkey-$SEAMONKEY + +Name: libxul +Description: The Mozilla Runtime and Embedding Engine +Version: $SEAMONKEY +Requires: seamonkey-nspr >= 4.7.1 +Libs: -L\${libdir} -lxul -lxpcom +Cflags: -I\${includedir} -fshort-wchar +EOT +fi + -- cgit v1.2.3-65-gdbad