public inbox for [email protected]
help / color / mirror / Atom feedFrom: Tristan Partin <[email protected]>
To: pgsql-hackers <[email protected]>
Subject: Add html-serve target to autotools and meson
Date: Thu, 07 Nov 2024 04:37:22 +0000
Message-ID: <[email protected]> (raw)
When working on documentation, I find it useful to spawn an HTTP server
to serve docs for me to consume in a web browser. I went ahead and used
Python's builtin http.server module, but it could also be a run target
which just spawned `xdg-open builddir/doc/src/sgml/html/index.html`,
though I would doubt Windows has xdg-open(1).
The one controversial part of this patch might be using "port" 0, which
asks the kernel to assign an unused port. I'm not sure if that exists on
Windows, or is even desireable. Should we have a build option for the
port? What would a good default be?
--
Tristan Partin
Neon (https://neon.tech)
Attachments:
[text/x-patch] html-serve.diff (1.2K, ../[email protected]/2-html-serve.diff)
download | inline diff:
diff --git a/doc/src/sgml/Makefile b/doc/src/sgml/Makefile
index a04c532b53..6f629e02a7 100644
--- a/doc/src/sgml/Makefile
+++ b/doc/src/sgml/Makefile
@@ -130,6 +130,9 @@ html-stamp: stylesheet.xsl postgres-full.xml $(ALL_IMAGES)
$(XSLTPROC) $(XMLINCLUDE) $(XSLTPROCFLAGS) $(XSLTPROC_HTML_FLAGS) $(wordlist 1,2,$^)
touch $@
+html-serve: html
+ python3 -m http.server --directory '$(top_builddir)/$(subdir)/html' 0
+
# single-page HTML
postgres.html: stylesheet-html-nochunk.xsl postgres-full.xml $(ALL_IMAGES)
$(XSLTPROC) $(XMLINCLUDE) $(XSLTPROCFLAGS) $(XSLTPROC_HTML_FLAGS) -o $@ $(wordlist 1,2,$^)
diff --git a/doc/src/sgml/meson.build b/doc/src/sgml/meson.build
index e418de83a7..fa598d8ab1 100644
--- a/doc/src/sgml/meson.build
+++ b/doc/src/sgml/meson.build
@@ -154,6 +154,19 @@ if docs_dep.found()
alias_target('html', html)
alias_target('install-html', install_doc_html)
+ run_target(
+ 'html-serve',
+ command: [
+ python,
+ '-m',
+ 'http.server',
+ '--directory',
+ meson.current_build_dir() / 'html',
+ '0',
+ ],
+ depends: html,
+ )
+
# build and install multi-page html docs as part of docs target
docs += html
installdocs += install_doc_html
view thread (2+ messages)
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected]
Subject: Re: Add html-serve target to autotools and meson
In-Reply-To: <[email protected]>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox