• 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

Revisionb7dc3b08983c02d82455184235ddc8bc9498b59c (tree)
Zeit2024-04-06 20:46:19
AutorFs <Fsu0413@vip....>
CommiterFs

Log Message

瞎写

Ändern Zusammenfassung

Diff

--- a/UpdateWebsite/UpdateWebsite.lua
+++ b/UpdateWebsite/UpdateWebsite.lua
@@ -13,83 +13,9 @@ scriptPath = (n and string.sub(scriptFile, 1, n - 1) or ".")
1313
1414 package.path = scriptPath .. "/lib/?.lua;" .. package.path
1515
16-local fileName = function(confTable)
17- return confTable.INSTALLPATH .. "-" .. tostring(confTable.date) .. ((confTable.template == "win") and ".7z" or ".tar.xz")
18-end
19-
20-local dataDotVersion = function(confTable)
21- return confTable.buildContentVersion
22-end
23-
24-local dataDotBuildHost = function(confTable)
25- local buildHostNameTable = {
26- Win10 = "Windows 11 10.0.22621",
27- Win10SH = "Windows 11 10.0.22621",
28- Win8 = "Windows 8.1 Update",
29- Win8SH = "Windows 8.1 Update",
30- CentOS8 = "RockyLinux 8.7",
31- Rocky9 = "RockyLinux 9.1",
32- macOS1015 = "macOS 12.6.3",
33- macOSLegacy = "macOS 11.7.2",
34- macOSM1 = "macOS 12.6.3",
35- }
36-
37- return buildHostNameTable[confTable.buildHost]
38-end
39-
40-local dataDotToolchain = function(confTable)
41- -- only Target counts?
42-
43- if confTable.buildTargetToolchain == "PATH" then
44- if string.sub(confTable.buildHost, 1, 5) == "macOS" then
45- return "AppleClang " .. tostring(confTable.buildTargetToolchainVersion)
46- else
47- return "GCC " .. tostring(confTable.buildTargetToolchainVersion)
48- end
49- elseif string.sub(confTable.buildTargetToolchain, 1, 7) == "Android" then
50- return "ndk " .. tostring(confTable.buildTargetToolchainVersion)
51- elseif string.sub(confTable.buildTargetToolchain, 1, 5) == "MinGW" then
52- -- TODO: need generator compile a program for get mingw-w64 version.
53- -- Let's just hard-code it here
54- local MinGWVersion = 0
55- local compilerId, compilerSuffix = "GCC", ""
56- if string.sub(confTable.buildTargetToolchain, 1, 9) == "MinGWLLVM" then
57- MinGWVersion = 10
58- compilerId = "LLVM"
59- if string.sub(confTable.buildTargetToolchain, 11, 4) == "ucrt" then
60- compilerSuffix = " (ucrt)"
61- else
62- compilerSuffix = " (msvcrt)"
63- end
64- elseif string.sub(confTable.buildTargetToolchainVersion, 1, 3) == "12." then
65- MinGWVersion = 10
66- elseif string.sub(confTable.buildTargetToolchainVersion, 1, 3) == "11." then
67- MinGWVersion = 9
68- elseif string.sub(confTable.buildTargetToolchainVersion, 1, 2) == "8." then
69- MinGWVersion = 6
70- elseif string.sub(confTable.buildTargetToolchainVersion, 1, 2) == "7." then
71- MinGWVersion = 5
72- elseif string.sub(confTable.buildTargetToolchainVersion, 1, 4) == "4.9." then
73- MinGWVersion = 5
74- end
75-
76- return "MinGW-w64 v" .. tostring(MinGWVersion) .. " w/ " .. compilerId .. " " .. confTable.buildTargetToolchainVersion .. compilerSuffix
77- elseif string.sub(confTable.buildTargetToolchain, 1, 4) == "MSVC" then
78- if string.sub(confTable.buildTargetToolchain, 5, 4) == "2015" then
79- return "VS2015 Update 3"
80- elseif string.sub(confTable.buildTargetToolchain, 5, 4) == "2017" then
81- return "VS2017 " .. confTable.buildTargetToolchainVersion .. "w/ Windows SDK 10.0.17763"
82- elseif string.sub(confTable.buildTargetToolchain, 5, 4) == "2019" then
83- return "VS2019 " .. confTable.buildTargetToolchainVersion .. "w/ Windows SDK 10.0.22000"
84- elseif string.sub(confTable.buildTargetToolchain, 5, 4) == "2022" then
85- return "VS2022 " .. confTable.buildTargetToolchainVersion .. "w/ Windows SDK 10.0.22621"
86- end
87- elseif string.sub(confTable.buildTargetToolchain, 1, 10) == "emscripten" then
88- return confTable.buildTargetToolchain
89- end
90-
91- return confTable.buildTargetToolchainVersion
92-end
16+parseConfTable = reuqire("ParseConfTable")
17+compare = require("Compare")
18+download = require("Download")
9319
9420 local buildContent = function(buildJob)
9521 if string.sub(buildJob, 1, 1) == "q" then
@@ -103,6 +29,8 @@ local buildContent = function(buildJob)
10329 end
10430 end
10531
32+--[====[
33+-- unusable for now, need refactor.
10634 local main = function(argc, argv)
10735 local dl = require("Download")
10836 local buildJob = os.getenv("UPDATE_JOB")
@@ -180,3 +108,4 @@ if r then
180108 else
181109 os.exit(1)
182110 end
111+]====]
--- /dev/null
+++ b/UpdateWebsite/lib/Compare.lua
@@ -0,0 +1,292 @@
1+
2+local compare = {}
3+
4+local compareVersion = function(a, b)
5+ -- all of Qt, OpenSSL and MariaDB uses a format similar to semver
6+ -- so there are major.minor.patch version format
7+
8+ local parseVersionNum = function(str)
9+ return string.match(str, "(%d+)%.(%d+)%.(%d+)")
10+ end
11+
12+ local a1, a2, a3 = parseVersionNum(a)
13+ local b1, b2, b3 = parseVersionNum(b)
14+
15+ if a1 ~= b1 then
16+ return a1 < b1
17+ end
18+
19+ if a2 ~= b2 then
20+ return a2 < b2
21+ end
22+
23+ return a3 < b3
24+end
25+
26+local unknownMetaTable = {
27+ __index = function(table, key)
28+ table.max = table.max + 1
29+ table[key] = table.max
30+ return table.max
31+ end
32+}
33+
34+local toolchainArchitecturePlatformSequence = setmetatable({
35+ -- unspecified
36+ [""] = 0,
37+
38+ -- Windows - MSVC
39+ wx3v5 = 112014,
40+ wx6v5 = 112015,
41+ wx3v7 = 112016,
42+ wx6v7 = 112017,
43+ wx3v9 = 112018,
44+ wx6v9 = 112019,
45+ wx6v2 = 112022,
46+ wa6v2 = 112023,
47+
48+ -- Windows - MinGW w/ GCC
49+ wx3g8 = 120815,
50+ wx6g8 = 120816,
51+ wx6g1 = 121126,
52+ wx6p2 = 121221,
53+ wx6g2 = 121226,
54+ wx6p3 = 121321,
55+ wx6g3 = 121326,
56+
57+ -- Windows - MinGW w/ LLVM
58+ wx6u6 = 131601,
59+ wx6s6 = 131606,
60+ wx6u7 = 131701,
61+ wx6s7 = 131706,
62+ wx6u8 = 131811,
63+ wx6s8 = 131816,
64+
65+ lx6 = 200000,
66+
67+ ma6 = 300000,
68+ mx6 = 310000,
69+
70+ -- Android NDK
71+ -- 400??2 is reserved for RISC-V
72+ aalnV21 = 400210,
73+ aa6nV21 = 400211,
74+ aa3nV21 = 400213,
75+ ax6nV21 = 400214,
76+ ax3nV21 = 400215,
77+ aalnV23 = 400230,
78+ aa6nV23 = 400231,
79+ aa3nV23 = 400233,
80+ ax6nV23 = 400234,
81+ ax3nV23 = 400235,
82+ aalnV25 = 400250,
83+ aa6nV25 = 400251,
84+ aa3nV25 = 400253,
85+ ax6nV25 = 400254,
86+ ax3nV25 = 400255,
87+ aalnV26 = 400260,
88+ aa6nV26 = 400261,
89+ aa3nV26 = 400263,
90+ ax6nV26 = 400264,
91+ ax3nV26 = 400265,
92+ -- ar6nV27 = 400272,
93+
94+ W = 500000,
95+
96+ max = 100000,
97+}, unknownMetaTable)
98+
99+local extractToolchainPlatformArchitecture = function(buildInfo)
100+ local prefixToolchainMap = {
101+ -- MSVC
102+ MSVC2015 = "v5",
103+ MSVC2017 = "v7",
104+ MSVC2019 = "v9",
105+ MSVC2022 = "v2",
106+
107+ MinGW810 = "g8",
108+ MinGW1120 = "g1",
109+ MinGW122u = "p2",
110+ MinGW1220 = "g2",
111+ MinGW132u = "p3",
112+ MinGW1320 = "g3",
113+
114+ ["MinGWLLVM-ucrt16"] = "u6",
115+ ["MinGWLLVM-msvcrt16"] = "s6",
116+ ["MinGWLLVM-ucrt17"] = "u7",
117+ ["MinGWLLVM-msvcrt17"] = "s7",
118+ ["MinGWLLVM-ucrt18"] = "u8",
119+ ["MinGWLLVM-msvcrt18"] = "s8",
120+
121+ ["Android-r21"] = "nV21",
122+ ["Android-r23"] = "nV23",
123+ ["Android-r25"] = "nV25",
124+ ["Android-r26"] = "nV26",
125+ }
126+
127+ local toolchainPlatformMap = {
128+ ["MSVC"] = "Windows",
129+ ["MinGW"] = "Windows",
130+ ["Android"] = "Android",
131+ ["emscripten"] = "WebAssembly",
132+ }
133+ local platformSequenceMap = {
134+ Windows = "w",
135+ Linux = "l",
136+ macOS = "m",
137+ Android = "a",
138+ WebAssembly = "W",
139+ }
140+
141+ local archPlatformMap = {
142+ ["ALL"] = "al",
143+ ["x86"] = "x3",
144+ ["x86_64"] = "x6",
145+ ["arm"] = "a3",
146+ ["arm64"] = "a6", -- aarch64 or arm64?
147+ ["riscv64"] = "r6",
148+ }
149+
150+ local platform = buildInfo.buildTarget
151+ local toolchain = buildInfo.buildTargetToolchain
152+ local arch = buildInfo.buildTargetArch
153+ if string.sub(buildInfo.buildTargetToolchain, 1, 7) == "Android" then
154+ toolchain = "Android-" .. string.sub(buildInfo.buildTargetToolchainVersion, 1, 3)
155+ platform = "Android"
156+ end
157+
158+ local extractedToolchain
159+ for k, v in pairs(prefixToolchainMap) do
160+ if string.sub(toolchain, 1, string.len(k)) == k then
161+ extractedToolchain = v
162+ break
163+ end
164+ end
165+ extractedToolchain = extractedToolchain or ""
166+
167+ if not platform then
168+ for k, v in pairs(toolchainPlatformMap) do
169+ if string.sub(buildInfo.buildTargetToolchain, 1, string.len(k)) == k then
170+ platform = v
171+ break
172+ end
173+ end
174+ end
175+ platform = platform or ""
176+ local extractedPlatform = platformSequenceMap[platform] or ""
177+
178+ if string.sub(arch, 1, 9) == "Universal" then
179+ arch = "ALL"
180+ end
181+
182+ local extractedArch = archPlatformMap[arch] or ""
183+
184+ return extractedPlatform .. extractedArch .. extractedToolchain
185+end
186+
187+-- This compare method is for generating the "sort" field of each item
188+compare.byConfiguration = function(a, b)
189+ -- in fact buildContent is not needed here
190+ -- provided for strong sequence guarantee
191+ if a.buildContent ~= b.buildContent then
192+ return a.buildContent < b.buildContent
193+ end
194+
195+ if a.buildContentVersion ~= b.buildContentVersion then
196+ return compareVersion(a.buildContentVersion, b.buildContentVersion)
197+ end
198+
199+ -- The sequence is: Windows < Linux < macOS < Android < WebAssembly
200+ -- see above platfromSequence
201+ if string.sub(a.buildTarget, 1, 2) ~= string.sub(b.buildTarget, 1, 2) then
202+ return platformSequence[string.sub(a.buildTarget, 1, 2)] ~= platformSequence[string.sub(b.buildTarget, 1, 2)]
203+ end
204+
205+ local aNdk, bNdk = 0, 0
206+ if string.sub(a.buildTarget, 1, 8) == "Android-" then
207+ aNdk = tonumber(string.sub(a.buildTarget, 9))
208+ end
209+ if string.sub(b.buildTarget, 1, 8) == "Android-" then
210+ bNdk = tonumber(string.sub(b.buildTarget, 9))
211+ end
212+ if aNdk ~= bNdk then
213+ return aNdk < bNdk
214+ end
215+
216+ local atpa, btpa = extractToolchainPlatformArchitecture(a), extractToolchainPlatformArchitecture(b)
217+ if atpa ~= btpa then
218+ return toolchainArchitecturePlatformSequence[atpa] < toolchainArchitecturePlatformSequence[btpa]
219+ end
220+
221+ if a.buildVariant ~= b.buildVariant then
222+ return variantSequence[matchA.variant] < variantSequence[matchB.variant]
223+ end
224+
225+ -- All signature has been compared for now! I have no way but...
226+ return a.buildContentVersion < b.buildContentVersion
227+end
228+
229+local pathPrefixForBuildTargetArchAndToolchainVersion = function(target, arch, toolchainVersion)
230+ if target == "Windows" then
231+ -- This expects change
232+ -- There is too many toolchain variants in current build: MSVC / MinGW-GCC / MinGW-LLVM, and there is an amazing amount of 18 builds in one single directory!
233+ -- So it need subdirectory (will be considered in next whole rebuild):
234+
235+ -- MSVC for Visual Studio builds
236+ -- MinGW-GCC for MinGW w/ GCC (niXman) builds
237+ -- MinGW-LLVM for MinGW w/ LLVM (mstorsjo) builds
238+
239+ local partA
240+
241+ if arch == "x86" then
242+ partA = "Windows-x86/"
243+ elseif arch == "x86_64" then
244+ partA = "Windows-x86_64/"
245+ elseif arch == "arm64" then
246+ partA = "Windows-arm64/"
247+ else
248+ -- not recognized
249+ end
250+
251+ local partB
252+
253+ if string.sub(toolchainVersion, 1, 4) == "MSVC" then
254+ partB = "MSVC/"
255+ elseif string.sub(toolchainVersion, 1, 9) == "MinGWLLVM" then
256+ partB = "MinGW-LLVM/"
257+ elseif string.sub(toolchainVersion, 1, 5) == "MinGW" then
258+ partB = "MinGW-GCC/"
259+ else
260+ -- not recognized
261+ end
262+
263+ if partA and partB then
264+ return partA .. partB
265+ end
266+ elseif target == "Linux" then
267+ -- never uploaded
268+ elseif target == "macOS" then
269+ -- actually arm64 ones are only used in early days of Qt built, since after that universal binaries are built and single architecture ones are deleted.
270+ -- Universal builds now ships with Qt 5.15 and later, which are all versions we are currently building, so recognize only Universal here
271+ if arch == "Universal (x86_64, arm64)" then
272+ return "macOS-Universal/"
273+ else
274+ -- unrecognized
275+ end
276+ elseif string.sub(target, 1, 7) == "Android" then
277+ -- only layouts of Qt 5.15 onwards are honored
278+ -- Qt 5.12 layouts (flatten) / pre-Qt 5.9 layouts (host based directory structure) are ignored
279+ return "Android/" .. string.sub(toolchainVersion, 1, 3) .. "/"
280+ elseif target == "WebAssembly" then
281+ return "WebAssembly/"
282+ end
283+
284+ return "/"
285+end
286+
287+compare.byDirectoryHirachey = function(a, b)
288+ local dirA, dirB = pathPrefixForBuildTargetArchAndToolchainVersion(a), pathPrefixForBuildTargetArchAndToolchainVersion(b)
289+ return (dirA .. a.INSTALLPATH) < (dirB .. b.INSTALLPATH)
290+end
291+
292+return compare
--- /dev/null
+++ b/UpdateWebsite/lib/ParseConfTable.lua
@@ -0,0 +1,72 @@
1+local parseConfTable = {}
2+
3+parseConfTable.fileName = function(buildInfo)
4+ return buildInfo.INSTALLPATH .. "-" .. tostring(buildInfo.date) .. ((buildInfo.template == "win") and ".7z" or ".tar.xz")
5+end
6+
7+parseConfTable.dataDotVersion = function(buildInfo)
8+ return buildInfo.buildContentVersion
9+end
10+
11+parseConfTable.dataDotPlatform = function(buildInfo)
12+ return buildInfo.buildTarget
13+end
14+
15+parseConfTable.dataDotBuildHost = function(buildInfo)
16+ return buildInfo.buildHostVersion
17+end
18+
19+parseConfTable.dataDotToolchain = function(buildInfo)
20+ if buildInfo.buildTargetToolchain == "PATH" then
21+ if string.sub(buildInfo.buildHost, 1, 5) == "macOS" then
22+ return "AppleClang " .. tostring(buildInfo.buildTargetToolchainVersion)
23+ else
24+ return "GCC " .. tostring(buildInfo.buildTargetToolchainVersion)
25+ end
26+ elseif string.sub(buildInfo.buildTargetToolchain, 1, 7) == "Android" then
27+ return "ndk " .. tostring(buildInfo.buildTargetToolchainVersion)
28+ elseif string.sub(buildInfo.buildTargetToolchain, 1, 5) == "MinGW" then
29+ local compilerId, compilerSuffix
30+ if string.sub(buildInfo.buildTargetToolchain, 1, 9) == "MinGWLLVM" then
31+ compilerId = "LLVM"
32+ if string.sub(buildInfo.buildTargetToolchain, 11, 4) == "ucrt" then
33+ compilerSuffix = " UCRT"
34+ else
35+ compilerSuffix = " MSVCRT"
36+ end
37+ else
38+ compilerId = "GCC"
39+ if string.sub(buildInfo.buildTargetToolchain, 9, 1) == "u" then
40+ compilerSuffix = " UCRT"
41+ elseif (string.sub(buildInfo.buildTargetToolchain, 9, 1) == "0") and (not (string.sub(buildInfo.buildTargetToolchain, 6, 4) == "1120")) then
42+ compilerSuffix = " MSVCRT"
43+ end
44+ end
45+
46+ return "MinGW-w64 w/ " .. compilerId .. " " .. buildInfo.buildTargetToolchainVersion .. (compilerSuffix or "")
47+ elseif string.sub(buildInfo.buildTargetToolchain, 1, 4) == "MSVC" then
48+ if string.sub(buildInfo.buildTargetToolchain, 5, 4) == "2015" then
49+ return "VS2015 Update 3"
50+ elseif string.sub(buildInfo.buildTargetToolchain, 5, 4) == "2017" then
51+ return "VS2017 " .. buildInfo.buildTargetToolchainVersion
52+ elseif string.sub(buildInfo.buildTargetToolchain, 5, 4) == "2019" then
53+ return "VS2019 " .. buildInfo.buildTargetToolchainVersion
54+ elseif string.sub(buildInfo.buildTargetToolchain, 5, 4) == "2022" then
55+ return "VS2022 " .. buildInfo.buildTargetToolchainVersion
56+ end
57+ elseif string.sub(buildInfo.buildTargetToolchain, 1, 10) == "emscripten" then
58+ return "emscripten-" .. buildInfo.buildTargetToolchainVersion
59+ end
60+
61+ return buildInfo.buildTargetToolchainVersion
62+end
63+
64+parseConfTable.dataDotArch = function(buildInfo)
65+ return buildInfo.buildTargetArch
66+end
67+
68+parseConfTable.dataDotVariant = function(buildInfo)
69+ return buildInfo.buildTargetVariant
70+end
71+
72+return parseConfTable