changeset 57:243ab4185293

Add documentation build support. 2010-11-25 Andrew John Hughes <ahughes@redhat.com> * Makefile.am: (JDK_UPDATE_VERSION): Document. (NETX_PKGS): NetX packages for documentation. (PLUGIN_PKGS): Same for the plugin. (JAVADOC_OPTS): Common options passed to javadoc. (JAVADOC_MEM_OPTS): Memory options passed to JVM if possible (taken from the previous OpenJDK build). (all-local): Depend on docs.stamp. (clean-local): Add clean-docs. (.PHONY): Add clean-docs, clean-plugin-docs, clean-netx-docs. (install-exec-local): Install the documentation if enabled. (docs): Meta-dependency for netx-docs and plugin-docs. (clean-docs): Likewise but for clean targets. (netx-docs): Build documentation for the NetX API. (clean-netx-docs): Remove the NetX docs. (plugin-docs): Build documentation for the plugin API. (clean-plugin-docs): Likewise. (bootstrap-directory): Link to javadoc binary. * acinclude.m4: (IT_FIND_JAVADOC): Find a javadoc binary, first checking user input, then the JDK and the path for 'javadoc' and 'gjdoc'. Also sets JAVADOC_SUPPORTS_J_OPTIONS if it does. * configure.ac: Call IT_FIND_JAVADOC.
author Andrew John Hughes <ahughes@redhat.com>
date Fri, 26 Nov 2010 15:21:56 +0000
parents 918f525349b3
children 99f8df2ec04b
files ChangeLog Makefile.am acinclude.m4 configure.ac
diffstat 4 files changed, 160 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Thu Nov 25 12:45:55 2010 -0500
+++ b/ChangeLog	Fri Nov 26 15:21:56 2010 +0000
@@ -1,3 +1,30 @@
+2010-11-25  Andrew John Hughes  <ahughes@redhat.com>
+
+	* Makefile.am:
+	(JDK_UPDATE_VERSION): Document.
+	(NETX_PKGS): NetX packages for documentation.
+	(PLUGIN_PKGS): Same for the plugin.
+	(JAVADOC_OPTS): Common options passed to javadoc.
+	(JAVADOC_MEM_OPTS): Memory options passed to JVM
+	if possible (taken from the previous OpenJDK build).
+	(all-local): Depend on docs.stamp.
+	(clean-local): Add clean-docs.
+	(.PHONY): Add clean-docs, clean-plugin-docs, clean-netx-docs.
+	(install-exec-local): Install the documentation if enabled.
+	(docs): Meta-dependency for netx-docs and plugin-docs.
+	(clean-docs): Likewise but for clean targets.
+	(netx-docs): Build documentation for the NetX API.
+	(clean-netx-docs): Remove the NetX docs.
+	(plugin-docs): Build documentation for the plugin API.
+	(clean-plugin-docs): Likewise.
+	(bootstrap-directory): Link to javadoc binary.
+	* acinclude.m4:
+	(IT_FIND_JAVADOC): Find a javadoc binary, first checking
+	user input, then the JDK and the path for 'javadoc' and
+	'gjdoc'.  Also sets JAVADOC_SUPPORTS_J_OPTIONS if it does.
+	* configure.ac:
+	Call IT_FIND_JAVADOC.
+
 2010-11-25  Omair Majid  <omajid@redhat.com>
 
 	* Makefile.am (stamps/liveconnect.stamp): Set a bootclasspath to
--- a/Makefile.am	Thu Nov 25 12:45:55 2010 -0500
+++ b/Makefile.am	Fri Nov 26 15:21:56 2010 +0000
@@ -17,12 +17,20 @@
 IT_CLASS_TARGET_VERSION=6
 IT_JAVACFLAGS=$(IT_JAVAC_SETTINGS) -source $(IT_LANGUAGE_SOURCE_VERSION) -target $(IT_CLASS_TARGET_VERSION)
 
+# 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.
 JDK_UPDATE_VERSION=50
 
 # Sources list
 
 PLUGIN_TEST_SRCS = $(abs_top_srcdir)/plugin/tests/LiveConnect/*.java
 
+NETX_PKGS = javax.jnlp net.sourceforge.nanoxml net.sourceforge.jnlp \
+	net.sourceforge.jnlp.cache net.sourceforge.jnlp.event \
+	net.sourceforge.jnlp.security net.sourceforge.jnlp.security.viewer \
+	net.sourceforge.jnlp.services net.sourceforge.jnlp.tools \
+	net.sourceforge.jnlp.util
+
 # Conditional defintions
 if ENABLE_PLUGIN
 ICEDTEAPLUGIN_CLEAN = clean-IcedTeaPlugin
@@ -32,6 +40,7 @@
 LIVECONNECT_SRCS = $(PLUGIN_SRCDIR)/java
 ICEDTEAPLUGIN_TARGET = $(PLUGIN_DIR)/IcedTeaPlugin.so stamps/liveconnect-dist.stamp \
  $(PLUGIN_DIR)/launcher/pluginappletviewer
+PLUGIN_PKGS = sun.applet netscape.security netscape.javascript
 endif
 
 if CP_SUPPORTS_REFLINK
@@ -51,6 +60,14 @@
 ICEDTEA_PKG = $(EMPTY) (${PKGVERSION})
 endif
 
+if ENABLE_DOCS
+JAVADOC_OPTS=-use -keywords -encoding UTF-8 -splitIndex \
+ -bottom '<font size="-1"> <a href="http://icedtea.classpath.org/bugzilla">Submit a bug or feature</a></font>'
+if JAVADOC_SUPPORTS_J_OPTIONS
+JAVADOC_MEM_OPTS=-J-Xmx1024m -J-Xms128m -J-XX:PermSize=32m -J-XX:MaxPermSize=160m
+endif
+endif
+
 # Launcher
 
 LAUNCHER_SRCDIR = $(abs_top_srcdir)/launcher
@@ -72,13 +89,13 @@
 # =================
 
 all-local: stamps/netx-dist.stamp extra-lib/about.jar stamps/plugin.stamp $(NETX_DIR)/launcher/javaws \
- javaws.desktop
+ javaws.desktop stamps/docs.stamp
 
 clean-local: clean-netx clean-plugin clean-liveconnect clean-extra clean-bootstrap-directory \
- clean-native-ecj clean-desktop-files
+ clean-native-ecj clean-desktop-files clean-docs
 
 .PHONY: clean-IcedTeaPlugin clean-add-netx clean-add-netx-debug clean-add-plugin clean-add-plugin-debug \
- clean-bootstrap-directory clean-native-ecj clean-desktop-files
+ clean-bootstrap-directory clean-native-ecj clean-desktop-files clean-netx-docs clean-docs clean-plugin-docs
 
 install-exec-local:
 	mkdir -p $(DESTDIR)$(bindir)
@@ -96,6 +113,13 @@
 	mkdir -p $(DESTDIR)$(prefix)/man/man1
 	cp $(NETX_SRCDIR)/javaws.1 $(DESTDIR)$(prefix)/man/man1
 	cp $(NETX_RESOURCE_DIR)/about.jnlp $(DESTDIR)$(prefix)/jre/lib
+if ENABLE_DOCS
+	mkdir -p $(DESTDIR)$(htmldir)
+	cp -pPRf ${abs_top_builddir}/docs/netx $(DESTDIR)$(htmldir)
+if ENABLE_PLUGIN
+	cp -pPRf ${abs_top_builddir}/docs/plugin $(DESTDIR)$(htmldir)
+endif
+endif
 
 uninstall-local:
 	rm -f $(DESTDIR)$(prefix)/jre/lib/$(INSTALL_ARCH_DIR)/IcedTeaPlugin.so
@@ -285,6 +309,48 @@
 javaws.desktop: javaws.desktop.in
 	sed "s#PATH_TO_JAVAWS#$(DESTDIR)$(bindir)/javaws#" < $(srcdir)/javaws.desktop.in > javaws.desktop
 
+# documentation
+
+stamps/docs.stamp: stamps/netx-docs.stamp stamps/plugin-docs.stamp
+	touch stamps/docs.stamp
+
+clean-docs: clean-netx-docs clean-plugin-docs
+	rm -f stamps/docs.stamp
+
+stamps/netx-docs.stamp: stamps/bootstrap-directory.stamp
+if ENABLE_DOCS
+	$(BOOT_DIR)/bin/javadoc $(JAVADOC_MEM_OPTS) $(JAVADOC_OPTS) \
+	 -d ${abs_top_builddir}/docs/netx -sourcepath $(NETX_SRCDIR) \
+	 -doctitle 'IcedTea-Web: NetX API Specification' \
+	 -windowtitle 'IcedTea-Web: NetX ' \
+	 -header '<strong>IcedTea-Web<br/>NetX</strong>' \
+	 $(NETX_PKGS)
+endif
+	mkdir -p stamps
+	touch stamps/netx-docs.stamp
+
+clean-netx-docs:
+	rm -rf ${abs_top_builddir}/docs/netx
+	rm -f stamps/netx-docs.stamp
+
+stamps/plugin-docs.stamp: stamps/bootstrap-directory.stamp
+if ENABLE_DOCS
+if ENABLE_PLUGIN
+	$(BOOT_DIR)/bin/javadoc $(JAVADOC_MEM_OPTS) $(JAVADOC_OPTS) \
+	 -d ${abs_top_builddir}/docs/plugin -sourcepath $(NETX_SRCDIR):$(LIVECONNECT_SRCS) \
+	 -doctitle 'IcedTea-Web: Plugin API Specification' \
+	 -windowtitle 'IcedTea-Web: Plugin ' \
+	 -header '<strong>IcedTea-Web<br/>Plugin</strong>' \
+	 $(PLUGIN_PKGS)
+endif
+endif
+	mkdir -p stamps
+	touch stamps/plugin-docs.stamp
+
+clean-plugin-docs:
+	rm -rf ${abs_top_builddir}/docs/plugin
+	rm -f stamps/plugin-docs.stamp
+
 # plugin tests
 
 if ENABLE_PLUGIN
@@ -323,6 +389,7 @@
 	mkdir -p $(BOOT_DIR)/bin stamps/
 	ln -sf $(JAR) $(BOOT_DIR)/bin/jar
 	ln -sf $(abs_top_builddir)/javac $(BOOT_DIR)/bin/javac
+	ln -sf $(JAVADOC) $(BOOT_DIR)/bin/javadoc
 	mkdir -p $(BOOT_DIR)/jre/lib && \
 	ln -s $(SYSTEM_JDK_DIR)/jre/lib/rt.jar $(BOOT_DIR)/jre/lib && \
 	if [ -e $(SYSTEM_JDK_DIR)/jre/lib/jsse.jar ] ; then \
--- a/acinclude.m4	Thu Nov 25 12:45:55 2010 -0500
+++ b/acinclude.m4	Fri Nov 26 15:21:56 2010 +0000
@@ -543,3 +543,65 @@
   AC_MSG_RESULT(${JAVA})
   AC_SUBST(JAVA)
 ])
+
+AC_DEFUN([IT_FIND_JAVADOC],
+[
+  AC_REQUIRE([IT_CHECK_FOR_JDK])
+  AC_MSG_CHECKING([for javadoc])
+  AC_ARG_WITH([javadoc],
+              [AS_HELP_STRING(--with-javadoc,specify location of Java documentation tool (javadoc))],
+  [
+    JAVADOC="${withval}"
+  ],
+  [
+    JAVADOC=${SYSTEM_JDK_DIR}/bin/javadoc
+  ])
+  if ! test -f "${JAVADOC}"; then
+    AC_PATH_PROG(JAVADOC, "${JAVADOC}")
+  fi
+  if test -z "${JAVADOC}"; then
+    AC_PATH_PROG(JAVADOC, "javadoc")
+  fi
+  if test -z "${JAVADOC}"; then
+    AC_PATH_PROG(JAVADOC, "gjdoc")
+  fi
+  if test -z "${JAVADOC}" && test "x$ENABLE_DOCS" = "xyes"; then
+    AC_MSG_ERROR("No Java documentation tool was found.")
+  fi
+  AC_MSG_RESULT(${JAVADOC})
+  AC_MSG_CHECKING([whether javadoc supports -J options])
+  CLASS=pkg/Test.java
+  mkdir tmp.$$
+  cd tmp.$$
+  mkdir pkg
+  cat << \EOF > $CLASS
+[/* [#]line __oline__ "configure" */
+package pkg;
+
+public class Test
+{
+  /**
+   * Does stuff.
+   *
+   *
+   * @param args arguments from cli.
+   */
+  public static void main(String[] args)
+  {
+    System.out.println("Hello World!");
+  }
+}
+]
+EOF
+  if $JAVADOC -J-Xmx896m pkg >&AS_MESSAGE_LOG_FD 2>&1; then
+    JAVADOC_KNOWS_J_OPTIONS=yes
+  else
+    JAVADOC_KNOWS_J_OPTIONS=no
+  fi
+  cd ..
+  rm -rf tmp.$$
+  AC_MSG_RESULT([${JAVADOC_KNOWS_J_OPTIONS}])
+  AC_SUBST(JAVADOC)
+  AC_SUBST(JAVADOC_KNOWS_J_OPTIONS)
+  AM_CONDITIONAL([JAVADOC_SUPPORTS_J_OPTIONS], test x"${JAVADOC_KNOWS_J_OPTIONS}" = "xyes")
+])
--- a/configure.ac	Thu Nov 25 12:45:55 2010 -0500
+++ b/configure.ac	Fri Nov 26 15:21:56 2010 +0000
@@ -32,6 +32,7 @@
 FIND_JAVAC
 FIND_JAR
 FIND_ECJ_JAR
+IT_FIND_JAVADOC
 AC_CONFIG_FILES([javac], [chmod +x javac])
 
 IT_GET_PKGVERSION