/hg/icedtea-web: Install icedtea-web into a FHS-compliant location

omajid at icedtea.classpath.org omajid at icedtea.classpath.org
Tue Feb 22 08:48:17 PST 2011


changeset cb3f89164966 in /hg/icedtea-web
details: http://icedtea.classpath.org/hg/icedtea-web?cmd=changeset;node=cb3f89164966
author: Omair Majid <omajid at redhat.com>
date: Tue Feb 22 11:47:44 2011 -0500

	Install icedtea-web into a FHS-compliant location

	2011-02-22 Omair Majid <omajid at redhat.com>

	 * Makefile.am: Add new vars JRE, LAUNCHER_BOOTCLASSPATH and
	PLUGIN_BOOTCLASSPATH. (install-exec-local): Install files to
	FHS-compliant location; do not create links. (install-data-
	local): Likewise. (uninstall-local): Update file paths to
	delete. ($(PLUGIN_DIR)/%.o): Pass PLUGIN_BOOTCLASSPATH and
	ICEDTEA_WEB_JRE. ($(NETX_DIR)/launcher/%.o): Pass
	LAUNCHER_BOOTCLASSPATH and ICEDTEA_WEB_JRE.
	($(NETX_DIR)/launcher/controlpanel/%.o): Likewise.
	    * launcher/java_md.c (GetIcedTeaWebJREPath): New method.
	(CreateExecutionEnvironment): Call GetIcedTeaWebJREPath.
	    * plugin/icedteanp/IcedTeaNPPlugin.cc (plugin_start_appletviewer):
	Add PLUGIN_BOOTCLASSPATH to the command. (NP_Initialize): Use
	ICEDTEA_WEB_JRE to initialize filename.


diffstat:

5 files changed, 101 insertions(+), 90 deletions(-)
ChangeLog                           |   20 ++++++++
Makefile.am                         |   59 +++++++++----------------
NEWS                                |    2 
launcher/java_md.c                  |   30 ++++++++++++-
plugin/icedteanp/IcedTeaNPPlugin.cc |   80 ++++++++++++-----------------------

diffs (318 lines):

diff -r bee43070e71d -r cb3f89164966 ChangeLog
--- a/ChangeLog	Fri Feb 18 11:55:23 2011 -0500
+++ b/ChangeLog	Tue Feb 22 11:47:44 2011 -0500
@@ -1,3 +1,23 @@ 2011-02-18  Omair Majid  <omajid at redhat.
+2011-02-22  Omair Majid  <omajid at redhat.com>
+
+	Install icedtea-web into a FHS-compliant location
+	* Makefile.am: Add new vars JRE, LAUNCHER_BOOTCLASSPATH and
+	PLUGIN_BOOTCLASSPATH.
+	(install-exec-local): Install files to FHS-compliant location; do not
+	create links.
+	(install-data-local): Likewise.
+	(uninstall-local): Update file paths to delete.
+	($(PLUGIN_DIR)/%.o): Pass PLUGIN_BOOTCLASSPATH and ICEDTEA_WEB_JRE.
+	($(NETX_DIR)/launcher/%.o): Pass LAUNCHER_BOOTCLASSPATH and
+	ICEDTEA_WEB_JRE.
+	($(NETX_DIR)/launcher/controlpanel/%.o): Likewise.
+	* launcher/java_md.c
+	(GetIcedTeaWebJREPath): New method.
+	(CreateExecutionEnvironment): Call GetIcedTeaWebJREPath.
+	* plugin/icedteanp/IcedTeaNPPlugin.cc
+	(plugin_start_appletviewer): Add PLUGIN_BOOTCLASSPATH to the command.
+	(NP_Initialize): Use ICEDTEA_WEB_JRE to initialize filename.
+
 2011-02-18  Omair Majid  <omajid at redhat.com>
 
 	Remove pluginappletviewer binary
diff -r bee43070e71d -r cb3f89164966 Makefile.am
--- a/Makefile.am	Fri Feb 18 11:55:23 2011 -0500
+++ b/Makefile.am	Tue Feb 22 11:47:44 2011 -0500
@@ -16,6 +16,10 @@ IT_LANGUAGE_SOURCE_VERSION=6
 IT_LANGUAGE_SOURCE_VERSION=6
 IT_CLASS_TARGET_VERSION=6
 IT_JAVACFLAGS=$(IT_JAVAC_SETTINGS) -source $(IT_LANGUAGE_SOURCE_VERSION) -target $(IT_CLASS_TARGET_VERSION)
+
+JRE='"$(SYSTEM_JDK_DIR)jre"'
+LAUNCHER_BOOTCLASSPATH="-J-Xbootclasspath/a:$(DESTDIR)$(datadir)/$(PACKAGE_NAME)/netx.jar"
+PLUGIN_BOOTCLASSPATH='"-Xbootclasspath/a:$(DESTDIR)$(datadir)/$(PACKAGE_NAME)/netx.jar:$(DESTDIR)$(datadir)/$(PACKAGE_NAME)/plugin.jar"'
 
 # Fake update version to shut up the plugin detector hosted by Oracle.
 # If Oracle ever release a JDK update greater than 50, this needs to be increased.
@@ -94,36 +98,20 @@ clean-local: clean-netx clean-plugin cle
  clean-bootstrap-directory clean-native-ecj clean-desktop-files clean-netx-docs clean-docs clean-plugin-docs
 
 install-exec-local:
-	${mkinstalldirs} $(DESTDIR)$(bindir) $(DESTDIR)$(prefix)/jre/lib/$(INSTALL_ARCH_DIR)
+	${mkinstalldirs} $(DESTDIR)$(bindir) $(DESTDIR)$(datadir)/$(PACKAGE_NAME)/ $(DESTDIR)$(libdir)
 if ENABLE_PLUGIN
-	${INSTALL_PROGRAM} $(PLUGIN_DIR)/IcedTeaPlugin.so $(DESTDIR)$(prefix)/jre/lib/$(INSTALL_ARCH_DIR)/
-	${INSTALL_DATA} $(abs_top_builddir)/liveconnect/lib/classes.jar $(DESTDIR)$(prefix)/jre/lib/plugin.jar
+	${INSTALL_PROGRAM} $(PLUGIN_DIR)/IcedTeaPlugin.so $(DESTDIR)$(libdir)
+	${INSTALL_DATA} $(abs_top_builddir)/liveconnect/lib/classes.jar $(DESTDIR)$(datadir)/$(PACKAGE_NAME)/plugin.jar
 endif
-	${INSTALL_DATA} $(NETX_DIR)/lib/classes.jar $(DESTDIR)$(prefix)/jre/lib/netx.jar
+	${INSTALL_DATA} $(NETX_DIR)/lib/classes.jar $(DESTDIR)$(datadir)/$(PACKAGE_NAME)/netx.jar
 	${INSTALL_PROGRAM} $(NETX_DIR)/launcher/javaws $(DESTDIR)$(bindir)
-	if [ -d $(DESTDIR)$(prefix)/jre/bin ] ; then \
-	  if [ -L $(DESTDIR)$(prefix)/jre/bin/javaws ] ; then \
-	    rm -f $(DESTDIR)$(prefix)/jre/bin/javaws ; \
-	  fi ; \
-	  if [ ! -e $(prefix)/jre/bin/javaws ] ; then \
-	    ln -s $(DESTDIR)$(bindir)/javaws $(DESTDIR)$(prefix)/jre/bin ; \
-	  fi ; \
-	fi
-	${INSTALL_DATA} extra-lib/about.jar $(DESTDIR)$(prefix)/jre/lib
+	${INSTALL_DATA} extra-lib/about.jar $(DESTDIR)$(datadir)/$(PACKAGE_NAME)/about.jar
 	${INSTALL_PROGRAM} $(NETX_DIR)/launcher/controlpanel/itweb-settings $(DESTDIR)$(bindir)
-	if [ -d $(DESTDIR)$(prefix)/jre/bin ] ; then \
-	  if [ -L $(DESTDIR)$(prefix)/jre/bin/itweb-settings ] ; then \
-	    rm -f $(DESTDIR)$(prefix)/jre/bin/itweb-settings ; \
-	  fi ; \
-	  if [ ! -e $(prefix)/jre/bin/itweb-settings ] ; then \
-	    ln -s $(DESTDIR)$(bindir)/itweb-settings $(DESTDIR)$(prefix)/jre/bin ; \
-	  fi ; \
-	fi
 
 install-data-local:
 	${mkinstalldirs} -d $(DESTDIR)$(prefix)/man/man1
 	${INSTALL_DATA} $(NETX_SRCDIR)/javaws.1 $(DESTDIR)$(prefix)/man/man1
-	${INSTALL_DATA} $(NETX_RESOURCE_DIR)/about.jnlp $(DESTDIR)$(prefix)/jre/lib
+	${INSTALL_DATA} $(NETX_RESOURCE_DIR)/about.jnlp $(DESTDIR)$(datarootdir)/$(PACKAGE_NAME)
 if ENABLE_DOCS
 	${mkinstalldirs} $(DESTDIR)$(htmldir)
 	(cd ${abs_top_builddir}/docs/netx; \
@@ -141,21 +129,14 @@ endif
 endif
 
 uninstall-local:
-	rm -f $(DESTDIR)$(prefix)/jre/lib/$(INSTALL_ARCH_DIR)/IcedTeaPlugin.so
-	rm -f $(DESTDIR)$(prefix)/jre/lib/plugin.jar
-	rm -f $(DESTDIR)$(prefix)/jre/lib/netx.jar
-	rm -f $(DESTDIR)$(prefix)/jre/lib/about.jnlp
-	rm -f $(DESTDIR)$(prefix)/jre/lib/about.jar
+	rm -f $(DESTDIR)$(libdir)/IcedTeaPlugin.so
+	rm -f $(DESTDIR)$(datadir)/$(PACKAGE_NAME)/plugin.jar
+	rm -f $(DESTDIR)$(datadir)/$(PAKCAGE_NAME)/netx.jar
+	rm -f $(DESTDIR)$(datadir)/$(PACKAGE_NAME)/about.jnlp
+	rm -f $(DESTDIR)$(datadir)/$(PACKAGE_NAME)/about.jar
 	rm -f $(DESTDIR)$(prefix)/man/man1/javaws.1
 	rm -f $(DESTDIR)$(bindir)/javaws
-	if [ -L $(DESTDIR)$(prefix)/jre/bin/javaws ] ; then \
-	  rm -f $(DESTDIR)$(prefix)/jre/bin/javaws ; \
-	fi
-	rm -f $(DESTDIR)$(prefix)/jre/bin/javaws
 	rm -f $(DESTDIR)$(bindir)/itweb-settings
-	if [ -L $(DESTDIR)$(prefix)/jre/bin/itweb-settings ] ; then \
-	  rm -f $(DESTDIR)$(prefix)/jre/bin/itweb-settings ; \
-	fi
 	rm -rf $(DESTDIR)$(htmldir)
 
 # Plugin
@@ -183,6 +164,8 @@ PLUGIN_OBJECTS=IcedTeaNPPlugin.o IcedTea
 	  -DPLUGIN_VERSION="\"$(PLUGIN_VERSION)\"" \
 	  -DPACKAGE_URL="\"$(PACKAGE_URL)\"" \
 	  -DMOZILLA_VERSION_COLLAPSED="$(MOZILLA_VERSION_COLLAPSED)" \
+	  -DICEDTEA_WEB_JRE=$(JRE) \
+	  -DPLUGIN_BOOTCLASSPATH=$(PLUGIN_BOOTCLASSPATH) \
 	  $(GLIB_CFLAGS) \
 	  $(GTK_CFLAGS) \
 	  $(MOZILLA_CFLAGS) \
@@ -328,14 +311,14 @@ extra-lib/about.jar: stamps/extra-class-
 $(NETX_DIR)/launcher/%.o: $(LAUNCHER_SRCDIR)/%.c
 	mkdir -p $(NETX_DIR)/launcher && \
 	$(CC) $(LAUNCHER_FLAGS) \
-	  -DJAVA_ARGS='{ "-J-ms8m", "-J-Djava.icedtea-web.bin=$(DESTDIR)$(bindir)/javaws", "net.sourceforge.jnlp.runtime.Boot",  }' \
-	  -DPROGNAME='"javaws"' -c -o $@ $<
+	  -DJAVA_ARGS='{ $(LAUNCHER_BOOTCLASSPATH), "-J-ms8m", "-J-Djava.icedtea-web.bin=$(DESTDIR)$(bindir)/javaws", "net.sourceforge.jnlp.runtime.Boot",  }' \
+	  -DICEDTEA_WEB_JRE=$(JRE) -DPROGNAME='"javaws"' -c -o $@ $<
 
 $(NETX_DIR)/launcher/controlpanel/%.o: $(LAUNCHER_SRCDIR)/%.c
 	mkdir -p $(NETX_DIR)/launcher/controlpanel && \
 	$(CC) $(LAUNCHER_FLAGS) \
-	-DJAVA_ARGS='{ "-J-ms8m", "-Dprogram.name=itweb-settings", "net.sourceforge.jnlp.controlpanel.CommandLine",  }' \
-	-DPROGNAME='"itweb-settings"' -c -o $@ $<
+	-DJAVA_ARGS='{ $(LAUNCHER_BOOTCLASSPATH), "-J-ms8m", "-Dprogram.name=itweb-settings", "net.sourceforge.jnlp.controlpanel.CommandLine",  }' \
+	-DICEDTEA_WEB_JRE=$(JRE) -DPROGNAME='"itweb-settings"' -c -o $@ $<
 
 $(NETX_DIR)/launcher/javaws: $(NETX_LAUNCHER_OBJECTS)
 	$(CC) $(NETX_LAUNCHER_OBJECTS) $(LAUNCHER_LINK)
diff -r bee43070e71d -r cb3f89164966 NEWS
--- a/NEWS	Fri Feb 18 11:55:23 2011 -0500
+++ b/NEWS	Tue Feb 22 11:47:44 2011 -0500
@@ -12,6 +12,8 @@ New in release 1.1 (2011-XX-XX):
 * Security updates
   - S6983554, CVE-2010-4450: Launcher incorrect processing of empty library path entries 
   - RH677332, CVE-2011-0706: IcedTea multiple signers privilege escalation
+* New Features
+  - IcedTea-Web now installs to a FHS-compliant location
 * NetX
   - Use Firefox's proxy settings if possible
   - RH669942: javaws fails to download version/packed files (missing support for jnlp.packEnabled and jnlp.versionEnabled)
diff -r bee43070e71d -r cb3f89164966 launcher/java_md.c
--- a/launcher/java_md.c	Fri Feb 18 11:55:23 2011 -0500
+++ b/launcher/java_md.c	Tue Feb 22 11:47:44 2011 -0500
@@ -158,6 +158,7 @@ static jboolean GetJVMPath(const char *j
 static jboolean GetJVMPath(const char *jrepath, const char *jvmtype,
                            char *jvmpath, jint jvmpathsize, char * arch);
 static jboolean GetJREPath(char *path, jint pathsize, char * arch, jboolean speculative);
+static jboolean GetIcedTeaWebJREPath(char *path, jint pathsize, char * arch, jboolean speculative);
 
 const char *
 GetArch()
@@ -280,7 +281,7 @@ CreateExecutionEnvironment(int *_argcp,
          jvmpath does not exist */
       if (wanted == running) {
         /* Find out where the JRE is that we will be using. */
-        if (!GetJREPath(jrepath, so_jrepath, arch, JNI_FALSE) ) {
+        if (!GetIcedTeaWebJREPath(jrepath, so_jrepath, arch, JNI_FALSE) ) {
           fprintf(stderr, "Error: could not find Java 2 Runtime Environment.\n");
           exit(2);
         }
@@ -603,6 +604,33 @@ GetJVMPath(const char *jrepath, const ch
           printf("no.\n");
         return JNI_FALSE;
     }
+}
+
+/*
+ * Find path to the JRE based on the the compile flag ICEDTEA_WEB_JRE
+ */
+static jboolean
+GetIcedTeaWebJREPath(char* path, jint pathsize, char* arch, jboolean speculative)
+{
+    char libjava[MAXPATHLEN];
+    snprintf(libjava, MAXPATHLEN, ICEDTEA_WEB_JRE "/lib/%s/" JAVA_DLL, arch);
+
+    if (_launcher_debug) {
+      printf(ICEDTEA_WEB_JRE "/lib/%s/" JAVA_DLL "\n", arch);
+      printf("libjava is %s\n", libjava);
+    }
+
+    if (access(libjava, F_OK) == 0) {
+        strncpy(path, ICEDTEA_WEB_JRE, pathsize);
+        goto found;
+    }
+
+    return JNI_FALSE;
+
+ found:
+    if (_launcher_debug)
+      printf("JRE path is %s\n", path);
+    return JNI_TRUE;
 }
 
 /*
diff -r bee43070e71d -r cb3f89164966 plugin/icedteanp/IcedTeaNPPlugin.cc
--- a/plugin/icedteanp/IcedTeaNPPlugin.cc	Fri Feb 18 11:55:23 2011 -0500
+++ b/plugin/icedteanp/IcedTeaNPPlugin.cc	Tue Feb 22 11:47:44 2011 -0500
@@ -1547,23 +1547,25 @@ plugin_start_appletviewer (ITNPPluginDat
 
   if (plugin_debug)
   {
-      command_line = (gchar**) malloc(sizeof(gchar*)*8);
+      command_line = (gchar**) malloc(sizeof(gchar*)*9);
       command_line[0] = g_strdup(appletviewer_executable);
-      command_line[1] = g_strdup("-Xdebug");
-      command_line[2] = g_strdup("-Xnoagent");
-      command_line[3] = g_strdup("-Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=n");
-      command_line[4] = g_strdup("sun.applet.PluginMain");
-      command_line[5] = g_strdup(out_pipe_name);
-      command_line[6] = g_strdup(in_pipe_name);
-      command_line[7] = NULL;
+      command_line[1] = g_strdup(PLUGIN_BOOTCLASSPATH);
+      command_line[2] = g_strdup("-Xdebug");
+      command_line[3] = g_strdup("-Xnoagent");
+      command_line[4] = g_strdup("-Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=n");
+      command_line[5] = g_strdup("sun.applet.PluginMain");
+      command_line[6] = g_strdup(out_pipe_name);
+      command_line[7] = g_strdup(in_pipe_name);
+      command_line[8] = NULL;
    } else
    {
-       command_line = (gchar**) malloc(sizeof(gchar*)*5);
+       command_line = (gchar**) malloc(sizeof(gchar*)*6);
        command_line[0] = g_strdup(appletviewer_executable);
-       command_line[1] = g_strdup("sun.applet.PluginMain");
-       command_line[2] = g_strdup(out_pipe_name);
-       command_line[3] = g_strdup(in_pipe_name);
-       command_line[4] = NULL;
+       command_line[1] = g_strdup(PLUGIN_BOOTCLASSPATH);
+       command_line[2] = g_strdup("sun.applet.PluginMain");
+       command_line[3] = g_strdup(out_pipe_name);
+       command_line[4] = g_strdup(in_pipe_name);
+       command_line[5] = NULL;
    }
 
   environment = plugin_filter_environment();
@@ -1590,17 +1592,21 @@ plugin_start_appletviewer (ITNPPluginDat
   command_line[0] = NULL;
   g_free (command_line[1]);
   command_line[1] = NULL;
+  g_free (command_line[2]);
+  command_line[2] = NULL;
+  g_free (command_line[3]);
+  command_line[3] = NULL;
+  g_free (command_line[4]);
+  command_line[4] = NULL;
 
   if (plugin_debug)
   {
-      g_free (command_line[2]);
-      command_line[2] = NULL;
-      g_free (command_line[3]);
-      command_line[3] = NULL;
-      g_free (command_line[4]);
-      command_line[4] = NULL;
       g_free (command_line[5]);
       command_line[5] = NULL;
+      g_free (command_line[6]);
+      command_line[6] = NULL;
+      g_free (command_line[7]);
+      command_line[7] = NULL;
   }
 
   g_free(command_line);
@@ -2173,38 +2179,10 @@ NP_Initialize (NPNetscapeFuncs* browserT
     }
 
   // Set appletviewer_executable.
-  Dl_info info;
-  int filename_size;
-  if (dladdr ((const void*) ITNP_New, &info) == 0)
-    {
-      PLUGIN_ERROR_TWO ("Failed to determine plugin shared object filename",
-                        dlerror ());
-      np_error = NPERR_GENERIC_ERROR;
-      goto cleanup_data_directory;
-    }
-  filename = (gchar*) malloc(sizeof(gchar)*1024);
-  filename_size = readlink(info.dli_fname, filename, 1023);
-  if (filename_size >= 0)
-  {
-      filename[filename_size] = '\0';
-  }
-
-  if (!filename)
-    {
-      PLUGIN_ERROR ("Failed to create plugin shared object filename.");
-      np_error = NPERR_OUT_OF_MEMORY_ERROR;
-      goto cleanup_data_directory;
-    }
-
-  if (filename_size <= 0)
-  {
-      free(filename);
-      filename = g_strdup(info.dli_fname);
-  }
-
-  appletviewer_executable = g_strdup_printf ("%s/../../bin/java",
-                                             dirname (filename));
-  PLUGIN_DEBUG(".so is located at: %s and the link points to: %s. Executing java from dir %s to run %s\n", info.dli_fname, filename, dirname (filename), appletviewer_executable);
+  filename = g_strdup(ICEDTEA_WEB_JRE);
+  appletviewer_executable = g_strdup_printf ("%s/bin/java",
+                                             filename);
+  PLUGIN_DEBUG("Executing java at %s\n", appletviewer_executable);
   if (!appletviewer_executable)
     {
       PLUGIN_ERROR ("Failed to create appletviewer executable name.");



More information about the distro-pkg-dev mailing list