forked from livecode/livecode
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtools_builder.livecodescript
More file actions
580 lines (493 loc) · 26.6 KB
/
tools_builder.livecodescript
File metadata and controls
580 lines (493 loc) · 26.6 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
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
script "ToolsBuilder"
////////////////////////////////////////////////////////////////////////////////
-- Building the LiveCode Tools consists of several stages.
-- 1) Fetch native code components for each platform
-- 2) Fetch the latest IDE
-- 3) Fetch the latest documentation
-- 4) Build the documentation's clumps
-- 5) Compile the install package
-- 6) Deploy an installer
////////////////////////////////////////////////////////////////////////////////
command toolsBuilderRun pPlatform, pEdition, pVersion
-- If on windows or linux, we can't do anything macosxy due to lack of lipo/strip :o(
local tEngineFolders
get "windows linux-x86 linux-x86_64 linux-armv6hf macosx ios android emscripten"
repeat for each word tPlatform in it
builderFetchEngine pVersion, tPlatform
put the result into tEngineFolders[tPlatform]
end repeat
-- Next make sure our IDE is up to date
local tIdeFolder
put builderIdeRepoFolder() into tIdeFolder
-- Fetch the documentation
local tDocsFolder
put builderBuiltDocsFolder() into tDocsFolder
-- Now build the package
local tPackageFile
toolsBuilderMakePackage pVersion, pEdition, pPlatform, tEngineFolders, tIdeFolder, tDocsFolder
put the result into tPackageFile
-- Compute the private folder
local tPrivateFolder
put builderPrivateRepoFolder() into tPrivateFolder
-- Now build the installer
toolsBuilderMakeInstaller pVersion, pEdition, pPlatform, tIdeFolder, tPrivateFolder, tPackageFile
end toolsBuilderRun
command toolsBuilderRunDisk pPlatform, pEdition, pVersion
if pPlatform is not "macosx" then
exit toolsBuilderRunDisk
end if
if the platform is not "macos" then
builderLog "error", "Cannot sign and build disk image for Mac on this platform"
exit toolsBuilderRunDisk
end if
local tInputFolder
put builderInputFolder() into tInputFolder
local tInputFile
put tInputFolder & slash & "installer-mac.zip" into tInputFile
toolsBuilderMakeDisk pVersion, pEdition, pPlatform, tInputFile
end toolsBuilderRunDisk
////////////////////////////////////////////////////////////////////////////////
private command toolsBuilderMakePackage pVersion, pEdition, pPlatform, pEngineFolders, pIdeFolder, pDocsFolder
local tPackageFile
local tEditionType
local tBaseEditionType
put pEdition into tEditionType
switch tEditionType
case "Community"
put "Community" into tBaseEditionType
break
case "Indy"
case "Business"
put "Commercial" into tBaseEditionType
break
end switch
-- Compute the package temp folder
local tTempFolder
put builderWorkFolder() & slash & "tools-" & pPlatform & "-" & pVersion & ".tmp" into tTempFolder
builderEnsureFolder tTempFolder
-- Compute the package output file
put builderWorkFolder() & slash & "tools-" & pPlatform & "-" & pVersion & ".zip" into tPackageFile
builderEnsureFolderForFile tPackageFile
--return tPackageFile
-- Configure the package compiler appropriately
local tPackager
packageCompilerCreate tPackager
packageCompilerSetReportCallback tPackager, the long id of me, "toolsBuilderPackageReport"
-- Setup the temporary dir
packageCompilerConfigure tPackager, "temporary", tTempFolder
-- Configure the sources: ide, docs, macosx, windows, linux
packageCompilerConfigureSource tPackager, "ide", pIdeFolder
packageCompilerConfigureSource tPackager, "ide-support", builderRepoFolder() & slash & "ide-support"
packageCompilerConfigureSource tPackager, "docs", pDocsFolder
packageCompilerConfigureSource tPackager, "engine", pEngineFolders[pPlatform]
packageCompilerConfigureSource tPackager, "macosx", pEngineFolders["macosx"]
packageCompilerConfigureSource tPackager, "linux-x86", pEngineFolders["linux-x86"]
packageCompilerConfigureSource tPackager, "linux-x86_64", pEngineFolders["linux-x86_64"]
packageCompilerConfigureSource tPackager, "linux-armv6-hf", pEngineFolders["linux-armv6hf"]
packageCompilerConfigureSource tPackager, "windows", pEngineFolders["windows"]
packageCompilerConfigureSource tPackager, "ios", pEngineFolders["ios"]
packageCompilerConfigureSource tPackager, "android", pEngineFolders["android"]
packageCompilerConfigureSOurce tPackager, "emscripten", pEngineFolders["emscripten"]
packageCompilerConfigureSource tPackager, "prebuilt", builderRepoFolder() & slash & "prebuilt"
packageCompilerConfigureSource tPackager, "repo", builderRepoFolder()
if tEditionType is among the items of "indy,business" then
packageCompilerConfigureSource tPackager, "private", builderPrivateRepoFolder()
end if
-- Now set up variables used by the description: TargetFolder, SupportFolder, ToolsFolder, TargetPlatform, TargetEdition
packageCompilerConfigureVariable tPackager, "TargetFolder", "[[installFolder]]"
packageCompilerConfigureVariable tPackager, "TargetEdition", tEditionType
packageCompilerConfigureVariable tPackager, "BaseEdition", tBaseEditionType
if pPlatform is "macosx" then
packageCompilerConfigureVariable tPackager, "SupportFolder", "[[installFolder]]/Contents/Tools"
packageCompilerConfigureVariable tPackager, "ToolsFolder", "[[installFolder]]/Contents/Tools"
else
packageCompilerConfigureVariable tPackager, "SupportFolder", "[[installFolder]]"
packageCompilerConfigureVariable tPackager, "ToolsFolder", "[[installFolder]]"
end if
if pPlatform begins with "linux" then
packageCompilerConfigureVariable tPackager, "TargetPlatform", "linux"
else
packageCompilerConfigureVariable tPackager, "TargetPlatform", pPlatform
end if
packageCompilerConfigureVariable tPackager, "TodaysDate", "[[todaysDate]]"
packageCompilerConfigureVariable tPackager, "VersionTag", pVersion
packageCompilerConfigureVariable tPackager, "ProductBranch", char 1 to 3 of pVersion
packageCompilerConfigureVariable tPackager, "TargetArchitectures", "i386"
if pPlatform is "linux-x86" then
packageCompilerConfigureVariable tPackager, "TargetArchitecture", "x86"
else if pPlatform is "linux-x86_64" then
packageCompilerConfigureVariable tPackager, "TargetArchitecture", "x86_64"
else if pPlatform is "linux-armv6hf" then
packageCompilerConfigureVariable tPackager, "TargetArchitecture", "armv6-hf"
end if
-- Now all the names
if pEdition is "Community" then
packageCompilerConfigureVariable tPackager, "ProductTitle", "LiveCode Community" && getReadableVersion(pVersion)
packageCompilerConfigureVariable tPackager, "ProductTag", "livecodecommunity_" & getTaggedVersion(pVersion)
if pPlatform is "Linux" or pPlatform is "Linux-x86_64" or pPlatform is "Linux-armv6hf" then
packageCompilerConfigureVariable tPackager, "ProductName", "livecodecommunity"
else
packageCompilerConfigureVariable tPackager, "ProductName", "LiveCode Community"
end if
else if pEdition is "Indy" then
packageCompilerConfigureVariable tPackager, "ProductTitle", "LiveCode Indy" && getReadableVersion(pVersion)
packageCompilerConfigureVariable tPackager, "ProductTag", "livecodeindy_" & getTaggedVersion(pVersion)
packageCompilerConfigureVariable tPackager, "ProductName", "LiveCode Indy"
else if pEdition is "Business" then
packageCompilerConfigureVariable tPackager, "ProductTitle", "LiveCode Business" && getReadableVersion(pVersion)
packageCompilerConfigureVariable tPackager, "ProductTag", "livecodebusiness_" & getTaggedVersion(pVersion)
packageCompilerConfigureVariable tPackager, "ProductName", "LiveCode Business"
end if
-- The edition tags.
packageCompilerConfigureVariable tPackager, "EditionTagLower", "-" & toLower(char 1 of tEditionType) & char 2 to -1 of tEditionType
packageCompilerConfigureVariable tPackager, "EditionTagUpper", "-" & toUpper(char 1 of tEditionType) & char 2 to -1 of tEditionType
packageCompilerConfigureVariable tPackager, "BaseEditionTagLower", "-" & toLower(char 1 of tBaseEditionType) & char 2 to -1 of tBaseEditionType
packageCompilerConfigureVariable tPackager, "BaseEditionTagUpper", "-" & toUpper(char 1 of tBaseEditionType) & char 2 to -1 of tBaseEditionType
local tSuccess
put true into tSuccess
local tDescFile
put builderRepoFolder() & slash & "Installer/package.txt" into tDescFile
builderLog "message", "Parsing description file '" & tDescFile & "'"
packageCompilerParse tPackager, url ("file:" & tDescFile)
if the result is empty then
toolsBuilderPackageReport "report", "Parsed description file '" & tDescFile & "'"
else
toolsBuilderPackageReport "error", item 2 to -1 of the result, item 1 of the result
put false into tSuccess
end if
if tSuccess then
if there is a file tPackageFile then
delete file tPackageFile
end if
builderLog "message", "Building package '" & tPackageFile & "'"
packageCompilerBuild tPackager, "LiveCode", tPackageFile
if the result is empty then
builderLog "report", "Built package '" & tPackageFile & "'"
else
toolsBuilderPackageReport "error", item 2 to -1 of the result, item 1 of the result
put false into tSuccess
end if
end if
packageCompilerDestroy tPackager
if not tSuccess then
throw "failed"
end if
return tPackageFile
end toolsBuilderMakePackage
on toolsBuilderPackageReport pType, pMessage, pLine
if pLine is not empty then
put "Line" && pLine && ":" && pMessage into pMessage
end if
builderLog pType, pMessage
end toolsBuilderPackageReport
////////////////////////////////////////////////////////////////////////////////
private command toolsBuilderMakeInstaller pVersion, pEdition, pPlatform, pIdeFolder, pPrivateFolder, pPackageFile
-- Make sure no stack messages trigger
lock messages
-- Ensure the correct capitalisation of the edition name
put toUpper(char 1 of pEdition) & toLower(char 2 to -1 of pEdition) into pEdition
-- Compute the deploy temp folder
local tTempFolder
put builderWorkFolder() & slash & "tools-" & pPlatform & "-" & pVersion & ".tmp" into tTempFolder
builderEnsureFolder tTempFolder
-- Compute the output file
local tOutputFileStub, tOutputFileFolder
put builderOutputFolder() into tOutputFileFolder
put tOutputFileFolder & slash & getInstallerFilenameStub(pVersion, pPlatform, pEdition) into tOutputFileStub
builderEnsureFolderForFile tOutputFileStub
local tInstaller
put the short name of stack (builderSystemFolder() & "/installer.rev") into tInstaller
-- Choose the apporpriate skin to use for the installer
local tResources
if pEdition is "Community" then
put the short name of stack (builderSystemFolder() & "/tools_installer_resources.rev") into tResources
else
builderLog "report", "Commercial installer resources:" && builderCommercialResourceFolder() & slash & pEdition & "/tools_installer_resources.rev"
put the short name of stack (builderCommercialResourceFolder() & slash & pEdition & "/tools_installer_resources.rev") into tResources
end if
set the mainStack of stack tResources to tInstaller
-- Make sure the installer library knows what product it is (for logging file name)
if pEdition is "Community" then
set the uProduct of stack tInstaller to "LiveCode Community"
set the uProductTitle of stack tInstaller to "LiveCode Community" && getReadableVersion(pVersion)
set the uProductTag of stack tInstaller to "livecodecommunity-" & pVersion
set the uProductDetails of stack tInstaller to loadTextFile(builderSystemFolder() & "/../Installer/description.txt")
set the uProductLicense of stack tInstaller to loadTextFile(pIdeFolder & slash & "License Agreement.txt")
else if pEdition is "Indy" then
set the uProduct of stack tInstaller to "LiveCode Indy"
set the uProductTitle of stack tInstaller to "LiveCode Indy" && getReadableVersion(pVersion)
set the uProductTag of stack tInstaller to "livecodeindy-" & pVersion
set the uProductDetails of stack tInstaller to loadTextFile(builderSystemFolder() & "/../Installer/description.txt")
set the uProductLicense of stack tInstaller to loadTextFile(pPrivateFolder & slash & "License Agreement.txt")
else if pEdition is "Business" then
set the uProduct of stack tInstaller to "LiveCode Business"
set the uProductTitle of stack tInstaller to "LiveCode Business" && getReadableVersion(pVersion)
set the uProductTag of stack tInstaller to "livecodebusiness-" & pVersion
set the uProductDetails of stack tInstaller to loadTextFile(builderSystemFolder() & "/../Installer/description.txt")
set the uProductLicense of stack tInstaller to loadTextFile(pPrivateFolder & slash & "License Agreement.txt")
end if
-- Save the restructured installer stack out to a temp file and delete from memory
local tInstallerStackfile
put tTempFolder & slash & "installer_stackfile.rev" into tInstallerStackfile
builderLog "message", "Creating installer stackfile at '" & tInstallerStackfile & "'"
save stack tInstaller as tInstallerStackfile
if the result is not empty then
builderLog "error", "Failed to create installer stackfile due to -" && the result
delete stack tInstaller
throw "failure"
end if
builderLog "report", "Created installer stackfile at '" & tInstallerStackfile & "'"
delete stack tInstaller
-- No more stack manipulations so unlock messages
unlock messages
-- Next build up the deploy info
local tDietParams, tSignParams, tParams
put "LiveCode Ltd" into tParams["version"]["CompanyName"]
if pEdition is "Community" then
put "LiveCode Community Installer" into tParams["version"]["FileDescription"]
put "LiveCode Community Installer" into tParams["version"]["ProductName"]
else
put "LiveCode Installer" into tParams["version"]["FileDescription"]
put "LiveCode Installer" into tParams["version"]["ProductName"]
end if
put "©" && word -1 of the long date & ". All rights reserved worldwide." into tParams["version"]["LegalCopyright"]
put pVersion into tParams["version"]["ProductVersion"]
put pVersion into tParams["version"]["FileVersion"]
# AL-2015-03-14: Use deploy parameters to include libURL scriptified stack in installer standalone
local tAuxStackfiles
if there is a stack "revLibUrl" then
put the effective filename of stack "revLibUrl" into tAuxStackfiles
else
put builderRepoFolder() & slash & "ide-support" & slash & "revliburl.livecodescript" into tAuxStackfiles
end if
put return & builderSystemFolder() & slash & "installer_utilities.livecodescript" after tAuxStackfiles
start using stack (builderRepoFolder() & slash & "ide-support" & slash & "revsblibrary.livecodescript")
repeat for each line tStackFile in tAuxStackfiles
local tTempStackFile
put builderMakeTemporaryFile(tTempFolder, "stack") into tTempStackFile
revSBResaveScriptOnlyStackAsProperStackFile the short name of stack tStackFile, tStackFile, tTempStackFile
put tTempStackFile & return after tParams["auxiliary_stackfiles"]
end repeat
delete the last char of tParams["auxiliary_stackfiles"]
put "insert script of stack" && quote & "revLibUrl" & quote && "into back" into tParams["startup_script"]
put return & "insert script of stack" && quote & "InstallerUtilities" & quote && "into back" after tParams["startup_script"]
switch pPlatform
case "windows"
-- Process the manifest appropriately
local tManifestFile
get windowsManifest()
replace "[[Name]]" with tParams["version"]["ProductName"] in it
replace "[[Description]]" with tParams["version"]["FileDescription"] in it
put tTempFolder & "/manifest.xml" into tManifestFile
put it into url ("binfile:" & tManifestFile)
put tManifestFile into tParams["manifest"]
-- First we deploy the installer unsigned
put abstractPinFile(builderInstallerEngine("windows")) into tParams["engine"]
put tInstallerStackfile into tParams["stackfile"]
put pPackageFile into tParams["payload"]
put tOutputFileStub & ".unsigned.exe" into tParams["output"]
// libURL is needed in the timestamp processing
start using stack (builderRepoFolder() & slash & "ide-support" & slash & "revliburl.livecodescript")
if pEdition is not "Community" then
put builderCommercialResourceFolder() & slash & pEdition & "/installer.ico" into tParams["appicon"]
end if
builderLog "message", "Deploying unsigned windows installer to '" && tParams["output"] & "'"
_internal deploy windows tParams
if the result is not empty then
builderLog "error", "Deploy to windows failed - " & the result
throw "failure"
end if
-- Next we sign the installer using the certificate (if available)
local tCertificatesFolder
put builderPrivateRepoFolder() & slash & "certificates" into tCertificatesFolder
if there is a folder (tCertificatesFolder) then
put tParams["output"] into tSignParams["input"]
put tOutputFileStub & ".exe" into tSignParams["output"]
put tCertificatesFolder & "/runrev_bin.spc" into tSignParams["certificate"]
put tCertificatesFolder & "/runrev.pvk" into tSignParams["privatekey"]
put word 1 of url ("file:" & tCertificatesFolder & "/runrev_password.txt") into tSignParams["passphrase"]
put "http://timestamp.verisign.com/scripts/timstamp.dll" into tSignParams["timestamper"]
put "http://www.runrev.com" into tSignParams["url"]
if pEdition is "Community" then
put "LiveCode Community Installer" into tSignParams["description"]
else
put "LiveCode Installer" into tSignParams["description"]
end if
builderLog "message", "Signing windows installer to '" && tSignParams["output"] & "'"
_internal sign windows tSignParams
if the result is not empty then
builderLog "error", "Signing of windows executable failed - " & the result
throw "failure"
end if
else
put url ("binfile:" & tParams["output"]) into url ("binfile:" & tOutputFileStub & ".exe")
end if
builderLog "report", "Deployed windows installer to '" && tOutputFileStub & ".exe" & "'"
break
case "linux-x86"
case "linux-x86_64"
case "linux-armv6hf"
put abstractPinFile(builderInstallerEngine(pPlatform)) into tParams["engine"]
put tInstallerStackFile into tParams["stackfile"]
put pPackageFile into tParams["payload"]
if pPlatform is "linux-x86" then
put tOutputFileStub & ".x86" into tParams["output"]
else if pPlatform is "linux-x86_64" then
put tOutputFileStub & ".x86_64" into tParams["output"]
else -- if pPlatform is "linux-armv6hf"
put tOutputFileStub & ".rpi" into tParams["output"]
end if
builderLog "message", "Deploying linux installer to '" && tParams["output"] & "'"
_internal deploy linux tParams
if the result is not empty then
builderLog "error", "Deploy to linux failed - " & the result
throw "failure"
end if
builderLog "report", "Deployed linux installer to '" && tParams["output"] & "'"
break
case "macosx"
local tPlistFile
put macPList() into tPlistFile
replace "[[BundleId]]" with "com.runrev.installer" in tPlistFile
replace "[[BundleName]]" with "runrevinstaller" in tPlistFile
create folder tOutputFileStub & ".app"
create folder tOutputFileStub & ".app" & slash & "Contents"
create folder tOutputFileStub & ".app" & slash & "Contents/MacOS"
create folder tOutputFileStub & ".app" & slash & "Contents/Resources"
put tPlistFile into url ("file:" & tOutputFileStub & ".app" & slash & "Contents/Info.plist")
if pEdition is "Community" then
put url ("binfile:" & builderCommunityResourceFolder() & "/Installer.icns") into url ("binfile:" & tOutputFileStub & ".app" & slash & "Contents/Resources/Installer.icns")
else
put url ("binfile:" & builderCommercialResourceFolder() & slash & pEdition & "/Installer.icns") into url ("binfile:" & tOutputFileStub & ".app" & slash & "Contents/Resources/Installer.icns")
end if
-- Get us an installer by dieting the source installer
if false then
put abstractPinFile(builderInstallerEngine("macosx") & slash & "Contents/MacOS/Installer") into tDietParams["input"]
put tTempFolder & slash & "macosx-installer-x86" into tDietParams["output"]
put true into tDietParams["keep_x86"]
put false into tDietParams["keep_ppc"]
builderLog "message", "Dieting input installer down to x86"
--_internal diet macosx tDietParams
dietAndStrip "x86", tDietParams["input"], tDietParams["output"]
if the result is not empty then
builderLog "error", "Dieting input installer to x86 failed -" && the result
throw "failure"
end if
put tTempFolder & slash & "macosx-installer-x86" into tParams["engine_x86"]
end if
put abstractPinFile(builderInstallerEngine("macosx") & slash & "Contents/MacOS/Installer") into tParams["engine_x86"]
put tInstallerStackFile into tParams["stackfile"]
put tOutputFileStub & ".app" & slash & "Contents/MacOS/Installer" into tParams["output"]
put url ("binfile:" & pPackageFile) into url ("binfile:" & tOutputFileStub & ".app" & slash & "Contents/Resources/payload")
builderLog "message", "Deploying macosx installer to '" && tParams["output"] & "'"
_internal deploy macosx tParams
if the result is not empty then
builderLog "error", "Deploy to macosx failed - " & the result
throw "failure"
end if
builderLog "report", "Deployed macosx installer to '" && tOutputFileStub & ".app" & "'"
break
end switch
end toolsBuilderMakeInstaller
command toolsBuilderMakeDisk pVersion, pEdition, pPlatform, tInputZip
-- Compute the output file
local tOutputFileStub, tOutputFileFolder
put builderOutputFolder() into tOutputFileFolder
put tOutputFileFolder & slash & getInstallerFilenameStub(pVersion, pPlatform, pEdition) into tOutputFileStub
builderEnsureFolderForFile tOutputFileStub
get shell("/usr/bin/security -q find-identity -v")
filter it with "*Developer ID Application: Runtime Revolution Ltd*"
if it is not empty then
builderLog "message", "Signing macosx installer'" && tOutputFileStub & ".app" & "'"
wait 1 second
get shell("/usr/bin/codesign -s" && word 2 of it && "'" & tOutputFileStub & ".app'")
if it is not empty then
builderLog "error", "Could not macosx sign installer:" && it
throw "failure"
end if
builderLog "report", "Successfully signed macosx installer'" && tOutputFileStub & ".app" & "'"
else
builderLog "warning", "No valid identity found for signing OSX installer"
end if
local tEdition
put toUpper(char 1 of pEdition) & toLower(char 2 to -1 of pEdition) into tEdition
local tDmgFile, tDmgName, tDmgAppFolder
put tOutputFileStub & ".dmg" into tDmgFile
put "LiveCode" && tEdition && getReadableVersion(pVersion) && "Installer" into tDmgName
put (tOutputFileFolder & slash & "Install LiveCode" && tEdition && getReadableVersion(pVersion) & ".app") into tDmgAppFolder
builderLog "message", "Building Mac DMG to '" & tDmgFile & "'"
if there is a file tDmgFile then
delete file tDmgFile
if there is a file tDmgFile then
builderLog "error", "Could not remove existing dmg - make sure it is not mounted"
throw "failure"
end if
end if
--local tTrashFile
--put builderWorkspaceFolder() & "/deploy/.Trash" into tTrashFile
--put empty into URL ("file:" & tTrashFile)
-- Do the DMG build
rename (tOutputFileStub & ".app") to tDmgAppFolder
-- SN-2015-03-09: [[ DMG creation failure ]] Ensure that hdiutil will allocate enough
-- memory if the installer end up being over a gigabyte large.
get shell("hdiutil create -fs HFS+ -size 1G -volname" && quote & tDmgName & quote && "-srcfolder" && quote & tDmgAppFolder & quote && quote & tDmgFile & quote)
rename tDmgAppFolder to (tOutputFileStub & ".app")
if "created:" is not in it then
builderLog "error", "Dmg creation failed -" && the last line of it
throw "failure"
end if
builderLog "report", "Deployed macosx dmg to '" & tDmgFile & "'"
end toolsBuilderMakeDisk
////////////////////////////////////////////////////////////////////////////////
function getTaggedVersion pVersion
set the itemDelimiter to "-"
if item 2 of pVersion is "gm" then
delete item -2 to -1 of pVersion
end if
replace "-" with "_" in pVersion
replace "." with "_" in pVersion
return pVersion
end getTaggedVersion
function getReadableVersion pVersion
local tNumber
set the itemDelimiter to "-"
put item 1 of pVersion into tNumber
if tNumber ends with ".0" then
delete char -2 to -1 of tNumber
end if
if item 2 of pVersion is "gm" then
delete item -2 to -1 of pVersion
end if
local tTag
if item 2 of pVersion is not empty then
put item 2 to -1 of pVersion into tTag
replace "-" with space in tTag
put " (" & tTag & ")" into tTag
end if
return tNumber & tTag
end getReadableVersion
function getInstallerFilenameStub pVersion, pPlatform, pEdition
set the itemDelimiter to "-"
if item 2 of pVersion is "gm" then
delete item -2 to -1 of pVersion
end if
replace "-" with "_" in pVersion
replace "." with "_" in pVersion
if pPlatform is "macosx" then
put "Mac" into pPlatform
else if pPlatform is "windows" then
put "Windows" into pPlatform
else if pPlatform begins with "linux" then
put "Linux" into pPlatform
end if
-- Ensure that the edition name is capitalised appropriately
local tEdition
put toUpper(char 1 of pEdition) & toLower(char 2 to -1 of pEdition) into tEdition
return "LiveCode" & tEdition & "Installer-" & pVersion & "-" & pPlatform
end getInstallerFilenameStub
function loadTextFile pFile
get url ("binfile:" & pFile)
replace numToChar(13) & numToChar(10) with return in it
replace numToChar(13) with return in it
return it
end loadTextFile