docs/cookbook/redoconf-simple: a simple redoconf C++ project.

This is a little simpler than the docs/cookbook/c project, which
doesn't actually have a doc yet because there was too much to explain.
I think I might make that a follow-on cookbook chapter, for people who
have read this simple one.

I think this doc is maybe a little too long; I intended it to be
"here's what you do to get started" but it turned into "here's what you
do to get started, and why it works, in excruciating detail." Not quite
sure how to fix.

(Also updated some other parts of the docs to refer to redoconf as a
real thing now instead of a "maybe someone should write this" thing.)
This commit is contained in:
Avery Pennarun 2019-03-05 23:33:11 -05:00
commit e24e045a07
26 changed files with 1025 additions and 46 deletions

View file

@ -0,0 +1,33 @@
# Run a simple test of our hello binary.
#
# The 'run' script is automatically generated by
# redoconf when requested (by redo-ifchange) and if
# it's possible (ie. we are not cross compiling). A
# typical project might choose to fail if it is not
# available, but because this script runs as part of
# the redo source tree, we'll skip the test politely
# if it's not possible to run.
# 'test' is a target you always want to run when
# requested, even if it passes.
redo-always
# Make sure the program (all) is built, and that the
# redoconf program runner (run) is built, if possible.
redo-ifchange all run
# Test the program only if redoconf knows how to run
# produced binaries. It will try to run programs directly,
# or try wine if you are cross-compiling windows programs.
# If the run script is nonexistent (run.od didn't produce
# output), we'll skip it, because we are presumably cross
# compiling for an incompatible platform.
if [ -x ./run ]; then
./run ./hello | tee "$3" >&2
if ! grep "^Hello" "$3" >/dev/null; then
echo "Hello program did not say hello!" >&2
exit 10
fi
else
echo "Non-native platform: test skipped." >&2
fi