Index: build/utils/download-api-client ================================================================== --- build/utils/download-api-client +++ build/utils/download-api-client @@ -23,10 +23,11 @@ kit_filename='' options=() packages=() internalOptionsVerbose='false' noPackages='false' +downloadSDK='false' for arg in "$@"; do if [ -n "${nextArg}" ]; then jsonArgs["${nextArg}"]="${arg}" nextArg='' continue @@ -41,10 +42,13 @@ nextArg="${nextArg//-/_}" ;; --kitdll|--threaded|--debug|--dynamictk|--staticpkgs) options+=("${arg:2}") ;; + --sdk) + downloadSDK='true' + ;; --opt-*) options+=("${arg:6}") ;; --pkg-*) packages+=("${arg:6}") @@ -142,28 +146,37 @@ fi exit 1 fi -kit_url="$(jq -crM .kit_url <<<"${info}")" -if [ -z "${kit_filename}" ]; then - kit_filename="${kit_url//*\//}" - case "${kit_filename}" in - *.*) - kit_filename_base="${kit_filename//.*/}" - kit_filename_ext=".${kit_filename//*./}" - ;; - *) - kit_filename_base="${kit_filename}" - kit_filename_ext='' - ;; - esac - kit_filename_platform="$(jq -crM .platform <<<"${info}")" - kit_filename_tcl_version="$(jq -crM .tcl_version <<<"${info}")" - kit_filename="${kit_filename_base}-${kit_filename_platform}-${kit_filename_tcl_version}${kit_filename_ext}" -fi - -curl -sSL "${kit_url}" > "${kit_filename}" -chmod 755 "${kit_filename}" +if [ "${downloadSDK}" = 'false' ]; then + kit_url="$(jq -crM .kit_url <<<"${info}")" + if [ -z "${kit_filename}" ]; then + kit_filename="${kit_url//*\//}" + case "${kit_filename}" in + *.*) + kit_filename_base="${kit_filename//.*/}" + kit_filename_ext=".${kit_filename//*./}" + ;; + *) + kit_filename_base="${kit_filename}" + kit_filename_ext='' + ;; + esac + kit_filename_platform="$(jq -crM .platform <<<"${info}")" + kit_filename_tcl_version="$(jq -crM .tcl_version <<<"${info}")" + kit_filename="${kit_filename_base}-${kit_filename_platform}-${kit_filename_tcl_version}${kit_filename_ext}" + fi + + curl -sSL "${kit_url}" > "${kit_filename}" + chmod 755 "${kit_filename}" +else + kit_sdk_url="$(jq -crM .kit_sdk_url <<<"${info}")" + if [ -z "${kit_filename}" ]; then + kit_filename="${kit_sdk_url//*\//}" + fi + + curl -sSL "${kit_sdk_url}" > "${kit_filename}" +fi echo "Wrote: ${kit_filename}" exit 0 Index: build/web/building.cgi ================================================================== --- build/web/building.cgi +++ build/web/building.cgi @@ -124,10 +124,13 @@ if {[file exists $outfile]} { set status "Complete" set terminal 1 set url "${base_url}/$filename" + if {[info exists buildinfo(sdkfilename)]} { + set sdk_url "${base_url}/$buildinfo(sdkfilename)" + } } elseif {[file exists "${outfile}.buildfail"]} { set status "Failed" set terminal 1 } else { set status "Building" @@ -141,10 +144,14 @@ status [string tolower $status] \ terminal $terminalBoolean \ ] if {[string tolower $status] eq "complete"} { dict set resultsDict kit_url $url + + if {[info exists sdk_url]} { + dict set resultsDict kit_sdk_url $sdk_url + } } if {[string tolower $status] in {complete building failed}} { dict set resultsDict build_log_url $build_log_url catch { dict set resultsDict tcl_version $buildinfo(tcl_version) Index: build/web/kitcreator.vfs/index.rvt ================================================================== --- build/web/kitcreator.vfs/index.rvt +++ build/web/kitcreator.vfs/index.rvt @@ -431,10 +431,11 @@ ## Convert key to a user-consumable string via hashing set key [string tolower [sha1::sha1 -hex $key]] # Determine filename + set extra_keys [list] if {$build_options(kitdll)} { set extension "so" switch -- $build_platform { "win32" - "win64" { set extension "dll" @@ -444,10 +445,12 @@ } } ## XXX: TODO: The version here needs to match what's in the SONAME set filename "libtclkit[string map [list "." ""] ${cache_tcl_version}].${extension}" + set sdkfilename "libtclkit[string map [list "." ""] ${cache_tcl_version}]-${build_platform}-sdk.tar.gz" + lappend extra_keys sdkfilename $sdkfilename } else { set filename "tclkit" switch -- $build_platform { "win32" - "win64" { @@ -456,11 +459,11 @@ } } # 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]] + 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] {*}$extra_keys] close $fd set url "http://kitcreator.rkeene.org/kits/building/$key/" if {!$resultIsAPI} { Index: build/web/process_queue ================================================================== --- build/web/process_queue +++ build/web/process_queue @@ -16,21 +16,45 @@ set fd [open $queue r] set data [read $fd] close $fd set ::env(TCLKIT) "/home/rkeene/bin/tclkit" + +proc handleSDK {workdir input output} { + set workdir [file join $workdir "sdk-rewrite"] + set dirNewName [regsub {\.tar\.gz$} [file tail $output] {}] + + file mkdir $workdir + exec gzip -dc $input | tar -C $workdir -xf - + + set dirName [glob -nocomplain -directory $workdir *] + if {[llength $dirName] != 1} { + return -code error "Multiple directories found: $dirName" + } + + set dirName [lindex $dirName 0] + + file rename $dirName [file join $workdir $dirNewName] + exec tar -C $workdir -cf - $dirNewName | gzip -9c > [file join $workdir sdk.tar.gz] + + file copy [file join $workdir sdk.tar.gz] $output +} foreach line [split $data "\n"] { if {$line == ""} { continue } unset -nocomplain buildinfo + unset -nocomplain outsdkfile array set buildinfo $line set outfile [file join $outdir $buildinfo(key) $buildinfo(filename)] + if {[info exists buildinfo(sdkfilename)]} { + set outsdkfile [file join $outdir $buildinfo(key) $buildinfo(sdkfilename)] + } # Skip if build completed if {[file exists $outfile]} { continue } @@ -161,17 +185,33 @@ catch { exec grep ^ {*}[lsort -dictionary [glob */build.log]] >> "${outfile}.log" } foreach file [list tclkit-$buildinfo(tcl_version) {*}[glob -nocomplain libtclkit*]] { + set isSDK false switch -glob -- $file { "*.dylib" - "*.so" - "*.sl" - "*.dll" { } "tclkit-*" {} + "libtclkit-sdk-*.tar.gz" { + set isSDK true + } default { continue } } + + if {$isSDK} { + if {[info exists outsdkfile]} { + if {[catch { + handleSDK $workdir $file $outsdkfile + }]} { + puts stderr "Error creating SDK: $::errorInfo" + } + } + + continue + } if {[file exists $file]} { file rename $file $outfile break