From d39d2810121a52625d3950c8a4f53422243b46c2 Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Sat, 12 Jul 2025 15:40:57 -0400 Subject: Use `#embed` to embed the changelog in the binary and give access via --changelog --- src/tomo.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/tomo.c b/src/tomo.c index 187495ce..cf3508bd 100644 --- a/src/tomo.c +++ b/src/tomo.c @@ -71,7 +71,8 @@ static OptionalBool_t verbose = false, compile_exe = false, should_install = false, clean_build = false, - source_mapping = true; + source_mapping = true, + show_changelog = false; static OptionalText_t show_codegen = NONE_TEXT, @@ -96,6 +97,11 @@ static Text_t config_summary, // of that directory. as_owner = Text(""); +static const char changelog[] = { +#embed "../CHANGES.md" + , 0 +}; + static void transpile_header(env_t *base_env, Path_t path); static void transpile_code(env_t *base_env, Path_t path); static void compile_object_file(Path_t path); @@ -214,6 +220,7 @@ int main(int argc, char *argv[]) {"f", false, &Bool$info, &clean_build}, {"source-mapping", false, &Bool$info, &source_mapping}, {"m", false, &Bool$info, &source_mapping}, + {"changelog", false, &Bool$info, &show_changelog}, ); if (show_prefix) { @@ -221,6 +228,11 @@ int main(int argc, char *argv[]) return 0; } + if (show_changelog) { + print_inline(changelog); + return 0; + } + bool is_gcc = (system(String(cc, " -v 2>&1 | grep -q 'gcc version'")) == 0); if (is_gcc) { cflags = Texts(cflags, Text(" -fsanitize=signed-integer-overflow -fno-sanitize-recover" -- cgit v1.2.3