From d3e73aafe91df8bd03a3272f9ff68ffcc8055618 Mon Sep 17 00:00:00 2001
From: Aleksander Alekseev <aleksander@timescale.com>
Date: Mon, 30 Jan 2023 14:39:41 +0300
Subject: [PATCH v2 1/2] Update the documentation build instruction for macOS

The build of the documentation on macOS is known to fail without specifying
extra environment variables when using xsltproc installed via Homebrew
or the one shipped with the system (but not the MacPorts version). Update
the build instruction accordingly.

Also recommend installing libxml2 and libxslt packages for both Homebrew and
MacPorts. For Homebrew it doesn't make much difference but MacPorts users will
get the versions of xsltproc and xmllint that work without setting additional
environment variables.

Aleksander Alekseev, Tom Lane, Peter Eisentraut
Discussion: https://postgr.es/m/CAJ7c6TO8Aro2nxg%3DEQsVGiSDe-TstP4EsSvDHd7DSRsP40PgGA%40mail.gmail.com
---
 doc/src/sgml/docguide.sgml | 18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)

diff --git a/doc/src/sgml/docguide.sgml b/doc/src/sgml/docguide.sgml
index 787caef70d..31af5eb8b5 100644
--- a/doc/src/sgml/docguide.sgml
+++ b/doc/src/sgml/docguide.sgml
@@ -216,13 +216,27 @@ apt-get install docbook-xml docbook-xsl fop libxml2-utils xsltproc
    <para>
     If you use MacPorts, the following will get you set up:
 <programlisting>
-sudo port install docbook-xml-4.5 docbook-xsl fop
+sudo port install libxml2 libxslt docbook-xml docbook-xsl-nons fop
 </programlisting>
     If you use Homebrew, use this:
 <programlisting>
-brew install docbook docbook-xsl fop
+brew install libxml2 libxslt docbook docbook-xsl fop
 </programlisting>
    </para>
+   <para>
+    In case of Homebrew additionally the following environment variable should be set:
+<programlisting>
+export XML_CATALOG_FILES=/usr/local/etc/xml/catalog
+</programlisting>
+    Without it <command>xltproc</command> will throw errors like this:
+<programlisting>
+error : Unknown IO error
+warning: failed to load external entity
+  "http://docbook.sourceforge.net/release/xsl/current/xhtml/chunk.xsl"
+...
+</programlisting>
+   If you use MacPorts you don't have to set <command>XML_CATALOG_FILES</command>.
+   </para>
   </sect2>
 
   <sect2 id="docguide-toolsets-configure">
-- 
2.39.1

