[icedtea-web-1.0] RFC: The Devil's in the DESTDIR

Dr Andrew John Hughes ahughes at redhat.com
Tue Feb 1 13:56:36 PST 2011


When installing IcedTea-Web under Gentoo, DESTDIR is used to do a
staged install in /var during make.  The portage system copies it to
the main tree later.

Trying this with IcedTea-Web revealed a number of issues with DESTDIR
that I've resolved in the attached patch, mainly because there was
an implicit assumption that ${DESTDIR}${prefix} == ${prefix}.

* We need to check if there is a ${prefix}/jre/bin not a
${DESTDIR}${prefix}/jre/bin as this may only contain what was installed by us.
* The plugin install needs to go last or the installation of pluginappletviewer
(which I believe is unnecessary anyway) will have already created the bin
directory, causing mkinstalldirs to fail.
* We should only create ${DESTDIR}${prefix}/jre/lib/${INSTALL_ARCH_DIR} if we are installing
the plugin.

I also tied things up a little to make it clearer.  The two binaries are tested and
linked at the same time rather than in separate if blocks.

2010-02-01  Andrew John Hughes  <ahughes at redhat.com>

	Fix issues with use of DESTDIR pointing
	to an empty tree for staging.
	* Makefile.am:
	(install-exec-local): Create just bin and
	jre/lib for the main (NetX) install, creating
	jre/lib/$(INSTALL_ARCH_DIR) only for the plugin
	install.  Amalgamate the if blocks and test for
	${prefix}/jre/bin not ${DESTDIR}${prefix}/jre/bin
	to ensure we check the installed JDK and not the
	staging tree.  Move plugin installation to the end
	to avoid mkinstalldirs from failing by trying to
	create ${DESTDIR}${prefix}/bin a second time.

Ok for 1.0?
-- 
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
-------------- next part --------------
diff -r 0db0d2392ef2 Makefile.am
--- a/Makefile.am	Tue Feb 01 21:20:37 2011 +0000
+++ b/Makefile.am	Tue Feb 01 21:51:55 2011 +0000
@@ -102,32 +102,32 @@
  clean-bootstrap-directory clean-native-ecj clean-desktop-files clean-netx-docs clean-docs clean-plugin-docs
 
 install-exec-local:
-	${mkinstalldirs} $(DESTDIR)$(prefix)/bin $(DESTDIR)$(prefix)$(JRE_DIR_PREFIX)/lib/$(INSTALL_ARCH_DIR)
-if ENABLE_PLUGIN
-	${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_DIR_PREFIX)/lib/plugin.jar
-endif
+	${mkinstalldirs} $(DESTDIR)$(prefix)/bin $(DESTDIR)$(prefix)$(JRE_DIR_PREFIX)/lib
 	${INSTALL_DATA} $(NETX_DIR)/lib/classes.jar $(DESTDIR)$(prefix)$(JRE_DIR_PREFIX)/lib/netx.jar
 	${INSTALL_PROGRAM} $(NETX_DIR)/launcher/javaws $(DESTDIR)$(prefix)/bin
-	if [ -d $(DESTDIR)$(prefix)/jre/bin ] ; then \
+	${INSTALL_DATA} extra-lib/about.jar $(DESTDIR)$(prefix)$(JRE_DIR_PREFIX)/lib
+	${INSTALL_PROGRAM} $(NETX_DIR)/launcher/controlpanel/itweb-settings $(DESTDIR)$(prefix)/bin
+	if [ -d $(prefix)/jre/bin ] ; then \
+	  ${mkinstalldirs} $(DESTDIR)$(prefix)/jre/bin ; \
 	  if [ -L $(DESTDIR)$(prefix)/jre/bin/javaws ] ; then \
 	    rm -f $(DESTDIR)$(prefix)/jre/bin/javaws ; \
 	  fi ; \
+	  if [ -L $(DESTDIR)$(prefix)/jre/bin/itweb-settings ] ; then \
+	    rm -f $(DESTDIR)$(prefix)/jre/bin/itweb-settings ; \
+	  fi ; \
 	  if [ ! -e $(prefix)/jre/bin/javaws ] ; then \
 	    ln -s ../../bin/javaws $(DESTDIR)$(prefix)/jre/bin ; \
 	  fi ; \
-	fi
-	${INSTALL_DATA} extra-lib/about.jar $(DESTDIR)$(prefix)$(JRE_DIR_PREFIX)/lib
-	${INSTALL_PROGRAM} $(NETX_DIR)/launcher/controlpanel/itweb-settings $(DESTDIR)$(prefix)/bin
-	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 ../../bin/itweb-settings $(DESTDIR)$(prefix)/jre/bin ; \
 	  fi ; \
 	fi
+if ENABLE_PLUGIN
+	${mkinstalldirs} $(DESTDIR)$(prefix)$(JRE_DIR_PREFIX)/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_DIR_PREFIX)/lib/plugin.jar
+endif
 
 install-data-local:
 	${mkinstalldirs} -d $(DESTDIR)$(prefix)/man/man1


More information about the distro-pkg-dev mailing list