commit 56a2b320b55319de9f8e6239a1ead91d9fb655c0
parent 8231924a24f9ee2594744e26670205eeabe4d0d6
Author: Florian Dold <florian@dold.me>
Date: Tue, 4 May 2021 20:56:15 +0200
pass base URL to site generator
Diffstat:
2 files changed, 24 insertions(+), 16 deletions(-)
diff --git a/Makefile b/Makefile
@@ -61,13 +61,16 @@ locale: locale-update locale-compile
# Run the jinja2 templating engine to expand templates to HTML
# incorporating translations.
template: locale-compile
- $(python) ./make_site.py
+
+ env BASEURL=$(opt_baseurl) ./make_site.py
.PHONY: run
run: all
$(browser) http://0.0.0.0:8000/rendered/en &
$(python) -m http.server
+variant = $(opt_variant)
+
ifndef variant
$(error variant is not set)
endif
diff --git a/build-system/configure.py b/build-system/configure.py
@@ -4,20 +4,25 @@ from talerbuildconfig import *
b = BuildConfig()
b.enable_prefix()
-b.enable_variant()
b.enable_configmk()
-b.add_tool(PythonTool())
-b.add_tool(PyBabelTool())
-b.add_tool(PosixTool("cp"))
-b.add_tool(PosixTool("echo"))
-b.add_tool(PosixTool("env"))
-b.add_tool(PosixTool("printf"))
-b.add_tool(PosixTool("grep"))
-b.add_tool(PosixTool("mkdir"))
-b.add_tool(PosixTool("rm"))
-b.add_tool(PosixTool("sh"))
-b.add_tool(PosixTool("msgmerge"))
-b.add_tool(PosixTool("tsc"))
-b.add_tool(PosixTool("git"))
-b.add_tool(BrowserTool())
+b.use(Option("variant", "Variant (used as output directory)"))
+
+# Base URL for the site. Per default, the URL is the protocol-relative
+# root path.
+b.use(Option("baseurl", "Base URL that the site will run on", default="//", required=False))
+
+b.use(PythonTool())
+b.use(PyBabelTool())
+b.use(PosixTool("cp"))
+b.use(PosixTool("echo"))
+b.use(PosixTool("env"))
+b.use(PosixTool("printf"))
+b.use(PosixTool("grep"))
+b.use(PosixTool("mkdir"))
+b.use(PosixTool("rm"))
+b.use(PosixTool("sh"))
+b.use(PosixTool("msgmerge"))
+b.use(PosixTool("tsc"))
+b.use(PosixTool("git"))
+b.use(BrowserTool())
b.run()