From 6dac66008d2617d7eb4bd6efa09a2c7de47944b4 Mon Sep 17 00:00:00 2001 From: Michael Smith Date: Thu, 6 Jan 2022 23:04:26 +0000 Subject: Fix build scripts and codegen on Linux SST itself doesn't build, but it's a start! Really interesting is the declaration after a switch label. That's of course invalid, but Clang on Windows never complained. I guess it's an MSVC extension, eh? How annoying. Also, haha yes the script wasn't even executable. Forgot to update-index when I remade the repo, I guess... --- compile | 4 ++-- src/build/cmeta.c | 14 ++++++++++++-- src/build/mkgamedata.c | 2 +- 3 files changed, 15 insertions(+), 5 deletions(-) mode change 100644 => 100755 compile diff --git a/compile b/compile old mode 100644 new mode 100755 index 5fc508c..26aa925 --- a/compile +++ b/compile @@ -10,7 +10,7 @@ esac mkdir -p .build/include -warnings=-Wall -pedantic -Wno-parentheses -Wno-missing-braces +warnings="-Wall -pedantic -Wno-parentheses -Wno-missing-braces" objs= cc() { @@ -44,7 +44,7 @@ clang -O2 -fuse-ld=lld $warnings -D_FILE_OFFSET_BITS=64 -o .build/mkgamedata \ src/build/mkgamedata.c src/kv.c .build/codegen `for s in $src; do echo "src/$s"; done` .build/mkgamedata gamedata/gamelib.kv gamedata/engine.kv -for s in $src; do cc "$s" done +for s in $src; do cc "$s"; done clang -m32 -shared -fpic -fuse-ld=lld -O0 -w -o .build/libtier0.so src/tier0stub.c ld diff --git a/src/build/cmeta.c b/src/build/cmeta.c index 157ba92..7b7a767 100644 --- a/src/build/cmeta.c +++ b/src/build/cmeta.c @@ -98,13 +98,23 @@ static void die1(const char *s) { exit(100); } +#ifndef _WIN32 +static void die2(const char *s1, const char *s2) { + fprintf(stderr, "cmeta: fatal: %s%s\n", s1, s2); + exit(100); +} +#endif + static char *readsource(const os_char *f) { int fd = os_open(f, O_RDONLY); #ifndef _WIN32 if (fd == -1) die2("couldn't open ", f); #else - // TODO/FIXME/TEMP this is dumb and bad - if (fd == -1) { fprintf(stderr, "couldn't open %S", f); exit(100); } + // XXX: this is dumb and bad + if (fd == -1) { + fprintf(stderr, "cmeta: fatal: couldn't open %S", f); + exit(100); + } #endif uint bufsz = 8192; char *buf = malloc(bufsz); diff --git a/src/build/mkgamedata.c b/src/build/mkgamedata.c index bd7b2d5..ca2e130 100644 --- a/src/build/mkgamedata.c +++ b/src/build/mkgamedata.c @@ -86,7 +86,7 @@ static noreturn badparse(struct parsestate *state, const char *e) { static void kv_cb(enum kv_token type, const char *p, uint len, void *ctxt) { struct parsestate *state = ctxt; switch (type) { - case KV_IDENT: case KV_IDENT_QUOTED: + case KV_IDENT: case KV_IDENT_QUOTED:; char *k = malloc(len + 1); if (!k) die("couldn't allocate key string"); memcpy(k, p, len); -- cgit v1.2.3