• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
Keine Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

Commit MetaInfo

Revision39457608e52ab2f21b66a184d136fcfcd7acdd93 (tree)
Zeit2023-05-21 12:04:46
AutorFs <Fsu0413@vip....>
CommiterFs

Log Message

lua 5.4

Ändern Zusammenfassung

Diff

--- a/Compile/build.lua
+++ b/Compile/build.lua
@@ -1,13 +1,17 @@
11
2+if string.sub(_VERSION, -3) ~= "5.4" then
3+ fail = nil
4+end
5+
26 local scriptFile = arg[0]
37 local n, n2
48 repeat
59 n = n2
610 n2 = string.find(scriptFile, "/", n and (n + 1) or 1)
7- if n2 == nil then
11+ if not n2 then
812 n2 = string.find(scriptFile, "\\", n and (n + 1) or 1)
913 end
10-until n2 == nil
14+until not n2
1115
1216 scriptPath = (n and string.sub(scriptFile, 1, n - 1) or ".")
1317
--- a/Compile/lib/CompilerVer.lua
+++ b/Compile/lib/CompilerVer.lua
@@ -1,4 +1,7 @@
11
2+-- TODO: find a more sensible name for this module.
3+-- The version is not for a specific compiler, but rather a version number of a whole toolchain.
4+
25 local compilerVer = {}
36
47 local runCmdScript = function(script)
@@ -31,7 +34,7 @@ compilerVer.parseVersionNum = function(str)
3134 if #match > 0 then
3235 return setmetatable(match, { __tostring = function(m) return m[1] .. "." .. m[2] .. "." .. m[3] end})
3336 end
34- return nil
37+ return fail
3538 end
3639
3740 local runShScript = function(script)
@@ -130,4 +133,45 @@ compilerVer.emcc = function(isWin, path)
130133 return compilerVer.parseVersionNum(ret)
131134 end
132135
136+--[==[
137+-- unused function. NDK version is still provided by Configuration.
138+compilerVer.ndk = function(_, path)
139+ -- NDK r13+ have a file named "source.properties" in its path.
140+ -- In this file there is an item calls "Pkg.Revision" which indicates the version of NDK itself.
141+
142+ local file, err = io.open(path .. "/source.properties", "r")
143+
144+ if not file then
145+ return fail
146+ end
147+
148+ local major, minor
149+
150+ for line in file:lines() do
151+ major, minor = string.match(line, "^Pkg%.Revision = (%d+)%.(%d+)%.%d+$")
152+ if major then
153+ break
154+ end
155+ end
156+
157+ file:close()
158+
159+ if not major then
160+ return fail
161+ end
162+
163+ local ndkMinorRevisionTable = {
164+ "",
165+ "b",
166+ "c",
167+ "d",
168+ "e",
169+ "f", -- no NDK versions ever reached this far, so..
170+ "g",
171+ }
172+
173+ return major .. ndkMinorRevisionTable[tonumber(minor) + 1]
174+end
175+]==]
176+
133177 return compilerVer
--- a/Compile/lib/Generate.lua
+++ b/Compile/lib/Generate.lua
@@ -972,7 +972,7 @@ local filenameAndToolFromUrl = function(url)
972972 repeat
973973 n = n2
974974 n2 = string.find(url, "/", n and (n + 1) or 1)
975- until n2 == nil
975+ until not n2
976976 local target = string.sub(url, n + 1)
977977 local tool = nil
978978
--- /dev/null
+++ b/Compile/lib/HostOsVer.lua
@@ -0,0 +1,85 @@
1+
2+local hostOsVer = {}
3+
4+hostOsVer.Windows = function()
5+ local file, err = io.popen("cmd /c ver" , "r")
6+ if not file then return fail, err end
7+
8+ -- the version string is in the second line
9+ file:read()
10+ local line = file:read()
11+ file:close()
12+
13+ -- currently we are using only Windows 10+
14+ local major, minor, patch
15+ string.gsub(line, "%[[^%d]+(%d+)%.(%d+)%.(%d+)[^%]]*%]", function(...)
16+ major, minor, patch = ...
17+ end)
18+
19+ if not major then return fail, "pattern didn't match line " .. line end
20+
21+ local prefix
22+
23+ if tonumber(major) < 5 then
24+ -- Windows 9x / ME / NT4.0 / pre-3.2, not supported
25+ if tonumber(major) == 5 then
26+ if tonumber(minor) == 0 then
27+ prefix = "Windows 2000"
28+ elseif tonumber(minor) == 1 or tonumber(minor) == 2 then
29+ prefix = "Windows XP"
30+ end
31+ elseif tonumber(major) == 6 then
32+ if tonumber(minor) == 0 then
33+ prefix = "Windows Vista"
34+ elseif tonumber(minor) == 1 then
35+ prefix = "Windows 7"
36+ elseif tonumber(minor) == 2 then
37+ prefix = "Windows 8"
38+ elseif tonumber(minor) == 3 then
39+ prefix = "Windows 8.1"
40+ elseif tonumber(minor) == 4 then
41+ prefix = "Windows 10"
42+ end
43+ elseif tonumber(major) == 10 then
44+ if tonumber(minor) == 0 then
45+ -- first Windows 11 is build 10.0.22000.1
46+ if tonumber(patch) < 22000 then
47+ prefix = "Windows 10"
48+ else
49+ prefix = "Windows 11"
50+ end
51+ end
52+ end
53+
54+ -- known Windows 10 / 11 codename
55+ local codename = {
56+ ["10240"] = "1507",
57+ ["10586"] = "1511",
58+ ["14393"] = "1607", -- or Windows Server 2016
59+ ["15063"] = "1703",
60+ ["16299"] = "1709",
61+ ["17134"] = "1803",
62+ ["17763"] = "1809", -- or Windows Server 2019
63+ ["18362"] = "1903",
64+ ["18363"] = "1909",
65+ ["19041"] = "2004",
66+ ["19042"] = "20H2",
67+ ["19043"] = "21H1",
68+ ["19044"] = "21H2",
69+ ["19045"] = "22H2", -- final version of Windows 10
70+
71+ ["20348"] = "21H2", -- Windows Server 2022 only
72+ ["20349"] = "22H2", -- Does this really exist?
73+
74+ ["22000"] = "21H2", -- first version of Windows 11
75+ ["22621"] = "22H2",
76+ }
77+
78+ if not prefix then
79+ return fail, "Windows version not supported " .. line
80+ end
81+
82+ return prefix .. " " .. major .. "." .. minor .. "." .. patch
83+end
84+
85+return hostOsVer
--- a/Compile/lib/mariadbCompile/conf.lua
+++ b/Compile/lib/mariadbCompile/conf.lua
@@ -527,19 +527,19 @@ conf.m3_3mal = {
527527
528528 for name, value in pairs(conf) do
529529 -- sanity check
530- if value.name == nil then
530+ if not value.name then
531531 io.stderr:write("no name for config " .. name .. "\n")
532532 io.stderr:flush()
533533 os.exit(1)
534534 end
535535
536- if value.mariadbVersion == nil then
536+ if not value.mariadbVersion then
537537 io.stderr:write("no mariadbVersion for config " .. name .. "\n")
538538 io.stderr:flush()
539539 os.exit(1)
540540 end
541541
542- if value.host == nil then
542+ if not value.host then
543543 io.stderr:write("no host for config " .. name .. "\n")
544544 io.stderr:flush()
545545 os.exit(1)
--- a/Compile/lib/opensslCompile/conf.lua
+++ b/Compile/lib/opensslCompile/conf.lua
@@ -901,19 +901,19 @@ conf.o3_0aaln527 = {
901901
902902 for name, value in pairs(conf) do
903903 -- sanity check
904- if value.name == nil then
904+ if not value.name then
905905 io.stderr:write("no name for config " .. name .. "\n")
906906 io.stderr:flush()
907907 os.exit(1)
908908 end
909909
910- if value.opensslVersion == nil then
910+ if not value.opensslVersion then
911911 io.stderr:write("no opensslVersion for config " .. name .. "\n")
912912 io.stderr:flush()
913913 os.exit(1)
914914 end
915915
916- if value.host == nil then
916+ if not value.host then
917917 io.stderr:write("no host for config " .. name .. "\n")
918918 io.stderr:flush()
919919 os.exit(1)
--- a/Compile/lib/qtCompile/conf.lua
+++ b/Compile/lib/qtCompile/conf.lua
@@ -5285,19 +5285,19 @@ end
52855285
52865286 for name, value in pairs(conf) do
52875287 -- sanity check
5288- if value.name == nil then
5288+ if not value.name then
52895289 io.stderr:write("no name for config " .. name .. "\n")
52905290 io.stderr:flush()
52915291 os.exit(1)
52925292 end
52935293
5294- if value.qtVersion == nil then
5294+ if not value.qtVersion then
52955295 io.stderr:write("no qtVersion for config " .. name .. "\n")
52965296 io.stderr:flush()
52975297 os.exit(1)
52985298 end
52995299
5300- if value.host == nil then
5300+ if not value.host then
53015301 io.stderr:write("no host for config " .. name .. "\n")
53025302 io.stderr:flush()
53035303 os.exit(1)