diff options
author | Mike Pall <mike> | 2023-08-28 21:25:51 +0200 |
---|---|---|
committer | Mike Pall <mike> | 2023-08-28 21:25:51 +0200 |
commit | 6a3111a57f817cb00ef2ab6f2553cd887ec36462 (patch) | |
tree | ecf248d80839e8bcce7357eba1654eddfa26b749 | |
parent | a0b52aae33ffaeff2cc3f28b6e125f9582b133d6 (diff) | |
download | luajit-6a3111a57f817cb00ef2ab6f2553cd887ec36462.tar.gz luajit-6a3111a57f817cb00ef2ab6f2553cd887ec36462.tar.bz2 luajit-6a3111a57f817cb00ef2ab6f2553cd887ec36462.zip |
Use fallback name for install files without valid .git or .relver.
-rw-r--r-- | src/host/genversion.lua | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/host/genversion.lua b/src/host/genversion.lua index a38cec56..42b5e6fe 100644 --- a/src/host/genversion.lua +++ b/src/host/genversion.lua | |||
@@ -5,9 +5,9 @@ | |||
5 | -- Released under the MIT license. See Copyright Notice in luajit.h | 5 | -- Released under the MIT license. See Copyright Notice in luajit.h |
6 | ---------------------------------------------------------------------------- | 6 | ---------------------------------------------------------------------------- |
7 | 7 | ||
8 | local FILE_INPUT_H = "luajit_rolling.h" | 8 | local FILE_ROLLING_H = "luajit_rolling.h" |
9 | local FILE_INPUT_R = "luajit_relver.txt" | 9 | local FILE_RELVER_TXT = "luajit_relver.txt" |
10 | local FILE_OUTPUT_H = "luajit.h" | 10 | local FILE_LUAJIT_H = "luajit.h" |
11 | 11 | ||
12 | local function file_read(file) | 12 | local function file_read(file) |
13 | local fp = assert(io.open(file, "rb"), "run from the wrong directory") | 13 | local fp = assert(io.open(file, "rb"), "run from the wrong directory") |
@@ -28,8 +28,8 @@ local function file_write_mod(file, data) | |||
28 | assert(fp:close()) | 28 | assert(fp:close()) |
29 | end | 29 | end |
30 | 30 | ||
31 | local text = file_read(FILE_INPUT_H) | 31 | local text = file_read(FILE_ROLLING_H) |
32 | local relver = file_read(FILE_INPUT_R):match("(%d+)") | 32 | local relver = file_read(FILE_RELVER_TXT):match("(%d+)") |
33 | 33 | ||
34 | if relver then | 34 | if relver then |
35 | text = text:gsub("ROLLING", relver) | 35 | text = text:gsub("ROLLING", relver) |
@@ -38,6 +38,7 @@ else | |||
38 | **** WARNING Cannot determine rolling release version from git log. | 38 | **** WARNING Cannot determine rolling release version from git log. |
39 | **** WARNING The 'git' command must be available during the build. | 39 | **** WARNING The 'git' command must be available during the build. |
40 | ]]) | 40 | ]]) |
41 | file_write_mod(FILE_RELVER_TXT, "ROLLING\n") -- Fallback for install target. | ||
41 | end | 42 | end |
42 | 43 | ||
43 | file_write_mod(FILE_OUTPUT_H, text) | 44 | file_write_mod(FILE_LUAJIT_H, text) |