8207365: Make man pages optional
authorerikj
Fri, 20 Jul 2018 09:07:37 -0700
changeset 51215 936823fcf202
parent 51214 67736b4846a0
child 51216 e429a304c97d
8207365: Make man pages optional Reviewed-by: tbell
make/Images.gmk
make/autoconf/configure.ac
make/autoconf/jdk-options.m4
make/autoconf/spec.gmk.in
make/conf/jib-profiles.js
--- a/make/Images.gmk	Fri Jul 20 09:46:57 2018 +0200
+++ b/make/Images.gmk	Fri Jul 20 09:07:37 2018 -0700
@@ -121,115 +121,117 @@
 #
 # Avoid evaluating this whole section on windows for speed and stability
 ifneq ($(OPENJDK_TARGET_OS), windows)
-  JRE_MAN_PAGES += \
-      java.1 \
-      jjs.1 \
-      keytool.1 \
-      orbd.1 \
-      pack200.1 \
-      rmid.1 \
-      rmiregistry.1 \
-      servertool.1 \
-      unpack200.1
+  ifeq ($(BUILD_MANPAGES), true)
+    JRE_MAN_PAGES += \
+        java.1 \
+        jjs.1 \
+        keytool.1 \
+        orbd.1 \
+        pack200.1 \
+        rmid.1 \
+        rmiregistry.1 \
+        servertool.1 \
+        unpack200.1
 
-  JDK_MAN_PAGES += \
-      $(JRE_MAN_PAGES) \
-      idlj.1 \
-      jar.1 \
-      jarsigner.1 \
-      javac.1 \
-      javadoc.1 \
-      javap.1 \
-      jconsole.1 \
-      jcmd.1 \
-      jdb.1 \
-      jdeps.1 \
-      jinfo.1 \
-      jmap.1 \
-      jps.1 \
-      jrunscript.1 \
-      jstack.1 \
-      jstat.1 \
-      jstatd.1 \
-      rmic.1 \
-      serialver.1
+    JDK_MAN_PAGES += \
+        $(JRE_MAN_PAGES) \
+        idlj.1 \
+        jar.1 \
+        jarsigner.1 \
+        javac.1 \
+        javadoc.1 \
+        javap.1 \
+        jconsole.1 \
+        jcmd.1 \
+        jdb.1 \
+        jdeps.1 \
+        jinfo.1 \
+        jmap.1 \
+        jps.1 \
+        jrunscript.1 \
+        jstack.1 \
+        jstat.1 \
+        jstatd.1 \
+        rmic.1 \
+        serialver.1
 
-  # This variable is potentially overridden in the closed makefile.
-  MAN_SRC_BASEDIR ?= $(TOPDIR)/src
+    # This variable is potentially overridden in the closed makefile.
+    MAN_SRC_BASEDIR ?= $(TOPDIR)/src
 
-  ifeq ($(OPENJDK_TARGET_OS), linux)
-    MAN_SRC_DIR = $(MAN_SRC_BASEDIR)/linux/doc
-    MAN1_SUBDIR = man
-  endif
-  ifeq ($(OPENJDK_TARGET_OS), solaris)
-    MAN_SRC_DIR = $(MAN_SRC_BASEDIR)/solaris/doc
-    MAN1_SUBDIR = sun/man/man1
-  endif
-  ifeq ($(OPENJDK_TARGET_OS), macosx)
-    MAN_SRC_DIR = $(MAN_SRC_BASEDIR)/bsd/doc
-    MAN1_SUBDIR = man
-  endif
+    ifeq ($(OPENJDK_TARGET_OS), linux)
+      MAN_SRC_DIR = $(MAN_SRC_BASEDIR)/linux/doc
+      MAN1_SUBDIR = man
+    endif
+    ifeq ($(OPENJDK_TARGET_OS), solaris)
+      MAN_SRC_DIR = $(MAN_SRC_BASEDIR)/solaris/doc
+      MAN1_SUBDIR = sun/man/man1
+    endif
+    ifeq ($(OPENJDK_TARGET_OS), macosx)
+      MAN_SRC_DIR = $(MAN_SRC_BASEDIR)/bsd/doc
+      MAN1_SUBDIR = man
+    endif
 
-  $(JRE_IMAGE_DIR)/man/man1/%: $(MAN_SRC_DIR)/$(MAN1_SUBDIR)/%
+    $(JRE_IMAGE_DIR)/man/man1/%: $(MAN_SRC_DIR)/$(MAN1_SUBDIR)/%
 	$(call LogInfo, Copying $(patsubst $(OUTPUTDIR)/%,%,$@))
 	$(install-file)
 
-  $(JDK_IMAGE_DIR)/man/man1/%: $(MAN_SRC_DIR)/$(MAN1_SUBDIR)/%
+    $(JDK_IMAGE_DIR)/man/man1/%: $(MAN_SRC_DIR)/$(MAN1_SUBDIR)/%
 	$(call LogInfo, Copying $(patsubst $(OUTPUTDIR)/%,%,$@))
 	$(install-file)
 
-  $(JRE_IMAGE_DIR)/man/ja_JP.UTF-8/man1/%: $(MAN_SRC_DIR)/$(MAN1_SUBDIR)/ja/%
+    $(JRE_IMAGE_DIR)/man/ja_JP.UTF-8/man1/%: $(MAN_SRC_DIR)/$(MAN1_SUBDIR)/ja/%
 	$(call LogInfo, Copying $(patsubst $(OUTPUTDIR)/%,%,$@))
 	$(install-file)
 
-  $(JDK_IMAGE_DIR)/man/ja_JP.UTF-8/man1/%: $(MAN_SRC_DIR)/$(MAN1_SUBDIR)/ja/%
+    $(JDK_IMAGE_DIR)/man/ja_JP.UTF-8/man1/%: $(MAN_SRC_DIR)/$(MAN1_SUBDIR)/ja/%
 	$(call LogInfo, Copying $(patsubst $(OUTPUTDIR)/%,%,$@))
 	$(install-file)
 
-  ifeq ($(OPENJDK_TARGET_OS), solaris)
-    $(JRE_IMAGE_DIR)/man/ja/man1/%: $(MAN_SRC_DIR)/$(MAN1_SUBDIR)/ja/%
+    ifeq ($(OPENJDK_TARGET_OS), solaris)
+      $(JRE_IMAGE_DIR)/man/ja/man1/%: $(MAN_SRC_DIR)/$(MAN1_SUBDIR)/ja/%
 	$(call LogInfo, Converting $(patsubst $(OUTPUTDIR)/%,%,$@))
 	$(install-file)
 
-    $(JDK_IMAGE_DIR)/man/ja/man1/%: $(MAN_SRC_DIR)/$(MAN1_SUBDIR)/ja/%
+      $(JDK_IMAGE_DIR)/man/ja/man1/%: $(MAN_SRC_DIR)/$(MAN1_SUBDIR)/ja/%
 	$(call LogInfo, Converting $(patsubst $(OUTPUTDIR)/%,%,$@))
 	$(install-file)
-  endif
+    endif
 
-  ifneq ($(findstring $(OPENJDK_TARGET_OS), linux macosx), )
-    $(JRE_IMAGE_DIR)/man/ja:
+    ifneq ($(findstring $(OPENJDK_TARGET_OS), linux macosx), )
+      $(JRE_IMAGE_DIR)/man/ja:
 	$(call LogInfo, Creating $(patsubst $(OUTPUTDIR)/%,%,$@))
 	$(CD) $(@D) && $(RM) ja && $(LN) -s ja_JP.UTF-8 ja
 
-    $(JDK_IMAGE_DIR)/man/ja:
+      $(JDK_IMAGE_DIR)/man/ja:
 	$(call LogInfo, Creating $(patsubst $(OUTPUTDIR)/%,%,$@))
 	$(CD) $(@D) && $(RM) ja && $(LN) -s ja_JP.UTF-8 ja
-  endif
+    endif
 
-  ifeq ($(OPENJDK_TARGET_OS), solaris)
-    JRE_MAN_PAGE_LIST = $(addprefix $(JRE_IMAGE_DIR)/man/man1/, $(JRE_MAN_PAGES)) \
-        $(addprefix $(JRE_IMAGE_DIR)/man/ja/man1/, $(JRE_MAN_PAGES)) \
-        $(addprefix $(JRE_IMAGE_DIR)/man/ja_JP.UTF-8/man1/, $(JRE_MAN_PAGES)) \
-        $(addprefix $(JRE_IMAGE_DIR)/man/ja_JP.PCK/man1/, $(JRE_MAN_PAGES))
+    ifeq ($(OPENJDK_TARGET_OS), solaris)
+      JRE_MAN_PAGE_LIST = $(addprefix $(JRE_IMAGE_DIR)/man/man1/, $(JRE_MAN_PAGES)) \
+          $(addprefix $(JRE_IMAGE_DIR)/man/ja/man1/, $(JRE_MAN_PAGES)) \
+          $(addprefix $(JRE_IMAGE_DIR)/man/ja_JP.UTF-8/man1/, $(JRE_MAN_PAGES)) \
+          $(addprefix $(JRE_IMAGE_DIR)/man/ja_JP.PCK/man1/, $(JRE_MAN_PAGES))
+
+      JDK_MAN_PAGE_LIST = $(addprefix $(JDK_IMAGE_DIR)/man/man1/, $(JDK_MAN_PAGES)) \
+          $(addprefix $(JDK_IMAGE_DIR)/man/ja/man1/, $(JDK_MAN_PAGES)) \
+          $(addprefix $(JDK_IMAGE_DIR)/man/ja_JP.UTF-8/man1/, $(JDK_MAN_PAGES)) \
+          $(addprefix $(JDK_IMAGE_DIR)/man/ja_JP.PCK/man1/, $(JDK_MAN_PAGES))
+    endif
 
-    JDK_MAN_PAGE_LIST = $(addprefix $(JDK_IMAGE_DIR)/man/man1/, $(JDK_MAN_PAGES)) \
-        $(addprefix $(JDK_IMAGE_DIR)/man/ja/man1/, $(JDK_MAN_PAGES)) \
-        $(addprefix $(JDK_IMAGE_DIR)/man/ja_JP.UTF-8/man1/, $(JDK_MAN_PAGES)) \
-        $(addprefix $(JDK_IMAGE_DIR)/man/ja_JP.PCK/man1/, $(JDK_MAN_PAGES))
-  endif
+    ifneq ($(findstring $(OPENJDK_TARGET_OS), linux macosx), )
+      JRE_MAN_PAGE_LIST = $(addprefix $(JRE_IMAGE_DIR)/man/man1/, $(JRE_MAN_PAGES)) \
+          $(addprefix $(JRE_IMAGE_DIR)/man/ja_JP.UTF-8/man1/, $(JRE_MAN_PAGES)) \
+          $(JRE_IMAGE_DIR)/man/ja
 
-  ifneq ($(findstring $(OPENJDK_TARGET_OS), linux macosx), )
-    JRE_MAN_PAGE_LIST = $(addprefix $(JRE_IMAGE_DIR)/man/man1/, $(JRE_MAN_PAGES)) \
-        $(addprefix $(JRE_IMAGE_DIR)/man/ja_JP.UTF-8/man1/, $(JRE_MAN_PAGES)) \
-        $(JRE_IMAGE_DIR)/man/ja
+      JDK_MAN_PAGE_LIST = $(addprefix $(JDK_IMAGE_DIR)/man/man1/, $(JDK_MAN_PAGES)) \
+          $(addprefix $(JDK_IMAGE_DIR)/man/ja_JP.UTF-8/man1/, $(JDK_MAN_PAGES)) \
+          $(JDK_IMAGE_DIR)/man/ja
+    endif
 
-    JDK_MAN_PAGE_LIST = $(addprefix $(JDK_IMAGE_DIR)/man/man1/, $(JDK_MAN_PAGES)) \
-        $(addprefix $(JDK_IMAGE_DIR)/man/ja_JP.UTF-8/man1/, $(JDK_MAN_PAGES)) \
-        $(JDK_IMAGE_DIR)/man/ja
-  endif
-
-  JRE_TARGETS += $(JRE_MAN_PAGE_LIST)
-  JDK_TARGETS += $(JDK_MAN_PAGE_LIST)
+    JRE_TARGETS += $(JRE_MAN_PAGE_LIST)
+    JDK_TARGETS += $(JDK_MAN_PAGE_LIST)
+  endif # BUILD_MANPAGES
 endif # Windows
 
 ################################################################################
--- a/make/autoconf/configure.ac	Fri Jul 20 09:46:57 2018 +0200
+++ b/make/autoconf/configure.ac	Fri Jul 20 09:07:37 2018 -0700
@@ -233,6 +233,7 @@
 JDKOPT_ENABLE_DISABLE_FAILURE_HANDLER
 JDKOPT_ENABLE_DISABLE_GENERATE_CLASSLIST
 JDKOPT_EXCLUDE_TRANSLATIONS
+JDKOPT_ENABLE_DISABLE_MANPAGES
 
 ###############################################################################
 #
--- a/make/autoconf/jdk-options.m4	Fri Jul 20 09:46:57 2018 +0200
+++ b/make/autoconf/jdk-options.m4	Fri Jul 20 09:07:37 2018 -0700
@@ -604,3 +604,29 @@
 
   AC_SUBST(EXCLUDE_TRANSLATIONS)
 ])
+
+################################################################################
+#
+# Optionally disable man pages
+#
+AC_DEFUN([JDKOPT_ENABLE_DISABLE_MANPAGES],
+[
+  AC_ARG_ENABLE([manpages], [AS_HELP_STRING([--disable-manpages],
+      [Set to disable building of man pages @<:@enabled@:>@])])
+
+  BUILD_MANPAGES="true"
+  AC_MSG_CHECKING([if man pages should be built])
+  if test "x$enable_manpages" = "x"; then
+    AC_MSG_RESULT([yes])
+  elif test "x$enable_manpages" = "xyes"; then
+    AC_MSG_RESULT([yes, forced])
+  elif test "x$enable_manpages" = "xno"; then
+    AC_MSG_RESULT([no, forced])
+    BUILD_MANPAGES="false"
+  else
+    AC_MSG_RESULT([no])
+    AC_MSG_ERROR([--enable-manpages can only yes/no or empty])
+  fi
+
+  AC_SUBST(BUILD_MANPAGES)
+])
--- a/make/autoconf/spec.gmk.in	Fri Jul 20 09:46:57 2018 +0200
+++ b/make/autoconf/spec.gmk.in	Fri Jul 20 09:07:37 2018 -0700
@@ -305,6 +305,8 @@
 
 EXCLUDE_TRANSLATIONS := @EXCLUDE_TRANSLATIONS@
 
+BUILD_MANPAGES := @BUILD_MANPAGES@
+
 # The boot jdk to use. This is overridden in bootcycle-spec.gmk. Make sure to keep
 # it in sync.
 BOOT_JDK:=@BOOT_JDK@
--- a/make/conf/jib-profiles.js	Fri Jul 20 09:46:57 2018 +0200
+++ b/make/conf/jib-profiles.js	Fri Jul 20 09:07:37 2018 -0700
@@ -243,6 +243,7 @@
         default_make_targets: ["product-bundles", "test-bundles"],
         configure_args: concat(["--enable-jtreg-failure-handler"],
             "--with-exclude-translations=de,es,fr,it,ko,pt_BR,sv,ca,tr,cs,sk,ja_JP_A,ja_JP_HA,ja_JP_HI,ja_JP_I,zh_TW,zh_HK",
+            "--disable-manpages",
             versionArgs(input, common))
     };
     // Extra settings for debug profiles