This repository was archived by the owner on Aug 31, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 227
Expand file tree
/
Copy pathserver_builder.livecodescript
More file actions
188 lines (164 loc) · 6.95 KB
/
server_builder.livecodescript
File metadata and controls
188 lines (164 loc) · 6.95 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
script "ServerBuilder"
////////////////////////////////////////////////////////////////////////////////
-- Building the LiveCode Server consists of
-- 1) Fetch native code components for the target platform
-- 2) Build the output zip
-- The layout of the zip is as follows:
-- <zip>/externals/<externals>
-- <zip>/drivers/<db drivers>
-- <zip>/livecode-server
////////////////////////////////////////////////////////////////////////////////
command serverBuilderRun pPlatform, pEdition
builderLog "report", "Building" && pEdition && "server for" && pPlatform
local tVersionFile, tVersion
put url ("file:" & builderRepoFolder() & slash & "version") into tVersionFile
replace space with empty in tVersionFile
split tVersionFile by return and "="
put tVersionFile["BUILD_SHORT_VERSION"] into tVersion
local tEngineFolder
builderFetchEngine tVersion, pPlatform
put the result into tEngineFolder
-- Make sure that the output directory exists
local tOutputDir
put builderOutputFolder() into tOutputDir
builderEnsureFolder tOutputDir
local tOutputFile
put tOutputDir & slash & getZipFilenameStub(tVersion, pPlatform, pEdition) into tOutputFile
-- Clean up any existing output file
delete file tOutputFile
if pPlatform begins with "win-" then
repeat for each word tExternal in "revdb revzip revxml dbsqlite dbmysql dbpostgresql dbodbc"
get "server-" & tExternal & ".dll"
if there is not a file (tEngineFolder & slash & it) then
get tExternal & ".dll"
if there is a file (tEngineFolder & slash & it) then
builderLog "message", "Copying windows external '" & tExternal & "' from desktop external"
put URL ("binfile:" & tEngineFolder & slash & it) into URL ("binfile:" & tEngineFolder & slash & "server-" & it)
end if
end if
end repeat
if pEdition is "community" then
builderLog "message", "Renaming windows engine for community edition"
rename tEngineFolder & slash & "server.exe" to tEngineFolder & slash & "server-community.exe"
end if
end if
try
revZipOpenArchive tOutputFile, "write"
if the result is not empty then
throw the result
end if
local tExeExtension, tOutExeExtension
if pPlatform begins with "win-" then
put ".exe" into tExeExtension
put ".exe" into tOutExeExtension
--else if pPlatform is "linux" then
--put ".x86" into tExeExtension
--put empty into tOutExeExtension
else
put empty into tExeExtension
put empty into tOutExeExtension
end if
local tLibExtension
if pPlatform begins with "win-" then
put ".dll" into tLibExtension
else if pPlatform is "macosx" then
put ".dylib" into tLibExtension
else if pPlatform contains "linux" then
put ".so" into tLibExtension
end if
repeat for each word tExternal in "revdb revzip revxml"
get tEngineFolder & slash & "server-" & tExternal & tLibExtension
if there is a file it then
builderLog "message", "Adding external '" & tExternal & "'"
revZipAddItemWithFile tOutputFile, "externals/" & tExternal & tLibExtension, it
if the result is not empty then
throw the result
end if
else
builderLog "warning", "Could not find external '" & tExternal & "'"
end if
end repeat
// SN-2015-06-25: [[ ServerBuilder ]] DBoracle has never been in the Server zip.
// Removed to suppress the builder warning
repeat for each word tDriver in "dbsqlite dbmysql dbpostgresql dbodbc"
get tEngineFolder & slash & "server-" & tDriver & tLibExtension
if there is a file it then
builderLog "message", "Adding driver '" & tDriver & "'"
revZipAddItemWithFile tOutputFile, "drivers/" & tDriver & tLibExtension, it
if the result is not empty then
throw the result
end if
else
builderLog "message", "Warning - could not find driver '" & tDriver & "'"
end if
end repeat
local tServerPath, tServerZipPath
put tEngineFolder & slash & "server-" & toLower(pEdition) & tExeExtension into tServerPath
if pEdition is "Community" then
put "livecode-community-server" & tOutExeExtension into tServerZipPath
else
put "livecode-server" & tOutExeExtension into tServerZipPath
end if
if there is a file tServerPath then
builderLog "message", "Adding livecode-server engine"
revZipAddItemWithFile tOutputFile, tServerZipPath, tServerPath
if the result is not empty then
throw the result
end if
else
builderLog "message", "Warning - could not find server engine"
end if
local tVersionClean
put tVersion into tVersionClean
if tVersionClean contains "gm" then
set the itemDel to "-"
put item 1 of tVersionClean into tVersionClean
set the itemDel to comma
end if
replace "." with "_" in tVersion
replace "-" with "_" in tVersion
replace "." with "_" in tVersionClean
replace "-" with "_" in tVersionClean
get builderBuiltNotesFolder() & "/LiveCodeNotes-" & tVersionClean & ".pdf"
if there is a file it then
builderLog "message", "Adding server release notes"
revZipAddItemWithFile tOutputFile, "LiveCodeNotes-" & tVersionClean & "-Server.pdf", it
if the result is not empty then
throw the result
end if
else
builderLog "message", "Warning - could not find release notes"
end if
revZipCloseArchive tOutputFile
if the result is not empty then
throw the result
end if
catch tError
builderLog "error", "Server archive building failed - " & tError
throw "failure"
end try
end serverBuilderRun
////////////////////////////////////////////////////////////////////////////////
function getZipFilenameStub pVersion, pPlatform, pEdition
if pVersion contains "gm" then
set the itemDel to "-"
put item 1 of pVersion into pVersion
set the itemDel to comma
end if
replace "-" with "_" in pVersion
replace "." with "_" in pVersion
if pPlatform is "macosx" then
put "Mac" into pPlatform
else if pPlatform is "win-x86" then
put "Windows-x86" into pPlatform
else if pPlatform is "win-x86_64" then
put "Windows-x86_64" into pPlatform
else if pPlatform is "linux-x86" then
put "Linux" into pPlatform
else if pPlatform is "linux-x86_64" then
put "Linux-x86_64" into pPlatform
else if pPlatform is "linux-armv6hf" then
put "Linux-armv6hf" into pPlatform
end if
return "LiveCode" & editionTitleCase(pEdition) & "Server-" & pVersion & "-" & pPlatform & ".zip"
end getZipFilenameStub