6982174 Restrictive firewalls hurt X build ; need to force use of local docbook dtd's
authorAlan Coopersmith <Alan.Coopersmith@Oracle.COM>
Fri, 03 Sep 2010 14:53:34 -0700
changeset 1005 786292b46152
parent 1004 ec96eb610ee3
child 1006 3bc10c0f9e6a
6982174 Restrictive firewalls hurt X build ; need to force use of local docbook dtd's
open-src/doc/docbook-utils/Makefile
open-src/doc/docbook-utils/catalog.in
open-src/doc/docbook-utils/sgml.conf.in
open-src/doc/docbook-utils/sgmlwhich.in
--- a/open-src/doc/docbook-utils/Makefile	Tue Aug 31 09:37:30 2010 -0700
+++ b/open-src/doc/docbook-utils/Makefile	Fri Sep 03 14:53:34 2010 -0700
@@ -66,20 +66,62 @@
 MODULE_MAKE=$(GNUMAKE)
 MODULE_MAKE_SET=yes
 
-# Catalog generated to find SGML files
-CATALOG=$(SOURCE_DIR)/catalog
-
-# Need to use local catalog during build due to empty /etc/sgml/catalog
-# on OpenSolaris systems
-MODULE_BUILD_DEPS = $(CATALOG)
+# Need to use local catalog during build
+MODULE_BUILD_DEPS = install_catalog
 MODULE_ADD_INSTALL_TARGETS = install_catalog
 
 ### Include common rulesets
 include ../Makefile.inc
 
-$(CATALOG): catalog.in $(SOURCE_TARGETS)
-	sed 's%__sgmldir__%$(PROTODIR)$(X11_DIR)/share/sgml%' < catalog.in > $@
+.SUFFIXES: .in
+
+CATALOG=$(SOURCE_DIR)/catalog
+SGMLCONF=$(SOURCE_DIR)/sgml.conf
+SGMLWHICH=$(SOURCE_DIR)/bin/sgmlwhich
+
+TOOLS_SGML_DIR=$(TOOLS_DIR)/share/sgml
+
+TOOLS_CATALOG=$(TOOLS_SGML_DIR)/catalog
+TOOLS_SGMLCONF=$(TOOLS_SGML_DIR)/sgml.conf
+TOOLS_SGMLWHICH=$(TOOLS_DIR)/bin/sgmlwhich
+
+install_catalog: $(TOOLS_CATALOG) $(TOOLS_SGMLCONF) $(TOOLS_SGMLWHICH)
+
+$(TOOLS_CATALOG) $(TOOLS_SGMLCONF) $(TOOLS_SGMLWHICH): $(@D)
+$(TOOLS_DIR)/bin $(TOOLS_SGMLDIR):
+	mkdir -p $@
+
+# Wait until source tree is unpacked first before writing files into it
+$(CATALOG) $(SGMLCONF) $(SGMLWHICH): $(SOURCE_TARGETS)
 
-install_catalog: $(CATALOG)
-	mkdir -p $(MODULE_PREFIX)/share/sgml
-	cp -p $(CATALOG) $(MODULE_PREFIX)/share/sgml
+# Find the X11/defs.ent in the main proto area during the build
+# Add "OVERRIDE YES" tags to sgml catalogs to prefer local copies of
+# the DocBook DTDs over network fetches of them
+$(CATALOG): catalog.in
+	sed 's%__sgmldir__%$(PROTODIR)$(X11_DIR)/share/sgml%' < catalog.in > $@
+	@for srcdir in /usr/share/sgml/docbook/*-dtd-* ; do \
+	    ( destdir=$(TOOLS_SGML_DIR)/docbook/$${srcdir##*/docbook/} ; \
+	      $(START_CMD_ECHO) ; \
+	      rm -rf $$destdir ; \
+	      mkdir -p $$destdir ; ln -s $$srcdir/* $$destdir/ ; \
+	      rm -f $$destdir/catalog ; \
+	      print "OVERRIDE YES" > $$destdir/catalog ; \
+	      cat $$srcdir/catalog >> $$destdir/catalog ; \
+	      print "CATALOG \"$$destdir/catalog\"" >> $@ ) \
+	done
+
+$(TOOLS_CATALOG): $(CATALOG)
+	$(INSTALL_SCRIPT) -m 0444 $(CATALOG) $@
+
+# Find the other sgml files in the tools area during the build
+$(SGMLCONF): sgml.conf.in
+	sed 's%__sgmldir__%$(TOOLS_SGML_DIR)%' < sgml.conf.in > $@
+
+$(TOOLS_SGMLCONF): $(SGMLCONF)
+	$(INSTALL_SCRIPT) -m 0444 $(SGMLCONF) $@
+
+$(SGMLWHICH): sgmlwhich.in
+	sed 's%__sgmldir__%$(TOOLS_SGML_DIR)%' < sgmlwhich.in > $@
+
+$(TOOLS_SGMLWHICH): $(SGMLWHICH)
+	$(INSTALL_SCRIPT) -m 0755 $(SGMLWHICH) $@
--- a/open-src/doc/docbook-utils/catalog.in	Tue Aug 31 09:37:30 2010 -0700
+++ b/open-src/doc/docbook-utils/catalog.in	Fri Sep 03 14:53:34 2010 -0700
@@ -1,8 +1,6 @@
 OVERRIDE YES
 
 SYSTEM "X11/defs.ent" "__sgmldir__/X11/defs.ent"
-CATALOG "/etc/sgml/catalog"
-CATALOG "/usr/share/sgml/docbook/sgml-dtd-3.1-1.0-30.1/catalog"
 CATALOG "/usr/share/sgml/docbook/dsssl-stylesheets/catalog"
 CATALOG "/usr/share/sgml/sgml-iso-entities-8879.1986/catalog"
 CATALOG "/usr/share/sgml/openjade/catalog"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/open-src/doc/docbook-utils/sgml.conf.in	Fri Sep 03 14:53:34 2010 -0700
@@ -0,0 +1,24 @@
+#
+# Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the "Software"),
+# to deal in the Software without restriction, including without limitation
+# the rights to use, copy, modify, merge, publish, distribute, sublicense,
+# and/or sell copies of the Software, and to permit persons to whom the
+# Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice (including the next
+# paragraph) shall be included in all copies or substantial portions of the
+# Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+# DEALINGS IN THE SOFTWARE.
+#
+SGML_BASE_DIR=/usr/share/sgml
+SGML_CATALOGS_DIR=__sgmldir__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/open-src/doc/docbook-utils/sgmlwhich.in	Fri Sep 03 14:53:34 2010 -0700
@@ -0,0 +1,25 @@
+#! /bin/ksh93
+#
+# Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the "Software"),
+# to deal in the Software without restriction, including without limitation
+# the rights to use, copy, modify, merge, publish, distribute, sublicense,
+# and/or sell copies of the Software, and to permit persons to whom the
+# Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice (including the next
+# paragraph) shall be included in all copies or substantial portions of the
+# Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+# DEALINGS IN THE SOFTWARE.
+#
+
+print '__sgmldir__/sgml.conf'