1
2
3
4
5
6
7
8
9
10
11
|
<?
package require sha1
load_response args
proc versionEncoded {versionString} {
set output 0
if {$versionString eq "trunk"} {
return [versionEncoded "255.255.255"]
}
|
>
>
>
>
>
>
>
>
>
>
>
>
>
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
<?
package require sha1
load_response args
proc normalize_platform {platform platform_names} {
set platform [string tolower $platform]
if {$platform in $platform_names} {
return $platform
}
set platform [regsub {[-]x86_64$} $platform {-amd64}]
set platform [regsub {[-]sun4[muv]$} $platform {-sparc}]
if {$platform in $platform_names} {
return $platform
}
}
proc versionEncoded {versionString} {
set output 0
if {$versionString eq "trunk"} {
return [versionEncoded "255.255.255"]
}
|
︙ | | | ︙ | |
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
|
return $output
}
set sourcedir "/web/rkeene/devel/kitcreator/all"
set queue "/home/rkeene/devel/kitcreator/build/web/queue"
set secretfile "/home/rkeene/etc/kitcreator-web-secret"
foreach file [glob -tails -nocomplain -directory $sourcedir "kitcreator-*.tar.gz"] {
regexp {^kitcreator-(.*).tar.gz$} $file -> vers
set kitcreator_versions($vers) $vers
}
set kitcreator_version_selected [lindex [lsort -dictionary [array names kitcreator_versions]] end]
set kitcreator_versions(trunk) "Fossil Trunk Tip"
set tcl_versions(8.5.15) 8.5.15
set tcl_versions(8.5.16) 8.5.16
set tcl_versions(8.5.17) 8.5.17
set tcl_versions(8.5.18) 8.5.18
set tcl_versions(8.5.19) 8.5.19
set tcl_versions(8.6.1) 8.6.1
set tcl_versions(8.6.2) 8.6.2
set tcl_versions(8.6.3) 8.6.3
set tcl_versions(8.6.4) 8.6.4
set tcl_versions(8.6.5) 8.6.5
set tcl_versions(8.6.6) 8.6.6
set tcl_versions(8.6.7) 8.6.7
set tcl_versions(8.6.8) 8.6.8
set tcl_versions(8.6.9) 8.6.9
set tcl_versions(fossil_trunk) "Fossil Trunk Tip"
set platforms(android-arm) "Android/ARM"
set platforms(freebsd-amd64) "FreeBSD/amd64"
set platforms(hpux-hppa64) "HP-UX/PA-RISC 2.0"
set platforms(aix-ppc) "AIX/POWER"
set platforms(linux-amd64) "Linux/amd64"
set platforms(linux-amd64-static) "Linux/amd64 (static)"
set platforms(linux-arm) "Linux/ARM"
|
>
>
>
>
>
>
|
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
|
return $output
}
set sourcedir "/web/rkeene/devel/kitcreator/all"
set queue "/home/rkeene/devel/kitcreator/build/web/queue"
set secretfile "/home/rkeene/etc/kitcreator-web-secret"
# KitCreator Versions
foreach file [glob -tails -nocomplain -directory $sourcedir "kitcreator-*.tar.gz"] {
regexp {^kitcreator-(.*).tar.gz$} $file -> vers
set kitcreator_versions($vers) $vers
}
set kitcreator_version_selected [lindex [lsort -dictionary [array names kitcreator_versions]] end]
set kitcreator_versions(trunk) "Fossil Trunk Tip"
# Tcl Versions
set tcl_versions(8.5.15) 8.5.15
set tcl_versions(8.5.16) 8.5.16
set tcl_versions(8.5.17) 8.5.17
set tcl_versions(8.5.18) 8.5.18
set tcl_versions(8.5.19) 8.5.19
set tcl_versions(8.6.1) 8.6.1
set tcl_versions(8.6.2) 8.6.2
set tcl_versions(8.6.3) 8.6.3
set tcl_versions(8.6.4) 8.6.4
set tcl_versions(8.6.5) 8.6.5
set tcl_versions(8.6.6) 8.6.6
set tcl_versions(8.6.7) 8.6.7
set tcl_versions(8.6.8) 8.6.8
set tcl_versions(8.6.9) 8.6.9
set tcl_versions(fossil_trunk) "Fossil Trunk Tip"
set tcl_version_list [lsort -dictionary [array names tcl_versions]]
set tcl_version_selected [lindex $tcl_version_list end-1]
# Platforms
set platforms(android-arm) "Android/ARM"
set platforms(freebsd-amd64) "FreeBSD/amd64"
set platforms(hpux-hppa64) "HP-UX/PA-RISC 2.0"
set platforms(aix-ppc) "AIX/POWER"
set platforms(linux-amd64) "Linux/amd64"
set platforms(linux-amd64-static) "Linux/amd64 (static)"
set platforms(linux-arm) "Linux/ARM"
|
︙ | | | ︙ | |
86
87
88
89
90
91
92
93
94
95
96
97
98
99
|
set packages(nsf) "Next Scripting Framework"
set packages(tdom) "tDOM"
set packages(tuapi) "Tcl UNIX API"
set packages(lmdb) "LMDB"
set packages(tclcurl) "cURL"
set packages(duktape) "Duktape"
set disable {
platform linux-mipsel {package_tk package_tcc4tcl package_tclx kitdll}
platform android-arm {package_tk package_tclx}
platform freebsd-amd64 {package_tuapi}
platform hpux-hppa64 {package_tuapi}
platform aix-ppc {package_tuapi kitdll}
platform netbsd-amd64 {package_tk package_tcc4tcl package_tclx package_tuapi}
|
>
>
>
>
>
>
>
>
>
>
|
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
|
set packages(nsf) "Next Scripting Framework"
set packages(tdom) "tDOM"
set packages(tuapi) "Tcl UNIX API"
set packages(lmdb) "LMDB"
set packages(tclcurl) "cURL"
set packages(duktape) "Duktape"
set options_info(threaded) "Kit: Threaded"
set options_info(kitdll) "Kit: Build Library (KitDLL)"
set options_info(debug) "Kit: Debugging Build"
set options_info(dynamictk) "Kit: Always link Tk dynamically (if Tk is built)"
set options_info(minbuild) "Kit: \"Minimal\" build (remove extra packages shipped as part of Tcl and reduce encodings)"
set options_info(staticlibssl) "TLS: Statically link to LibSSL"
set options_info(buildlibssl) "TLS: Build LibreSSL for this platform"
set options_info(staticpkgs) "Kit: Statically link packages in pkgs directory"
set options_info(tclutfmax6) "Kit: TCL_UTF_MAX=6 (incompatibility with standard Tcl)"
set disable {
platform linux-mipsel {package_tk package_tcc4tcl package_tclx kitdll}
platform android-arm {package_tk package_tclx}
platform freebsd-amd64 {package_tuapi}
platform hpux-hppa64 {package_tuapi}
platform aix-ppc {package_tuapi kitdll}
platform netbsd-amd64 {package_tk package_tcc4tcl package_tclx package_tuapi}
|
︙ | | | ︙ | |
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
|
set specific {
platform win32 file icon {Kit Icon}
platform win32 text description {Description}
platform win64 file icon {Kit Icon}
platform win64 text description {Description}
}
if {[info exists args(platform)] && [info exists args(tcl_version)] && [info exist args(kitcreator_version)]} {
# Read in arguments
## Mandatory arguments
set build_platform $args(platform)
set build_tcl_version $args(tcl_version)
set build_kitcreator_version $args(kitcreator_version)
## Optional Arguments
set build_packages [list]
set build_options(threaded) 0
set build_options(kitdll) 0
set build_options(debug) 0
set build_options(dynamictk) 0
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
>
>
>
>
>
>
>
>
|
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
|
set specific {
platform win32 file icon {Kit Icon}
platform win32 text description {Description}
platform win64 file icon {Kit Icon}
platform win64 text description {Description}
}
if {[info exists args(dict)] || [info exists args(json)]} {
package require json
package require json::write
}
if {[info exists args(json)]} {
set args(dict) [::json::json2dict $args(json)]
unset args(json)
set apiReturnFormat json
}
set resultIsAPI false
if {[info exists args(dict)]} {
headers set "Access-Control-Allow-Origin" "*"
if {![info exists apiReturnFormat]} {
set apiReturnFormat dict
}
set apiMethod build
catch {
set apiMethod [dict get $args(dict) action]
}
switch -exact -- $apiMethod {
build {
# Do nothing, handled below
}
platforms {
set apiResultDict [array get platforms]
}
tcl_versions {
set apiResultDict [array get tcl_versions]
dict set apiResultDict default $tcl_version_selected
}
kitcreator_versions {
set apiResultDict [array get kitcreator_versions]
dict set apiResultDict default $kitcreator_version_selected
}
options {
set apiResultDict [array get options_info]
}
packages {
set apiResultDict [array get packages]
}
help {
set apiResultDict {
build {Build a TclKit. Accepts arguments: platform [mandatory, string], tcl_version [string], kitcreator_version [string], storage [string, one of mk4, cvfs, zip], options [array], packages [array]}
platforms {Get a list of platforms to use as the "platform" argument to build}
tcl_versions {Get a list of Tcl versions and their descriptions to use as the "tcl_version" argument to build}
kitcreator_versions {Get a list of KitCreator versions and their descriptions to use as the "kitcreator_version" argument to build}
options {Get a list of options and their descriptions}
packages {Get a list of packages and their descriptions}
examples {A few examples}
help {This help}
}
}
examples {
set apiResultDict {
simple {curl -d 'json={"action": "build", "platform": "linux-amd64"}' http://kitcreator.rkeene.org/kitcreator}
}
}
default {
set apiResultDict [dict create error "Invalid action \"$apiMethod\""]
}
}
if {$apiMethod eq "build" && ![dict exists $args(dict) platform]} {
set apiMethod error
set apiResultDict [dict create error "The argument \"platform\" must be supplied when building"]
}
if {$apiMethod ne "build"} {
if {[dict exists $apiResultDict error]} {
headers numeric 500
}
switch -exact -- $apiReturnFormat {
"json" {
headers type application/json
set apiResultDictEncoded [list]
foreach {key value} $apiResultDict {
lappend apiResultDictEncoded $key [json::write string $value]
}
set apiResultJSON [json::write object {*}$apiResultDictEncoded]
puts $apiResultJSON
}
"dict" {
headers type text/plain
puts [dict create {*}$apiResultDict]
}
}
rivet_flush
abort_page
}
set resultIsAPI true
set args(platform) [dict get $args(dict) platform]
set args(tcl_version) $tcl_version_selected
set args(kitcreator_version) $kitcreator_version_selected
foreach arg {tcl_version kitcreator_version option_storage} {
set dictArg $arg
switch -exact -- $arg {
option_storage {
set dictArg "storage"
}
}
catch {
set args($arg) [dict get $args(dict) $dictArg]
}
}
set selectedPackages [list]
catch {
set selectedPackages [dict get $args(dict) packages]
}
foreach arg $selectedPackages {
set args(option_package_$arg) true
}
set selectedOptions [list]
catch {
set selectedOptions [dict get $args(dict) options]
}
foreach arg $selectedOptions {
switch -glob -- $arg {
"package_*" {
continue
}
}
set args(option_$arg) true
}
}
if {[info exists args(platform)] && [info exists args(tcl_version)] && [info exist args(kitcreator_version)]} {
# Read in arguments
## Mandatory arguments
set build_platform [normalize_platform $args(platform) [array names platforms]]
set build_tcl_version $args(tcl_version)
set build_kitcreator_version $args(kitcreator_version)
if {$build_tcl_version eq "default"} {
set build_tcl_version $tcl_version_selected
}
if {$build_kitcreator_version eq "default"} {
set build_kitcreator_version $kitcreator_version_selected
}
## Optional Arguments
set build_packages [list]
set build_options(threaded) 0
set build_options(kitdll) 0
set build_options(debug) 0
set build_options(dynamictk) 0
|
︙ | | | ︙ | |
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
|
# Queue build up and wait for it to complete
set fd [open $queue a+]
puts $fd [list filename $filename key $key platform $build_platform tcl_version $build_tcl_version kitcreator_version $build_kitcreator_version packages $build_packages options [array get build_options]]
close $fd
set url "http://kitcreator.rkeene.org/kits/building/$key/"
headers redirect $url
?><html>
<head>
<title>KitCreator, Web Interface</title>
</head>
<body>
<h1>KitCreator Web Interface</h1>
<p>Build in progress, see <a href="<? puts -nonewline $url ?>"><? puts -nonewline $url ?></a> for build information</p>
</body>
</html>
<?
} else {
?><html>
<head>
<title>KitCreator, Web Interface</title>
<script>
<!--
function enableOption(option) {
|
>
>
|
>
>
>
>
>
>
>
>
>
>
|
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
|
# Queue build up and wait for it to complete
set fd [open $queue a+]
puts $fd [list filename $filename key $key platform $build_platform tcl_version $build_tcl_version kitcreator_version $build_kitcreator_version packages $build_packages options [array get build_options]]
close $fd
set url "http://kitcreator.rkeene.org/kits/building/$key/"
set kiturl "http://kitcreator.rkeene.org/kits/$key/$filename"
if {!$resultIsAPI} {
headers redirect $url
?><html>
<head>
<title>KitCreator, Web Interface</title>
</head>
<body>
<h1>KitCreator Web Interface</h1>
<p>Build in progress, see <a href="<? puts -nonewline $url ?>"><? puts -nonewline $url ?></a> for build information</p>
</body>
</html>
<?
} else {
switch -exact -- $apiReturnFormat {
"json" {
puts "{\"kit_url\": \"${kiturl}\"}"
}
"dict" {
puts [dict create kit_url $kiturl]
}
}
}
} else {
?><html>
<head>
<title>KitCreator, Web Interface</title>
<script>
<!--
function enableOption(option) {
|
︙ | | | ︙ | |
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
|
</td>
</tr>
<tr>
<td>Tcl Version:</td>
<td>
<select name="tcl_version" onChange="verifyOptions();">
<?
set tcl_version_list [lsort -dictionary [array names tcl_versions]]
set tcl_version_selected [lindex $tcl_version_list end-1]
foreach tcl_version $tcl_version_list {
set tcl_version_name $tcl_versions($tcl_version)
if {$tcl_version == $tcl_version_selected} {
set selected " selected"
} else {
set selected ""
|
<
<
|
611
612
613
614
615
616
617
618
619
620
621
622
623
624
|
</td>
</tr>
<tr>
<td>Tcl Version:</td>
<td>
<select name="tcl_version" onChange="verifyOptions();">
<?
foreach tcl_version $tcl_version_list {
set tcl_version_name $tcl_versions($tcl_version)
if {$tcl_version == $tcl_version_selected} {
set selected " selected"
} else {
set selected ""
|
︙ | | | ︙ | |