Template
feat: self-host configure generation for stupidtools
Wire the full pipeline into the binary: parse + validate the KDL buildfile, discover extensions, bridge Lua, detect the C toolchain, and emit ./configure. Adds the project's own stupid.kdl build file and a temp-dir-isolated self-host integration test proving the generated configure + make rebuild the tool with -std=c23. tests/run.sh tests 6+8 re-pin the interim 'accepted, no read' CLI assertions to the wired 'missing buildfile -> exit 1' behavior.
This commit is contained in:
+79
@@ -0,0 +1,79 @@
|
||||
/* stupid.kdl - stupidtools' OWN build file (todo 23: self-host).
|
||||
*
|
||||
* The project describes itself in its own DSL. This is a sibling of
|
||||
* tests/fixtures/stupid.kdl (the todo-9 grammar fixture): richer, with the
|
||||
* REAL source list, so `src/stupidtools stupid.kdl` generates a ./configure
|
||||
* that can rebuild the tool end to end. The autotools path (configure.ac +
|
||||
* Makefile.am) remains the bootstrap; this file is what the self-host test
|
||||
* (tests/selfhost.sh) drives.
|
||||
*
|
||||
* DSL grammar (src/kdl/schema.h): `project` first, then targets/features/
|
||||
* options. The `target` source list is descriptive in v1 (the generated
|
||||
* configure substitutes @VAR@ into a user-provided Makefile.in; it does not
|
||||
* generate a Makefile) but lists every translation unit so the self-host
|
||||
* Makefile.in can compile them all. */
|
||||
|
||||
project "stupidtools" version "1.0.0"
|
||||
|
||||
// The POSIX surface the tool itself relies on (fork/exec/pipe/readdir for
|
||||
// detection and discovery). A real check: the generated configure probes
|
||||
// unistd.h with the detected C compiler.
|
||||
feature "posix" {
|
||||
header "unistd.h"
|
||||
}
|
||||
|
||||
// The one artifact: every translation unit of the tool, plus the posix
|
||||
// feature it needs at build time.
|
||||
target "default" {
|
||||
src "src/main.c"
|
||||
src "src/cli.c"
|
||||
src "src/error.c"
|
||||
src "src/span.c"
|
||||
src "src/kdl/lexer.c"
|
||||
src "src/kdl/parser.c"
|
||||
src "src/kdl/value.c"
|
||||
src "src/kdl/schema.c"
|
||||
src "src/detect/check_registry.c"
|
||||
src "src/detect/checks.c"
|
||||
src "src/detect/probe.c"
|
||||
src "src/detect/resolve.c"
|
||||
src "src/gen/sh_emit.c"
|
||||
src "src/gen/configure.c"
|
||||
src "src/gen/config.c"
|
||||
src "src/gen/args.c"
|
||||
src "src/ext/discovery.c"
|
||||
src "src/ext/lua.c"
|
||||
src "src/ext/abi.c"
|
||||
src "src/ext/api.c"
|
||||
src "src/ext/lang_c.c"
|
||||
src "src/ext/lang_cpp.c"
|
||||
src "thirdparty/lua/lapi.c"
|
||||
src "thirdparty/lua/lauxlib.c"
|
||||
src "thirdparty/lua/lbaselib.c"
|
||||
src "thirdparty/lua/lcode.c"
|
||||
src "thirdparty/lua/lctype.c"
|
||||
src "thirdparty/lua/ldebug.c"
|
||||
src "thirdparty/lua/ldo.c"
|
||||
src "thirdparty/lua/ldump.c"
|
||||
src "thirdparty/lua/lfunc.c"
|
||||
src "thirdparty/lua/lgc.c"
|
||||
src "thirdparty/lua/llex.c"
|
||||
src "thirdparty/lua/lmem.c"
|
||||
src "thirdparty/lua/lobject.c"
|
||||
src "thirdparty/lua/lopcodes.c"
|
||||
src "thirdparty/lua/lparser.c"
|
||||
src "thirdparty/lua/lstate.c"
|
||||
src "thirdparty/lua/lstring.c"
|
||||
src "thirdparty/lua/ltable.c"
|
||||
src "thirdparty/lua/ltm.c"
|
||||
src "thirdparty/lua/lundump.c"
|
||||
src "thirdparty/lua/lvm.c"
|
||||
src "thirdparty/lua/lzio.c"
|
||||
src "thirdparty/lua/lstrlib.c"
|
||||
src "thirdparty/lua/ltablib.c"
|
||||
feature "posix"
|
||||
}
|
||||
|
||||
// --enable-debug / --disable-debug (default off), like configure.ac's
|
||||
// release/debug split.
|
||||
option "debug" default=#false
|
||||
Reference in New Issue
Block a user