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
mean.
"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. :-)
Index: src/parse/properties/Makefile
===================================================================
--- src/parse/properties/Makefile (revision 12411)
+++ src/parse/properties/Makefile (working copy)
@@ -35,8 +35,13 @@
define gen_prop_parser
$(DIR)autogenerated_$1.c: $(DIR)properties.gen $(BUILDDIR)/gen_parser
- $$(VQ)$$(ECHO) $$(ECHOFLAGS) "GENERATE: $$@"
+ $$(VQ)$$(ECHO) $$(ECHOFLAGS) "GENERATE: $$@ $1"
+ifneq ($(HOST),riscos)
$$(Q)$$(BUILDDIR)/gen_parser -o $$@ '$(shell $(GREP) "^$1:"
$(DIR)properties.gen)'
+else
+# I have written a RiscLua 4 script to do this job -- Christopher Martin
+ $$(Q)lua -- src.parse.properties.generate $$@ $1
+endif
AUTOGEN_SOURCES := $$(AUTOGEN_SOURCES) autogenerated_$1.c
Index: src/parse/properties/generate
===================================================================
--- src/parse/properties/generate (revision 0)
+++ src/parse/properties/generate (revision 0)
@@ -0,0 +1,40 @@
+#!risclua4
+--[[
+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:" $(DIR)properties.gen)'
+
+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.
+--]]
+do
+ local !,r in swi
+ local xtndcl
+ do
+ local tgt = ("^%s:"):format(arg[2])
+ io.input("src.parse.properties.properties/gen")
+ for line in io.lines() do
+ if line:match(tgt) then
+ xtndcl = line
+ break
+ end
+ end
+ io.input():close()
+ end
+ if xtndcl then
+ xtndcl = ("-o %s '%s'"):format(arg[1], xtndcl)
+ r[0] = 1 + #xtndcl
+ !"DDEUtils_SetCLSize"
+ r[0] = xtndcl
+ !"DDEUtils_SetCL"
+ r[0] = "run build-riscos-riscos-release-lib-static.gen_parser"
+ !"OS_CLI"
+ end
+end
--
Steve Fryatt - Leeds, England
http://www.stevefryatt.org.uk/