version: print the build time and revision, not just 0.1.0
The release number does not move, so two builds - the tree and the
installed binary - looked identical in --version.
make now generates src/backend/buildinfo.c from the objects it stamps and
links it into libsplinter. The stamp is only rewritten when one of those
objects is newer, so a no-op make keeps the old time instead of pretending
the binary was rebuilt. The git revision is included, with -dirty when the
working tree differs from HEAD.
splinter 0.1.0 (built 2026-11-16 15:39:00 WET, 42c11f9)
buildinfo.c is a build artefact: gitignored and removed by make clean.
make check: all tests passed.
This commit is contained in:
1 parent
42c11f95c7
commit
573ef61afc
5 files changed
+43
-5
No files matched your search
@@ -17,6 +17,7 @@ tests/test_*
|
||||
# python bytecode from the test helpers
|
||||
__pycache__/
|
||||
src/backend/catalogs.c
|
||||
src/backend/buildinfo.c
|
||||
|
||||
# Claude Code worktrees and local session state
|
||||
.claude/
|
||||
|
||||
@@ -28,6 +28,8 @@ LIBOBJ = src/backend/buf.o src/backend/tool.o src/backend/session.o src/backend/
|
||||
src/backend/json.o src/backend/sse.o src/backend/openai.o src/backend/transport_openai.o \
|
||||
src/backend/anthropic.o src/backend/transport_anthropic.o src/backend/builtin.o \
|
||||
src/backend/agent.o src/backend/theme.o src/backend/palettes.o src/backend/decomp.o src/backend/i18n.o src/backend/delegate.o src/backend/telegram.o src/backend/log.o src/backend/cmdscript.o src/backend/folder.o src/backend/interview.o src/backend/ack.o src/backend/mcpserver.o src/backend/skills.o src/backend/memory.o src/backend/prompt.o src/backend/config.o src/backend/plugin.o src/backend/curl.o src/backend/swarm.o src/backend/provstate.o src/backend/md.o src/backend/tgmd.o src/backend/b64.o src/backend/a2aserver.o src/backend/providers.o src/backend/usage.o src/backend/confblock.o src/backend/agents.o src/backend/engine.o src/backend/http.o src/backend/openai_server.o src/backend/catalogs.o
|
||||
# buildinfo.o is separate: buildinfo.c is generated from the objects below.
|
||||
LIBOBJ_ALL = $(LIBOBJ) src/backend/buildinfo.o
|
||||
BIN = splinter
|
||||
BINOBJ = src/main.o src/frontend/curses.o src/frontend/protocol.o \
|
||||
src/frontend/ui_local.o src/frontend/ui_remote.o
|
||||
@@ -63,8 +65,22 @@ curses: $(CURSES_A)
|
||||
src/backend/catalogs.c: share/locale/de.msg share/locale/en.msg share/locale/pt_BR.msg tools/embed_catalogs.sh
|
||||
sh tools/embed_catalogs.sh share/locale/*.msg > $@
|
||||
|
||||
$(LIB): $(LIBOBJ) $(CURSES_A)
|
||||
$(CC) -shared -o $@ $(LIBOBJ) $(CURSES_A) $(LIBS)
|
||||
# The build stamp --version prints. It is regenerated only when one of the
|
||||
# objects it describes is newer, so a no-op make keeps the old stamp: the
|
||||
# stamp says when this binary was actually built, not when make last ran.
|
||||
# The revision is included because 0.1.0 does not tell two builds apart.
|
||||
src/backend/buildinfo.c: $(LIBOBJ) $(BINOBJ)
|
||||
@{ \
|
||||
rev=`git rev-parse --short HEAD 2>/dev/null` || rev=unknown; \
|
||||
if [ -n "`git status --porcelain --untracked-files=no 2>/dev/null | head -n 1`" ]; then \
|
||||
rev="$$rev-dirty"; \
|
||||
fi; \
|
||||
printf '/* generated by make: the build stamp of this binary */\nconst char *sp_build_time = "%s";\nconst char *sp_build_rev = "%s";\n' \
|
||||
"`date '+%Y-%m-%d %H:%M:%S %Z'`" "$$rev"; \
|
||||
} > $@
|
||||
|
||||
$(LIB): $(LIBOBJ_ALL) $(CURSES_A)
|
||||
$(CC) -shared -o $@ $(LIBOBJ_ALL) $(CURSES_A) $(LIBS)
|
||||
|
||||
# curses belongs to the front end, not to the library: a plugin that drew into
|
||||
# a WINDOW would be a plugin holding the UI thread's state.
|
||||
@@ -326,7 +342,7 @@ install: all
|
||||
@echo "installed $(DESTDIR)$(PREFIX)/bin/splinter"
|
||||
|
||||
clean:
|
||||
rm -f src/backend/catalogs.c $(BIN) $(CLIENT) $(LIB) $(LIBOBJ) $(BINOBJ) \
|
||||
rm -f src/backend/catalogs.c src/backend/buildinfo.c $(BIN) $(CLIENT) $(LIB) $(LIBOBJ_ALL) $(BINOBJ) \
|
||||
$(CLIENTOBJ) $(PLUGIN) $(TESTS) tests/plugin_lifecycle.so
|
||||
|
||||
.PHONY: all check curses install clean
|
||||
|
||||
+4
-1
@@ -155,7 +155,10 @@ Session directory (default
|
||||
Session id (default
|
||||
.Pa sess-<time>-<pid> ) .
|
||||
.It Fl V , -version
|
||||
Print the version and exit.
|
||||
Print the version, the build time and the git revision, then exit.
|
||||
The release number stays
|
||||
.Ql 0.1.0 ;
|
||||
the build stamp is what tells two builds apart.
|
||||
.El
|
||||
.Sh PROTOCOL
|
||||
.Nm
|
||||
|
||||
@@ -20,6 +20,14 @@
|
||||
|
||||
#define SP_VERSION "0.1.0"
|
||||
|
||||
/*
|
||||
* The build stamp of the binary. Generated by make into
|
||||
* src/backend/buildinfo.c, so --version says which build is running even
|
||||
* though the release number stays the same.
|
||||
*/
|
||||
extern const char *sp_build_time;
|
||||
extern const char *sp_build_rev;
|
||||
|
||||
/* ------------------------------------------------------------------ buffer */
|
||||
|
||||
struct sp_buf {
|
||||
|
||||
+11
-1
@@ -255,7 +255,17 @@ parse_args(int argc, char **argv, struct opts *o, struct sp_agent_config *cfg)
|
||||
usage(stdout);
|
||||
return 0;
|
||||
} else if (!strcmp(a, "-V") || !strcmp(a, "--version")) {
|
||||
printf("splinter %s\n", SP_VERSION);
|
||||
/*
|
||||
* The release number barely moves; the build stamp is what
|
||||
* tells an installed binary from the tree that was built
|
||||
* after it.
|
||||
*/
|
||||
if (sp_build_rev != NULL && sp_build_rev[0] != '\0')
|
||||
printf("splinter %s (built %s, %s)\n",
|
||||
SP_VERSION, sp_build_time, sp_build_rev);
|
||||
else
|
||||
printf("splinter %s (built %s)\n",
|
||||
SP_VERSION, sp_build_time);
|
||||
return 0;
|
||||
} else if (!strcmp(a, "-p") || !strcmp(a, "--prompt"))
|
||||
VALUE(o->prompt);
|
||||
|
||||
Reference in new issue
Block a user