diff options
| author | Mike Pall <mike> | 2023-08-21 03:06:26 +0200 |
|---|---|---|
| committer | Mike Pall <mike> | 2023-08-21 03:06:26 +0200 |
| commit | 50e0fa03c48cb9af03c3efdc3100f12687651a2e (patch) | |
| tree | ad5e693de66cc012374445575b70379bc6047123 /src/host | |
| parent | c34594681909cac98d44629863df2c7afd93eaf0 (diff) | |
| download | luajit-2.0.ROLLING.tar.gz luajit-2.0.ROLLING.tar.bz2 luajit-2.0.ROLLING.zip | |
Switch build system to rolling releases.v2.0.ROLLING
Diffstat (limited to 'src/host')
| -rw-r--r-- | src/host/buildvm.c | 1 | ||||
| -rw-r--r-- | src/host/genversion.lua | 43 |
2 files changed, 44 insertions, 0 deletions
diff --git a/src/host/buildvm.c b/src/host/buildvm.c index ef393ff8..39c2bc24 100644 --- a/src/host/buildvm.c +++ b/src/host/buildvm.c | |||
| @@ -320,6 +320,7 @@ static void emit_vmdef(BuildCtx *ctx) | |||
| 320 | char buf[80]; | 320 | char buf[80]; |
| 321 | int i; | 321 | int i; |
| 322 | fprintf(ctx->fp, "-- This is a generated file. DO NOT EDIT!\n\n"); | 322 | fprintf(ctx->fp, "-- This is a generated file. DO NOT EDIT!\n\n"); |
| 323 | fprintf(ctx->fp, "assert(require(\"jit\").version == \"%s\", \"LuaJIT core/library version mismatch\")\n\n", LUAJIT_VERSION); | ||
| 323 | fprintf(ctx->fp, "module(...)\n\n"); | 324 | fprintf(ctx->fp, "module(...)\n\n"); |
| 324 | 325 | ||
| 325 | fprintf(ctx->fp, "bcnames = \""); | 326 | fprintf(ctx->fp, "bcnames = \""); |
diff --git a/src/host/genversion.lua b/src/host/genversion.lua new file mode 100644 index 00000000..a38cec56 --- /dev/null +++ b/src/host/genversion.lua | |||
| @@ -0,0 +1,43 @@ | |||
| 1 | ---------------------------------------------------------------------------- | ||
| 2 | -- Lua script to embed the rolling release version in luajit.h. | ||
| 3 | ---------------------------------------------------------------------------- | ||
| 4 | -- Copyright (C) 2005-2023 Mike Pall. All rights reserved. | ||
| 5 | -- Released under the MIT license. See Copyright Notice in luajit.h | ||
| 6 | ---------------------------------------------------------------------------- | ||
| 7 | |||
| 8 | local FILE_INPUT_H = "luajit_rolling.h" | ||
| 9 | local FILE_INPUT_R = "luajit_relver.txt" | ||
| 10 | local FILE_OUTPUT_H = "luajit.h" | ||
| 11 | |||
| 12 | local function file_read(file) | ||
| 13 | local fp = assert(io.open(file, "rb"), "run from the wrong directory") | ||
| 14 | local data = assert(fp:read("*a")) | ||
| 15 | fp:close() | ||
| 16 | return data | ||
| 17 | end | ||
| 18 | |||
| 19 | local function file_write_mod(file, data) | ||
| 20 | local fp = io.open(file, "rb") | ||
| 21 | if fp then | ||
| 22 | local odata = assert(fp:read("*a")) | ||
| 23 | fp:close() | ||
| 24 | if odata == data then return end | ||
| 25 | end | ||
| 26 | fp = assert(io.open(file, "wb")) | ||
| 27 | assert(fp:write(data)) | ||
| 28 | assert(fp:close()) | ||
| 29 | end | ||
| 30 | |||
| 31 | local text = file_read(FILE_INPUT_H) | ||
| 32 | local relver = file_read(FILE_INPUT_R):match("(%d+)") | ||
| 33 | |||
| 34 | if relver then | ||
| 35 | text = text:gsub("ROLLING", relver) | ||
| 36 | else | ||
| 37 | io.stderr:write([[ | ||
| 38 | **** WARNING Cannot determine rolling release version from git log. | ||
| 39 | **** WARNING The 'git' command must be available during the build. | ||
| 40 | ]]) | ||
| 41 | end | ||
| 42 | |||
| 43 | file_write_mod(FILE_OUTPUT_H, text) | ||
