[icedtea-web] RFE: Fix for broken JRE dir install

Dr Andrew John Hughes ahughes at redhat.com
Wed Jan 26 11:02:21 PST 2011


On 18:57 Tue 25 Jan     , Deepak Bhole wrote:
> * Dr Andrew John Hughes <ahughes at redhat.com> [2011-01-21 20:23]:
> > On 17:40 Fri 21 Jan     , Deepak Bhole wrote:
> <snip>
> > > 
> > 
> > IcedTea-Web does not 'put things in JDK_HOME/bin'.  It puts them in
> > ${bindir} which defaults to ${prefix}/bin.  That's only equal to
> > JDK_HOME/bin if ${prefix} is set to JDK_HOME.  For a general application,
> > ${bindir} is the primary location.
> > 
> > That said, I support adding the $(JRE_DIR_PREFIX) hack to IcedTea-Web 1.0
> > as I said before.  You just need to do in the patch what you say in the mail ;-)
> > 
> 
> Having thought more about different RPM scenarios, I can see what you
> mean now. I was incorrectly understanding the install requirements
> earlier. I have updated the patch to remove the linking changes. Sorry
> for the unnecessary confusion.
> 
> I did however update it to use relative symlinks i.e. something like:
> 
> jre/bin/javaws -> ../../bin/javaws
> 
> Rather than the current way which creates absolute links (and makes the tree
> un-relocatable).
> 

To do this, 

> +	${mkinstalldirs} $(DESTDIR)$(bindir) $(DESTDIR)$(prefix)$(JRE_DIR_PREFIX)/lib/$(INSTALL_ARCH_DIR)

should also be changed to create $(DESTDIR)$(prefix)/bin instead of $(DESTDIR)$(bindir).
The patch below will break if $(bindir) != $(prefix)/bin.

Clearly, this breaks the use of --bindir.

> As with previous iterations of the patch, this would be for 1.0 only.
> 

Indeed.  For 1.1, it should install like a normal application and respect the user's configure settings
without all this Java craziness.  That will involve removing all these hardcoded jre/bin references altogether.

> ChangeLog:
> 2011-01-25  Deepak Bhole <dbhole at redhat.com>
> 
>    * Makefile.am
>    ($(NETX_DIR)/launcher/%.o): Build javaws without the
>    "-J-Djava.icedtea-web.bin=..." arg. 
>    (install-exec-local): Use new JRE_DIR_PREFIX variables rather than
>    hardcoded '/jre' in pathname. Create relative links in jre/bin rather than
>    absolute ones.
>    (install-data-local): Use new JRE_DIR_PREFIX variables rather than
>    hardcoded '/jre' in pathname.
>    (uninstall-local): Same. Also, remove all parent dirs of $(htmldir) until 
>    a non-empty one is encountered.
>    * configure.ac: Set JRE_DIR_PREFIX to jre/ if prefix is a JDK dir and set 
>    it to empty if prefix apears to be a JRE dir.
>    * netx/net/sourceforge/jnlp/Launcher.java (launchExternal): Revert back to
>    using java.home when selecting javaws binary to execute for fork.
> 
> 
> Cheers,
> Deepak

> diff -r 43212217e9c0 Makefile.am
> --- a/Makefile.am	Wed Dec 15 10:17:51 2010 -0500
> +++ b/Makefile.am	Tue Jan 25 18:47:27 2011 -0500
> @@ -102,37 +102,37 @@
>   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)$(prefix)$(JRE_DIR_PREFIX)/lib/$(INSTALL_ARCH_DIR)
>  if ENABLE_PLUGIN
> -	${INSTALL_PROGRAM} $(PLUGIN_DIR)/IcedTeaPlugin.so $(DESTDIR)$(prefix)/jre/lib/$(INSTALL_ARCH_DIR)/
> +	${INSTALL_PROGRAM} $(PLUGIN_DIR)/IcedTeaPlugin.so $(DESTDIR)$(prefix)$(JRE_DIR_PREFIX)/lib/$(INSTALL_ARCH_DIR)/
>  	${INSTALL_PROGRAM} $(PLUGIN_DIR)/launcher/pluginappletviewer $(DESTDIR)$(bindir)
> -	${INSTALL_DATA} $(abs_top_builddir)/liveconnect/lib/classes.jar $(DESTDIR)$(prefix)/jre/lib/plugin.jar
> +	${INSTALL_DATA} $(abs_top_builddir)/liveconnect/lib/classes.jar $(DESTDIR)$(prefix)$(JRE_DIR_PREFIX)/lib/plugin.jar
>  endif
> -	${INSTALL_DATA} $(NETX_DIR)/lib/classes.jar $(DESTDIR)$(prefix)/jre/lib/netx.jar
> +	${INSTALL_DATA} $(NETX_DIR)/lib/classes.jar $(DESTDIR)$(prefix)$(JRE_DIR_PREFIX)/lib/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 ; \
> +	    ln -s ../../bin/javaws $(DESTDIR)$(prefix)/jre/bin ; \
>  	  fi ; \
>  	fi
> -	${INSTALL_DATA} extra-lib/about.jar $(DESTDIR)$(prefix)/jre/lib
> +	${INSTALL_DATA} extra-lib/about.jar $(DESTDIR)$(prefix)$(JRE_DIR_PREFIX)/lib
>  	${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 ; \
> +	    ln -s ../../bin/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)$(prefix)$(JRE_DIR_PREFIX)/lib
>  if ENABLE_DOCS
>  	${mkinstalldirs} $(DESTDIR)$(htmldir)
>  	(cd ${abs_top_builddir}/docs/netx; \
> @@ -150,23 +150,25 @@
>  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)$(prefix)$(JRE_DIR_PREFIX)/lib/$(INSTALL_ARCH_DIR)/IcedTeaPlugin.so
> +	rm -f $(DESTDIR)$(prefix)$(JRE_DIR_PREFIX)/lib/plugin.jar
> +	rm -f $(DESTDIR)$(prefix)$(JRE_DIR_PREFIX)/lib/netx.jar
> +	rm -f $(DESTDIR)$(prefix)$(JRE_DIR_PREFIX)/lib/about.jnlp
> +	rm -f $(DESTDIR)$(prefix)$(JRE_DIR_PREFIX)/lib/about.jar
>  	rm -f $(DESTDIR)$(prefix)/man/man1/javaws.1
>  	rm -f $(DESTDIR)$(bindir)/pluginappletviewer
> -	rm -f $(DESTDIR)$(bindir)/javaws
> -	if [ -L $(DESTDIR)$(prefix)/jre/bin/javaws ] ; then \
> -	  rm -f $(DESTDIR)$(prefix)/jre/bin/javaws ; \
> +	rm -f $(DESTDIR)$(prefix)$(JRE_DIR_PREFIX)/bin/javaws
> +	if [ -L $(DESTDIR)$(prefix)/bin/javaws ] ; then \
> +	  rm -f $(DESTDIR)$(prefix)/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 ; \
> +	rm -f $(DESTDIR)$(prefix)$(JRE_DIR_PREFIX)/bin/itweb-settings
> +	if [ -L $(DESTDIR)$(prefix)/bin/itweb-settings ] ; then \
> +	  rm -f $(DESTDIR)$(prefix)/bin/itweb-settings ; \
>  	fi
> -	rm -rf $(DESTDIR)$(htmldir)
> +	rm -rf $(DESTDIR)$(htmldir)/*
> +	if [ -d $(DESTDIR)$(htmldir) ] ; then \
> +	  rmdir -p --ignore-fail-on-non-empty $(DESTDIR)$(htmldir) ; \
> +	fi
>  
>  # Plugin
>  
> @@ -349,7 +351,7 @@
>  $(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",  }' \
> +	  -DJAVA_ARGS='{ "-J-ms8m", "net.sourceforge.jnlp.runtime.Boot",  }' \
>  	  -DPROGNAME='"javaws"' -c -o $@ $<
>  
>  $(NETX_DIR)/launcher/controlpanel/%.o: $(LAUNCHER_SRCDIR)/%.c
> diff -r 43212217e9c0 configure.ac
> --- a/configure.ac	Wed Dec 15 10:17:51 2010 -0500
> +++ b/configure.ac	Tue Jan 25 18:47:27 2011 -0500
> @@ -78,4 +78,12 @@
>  IT_CHECK_FOR_CLASS(SUN_APPLET_APPLETIMAGEREF, [sun.applet.AppletImageRef])
>  IT_CHECK_FOR_APPLETVIEWERPANEL_HOLE
>  
> +# Set JRE prefix based on whether to-level prefix is a JDK dir or a JRE dir
> +if test -d ${prefix}/jre ; then 
> +    JRE_DIR_PREFIX="/jre" ; 
> +else
> +    JRE_DIR_PREFIX="" ;     
> +fi ;
> +AC_SUBST([JRE_DIR_PREFIX])
> +
>  AC_OUTPUT
> diff -r 43212217e9c0 netx/net/sourceforge/jnlp/Launcher.java
> --- a/netx/net/sourceforge/jnlp/Launcher.java	Wed Dec 15 10:17:51 2010 -0500
> +++ b/netx/net/sourceforge/jnlp/Launcher.java	Tue Jan 25 18:47:27 2011 -0500
> @@ -330,7 +330,12 @@
>              List<String> commands = new LinkedList<String>();
>  
>              // this property is set by the javaws launcher to point to the javaws binary
> -            String pathToWebstartBinary = System.getProperty("java.icedtea-web.bin");
> +            String pathToWebstartBinary = System.getProperty("java.home") +
> +                                      File.separatorChar +
> +                                      "bin" +
> +                                      File.separatorChar +
> +                                      "javaws";
> +
>              commands.add(pathToWebstartBinary);
>              // use -Jargument format to pass arguments to the JVM through the launcher
>              for (String arg : vmArgs) {


-- 
Andrew :)

Free Java Software Engineer
Red Hat, Inc. (http://www.redhat.com)

Support Free Java!
Contribute to GNU Classpath and IcedTea
http://www.gnu.org/software/classpath
http://icedtea.classpath.org
PGP Key: 94EFD9D8 (http://subkeys.pgp.net)
Fingerprint = F8EF F1EA 401E 2E60 15FA  7927 142C 2591 94EF D9D8



More information about the distro-pkg-dev mailing list