I had an email from Chris Martin last month, suggesting that it was no
longer possible to build LibCSS on RISC OS due to the changes made for code
autogeneration. He wrote:
"So I had a go at updating my sources and rebuilding on my Iyonix.
Straight-forward except for one thing: the autogeneration of property
parsing code in libcss. The makefile relies on command substitution, so I
wrote a little RiscLua 4 script to do the equivalent job on RISC OS. I've
attached the script and my modified makefile so you can see exactly what I
"But now I'm not sure what to do with this modification. It lets
NetSurf be built on RISC OS as before (with the additional RiscLua 4
requirement). But is it a happy accident that NetSurf can still be
built on RISC OS at all? I'd guess that all other developers are now
using Linux exclusively and so don't have the problem of a shell
lacking command substitution capabilities."
This (LibCSS and the build system) is outside the areas that I'm familiar
with, and I haven't hit the problem as I don't build natively on RISC OS
anyway, so I don't know enough to answer Chris's second paragraph. I'm
happy to check the patch below in for him if those familiar with the
affected code are OK with it; failing that, if there's another way to fix
the issue then I'm sure Chris would be happy to go with that.
Comments from those who know LibCSS better than me are welcome. :-)
--- src/parse/properties/Makefile (revision 12411)
+++ src/parse/properties/Makefile (working copy)
@@ -35,8 +35,13 @@
$(DIR)autogenerated_$1.c: $(DIR)properties.gen $(BUILDDIR)/gen_parser
- $$(VQ)$$(ECHO) $$(ECHOFLAGS) "GENERATE: $$@"
+ $$(VQ)$$(ECHO) $$(ECHOFLAGS) "GENERATE: $$@ $1"
$$(Q)$$(BUILDDIR)/gen_parser -o $$@ '$(shell $(GREP) "^$1:"
+# I have written a RiscLua 4 script to do this job -- Christopher Martin
+ $$(Q)lua -- src.parse.properties.generate $$@ $1
AUTOGEN_SOURCES := $$(AUTOGEN_SOURCES) autogenerated_$1.c
--- src/parse/properties/generate (revision 0)
+++ src/parse/properties/generate (revision 0)
@@ -0,0 +1,40 @@
+This RiscLua 4 script performs the equivalent job of the following command
+run from the Makefile in this same folder:
+ $$(BUILDDIR)/gen_parser -o $$@ '$(shell $(GREP) "^$1:"
+Invoke it through the Makefile as follows:
+ lua -- src.parse.properties.generate $$@ $1
+Note that RiscLua doesn't understand Unix paths; we have to use RISC OS paths
+instead. This is a clunky solution but it runs well enough and emulates the
+original shell command. Remember that the Makefile is run when the root
+<libcss> folder is the CSD.
+ local !,r in swi
+ local xtndcl
+ local tgt = ("^%s:"):format(arg)
+ for line in io.lines() do
+ if line:match(tgt) then
+ xtndcl = line
+ if xtndcl then
+ xtndcl = ("-o %s '%s'"):format(arg, xtndcl)
+ r = 1 + #xtndcl
+ r = xtndcl
+ r = "run build-riscos-riscos-release-lib-static.gen_parser"
Steve Fryatt - Leeds, England