Mercurial
comparison third_party/luajit/src/host/genversion.lua @ 178:94705b5986b3
[ThirdParty] Added WRK and luajit for load testing.
| author | MrJuneJune <me@mrjunejune.com> |
|---|---|
| date | Thu, 22 Jan 2026 20:10:30 -0800 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| 177:24fe8ff94056 | 178:94705b5986b3 |
|---|---|
| 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) |