Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | Fixed the basekit and sherpa building process. Sherpa now builds directly out of the sanbox/sherpa directory. The basekit builds using sources from sandbox/odielib. Broke the core procs out of autosetup, and placed them in their own file to allow other Tcl applications to access them. |
|---|---|
| Timelines: | family | ancestors | descendants | both | autosetup |
| Files: | files | file ages | folders |
| SHA1: |
5617c7dc7dfb78aede61dfff1fcb635d |
| User & Date: | hypnotoad 2015-03-18 09:13:10 |
Context
|
2015-03-18
| ||
| 14:55 | Typo fixes check-in: 0646764e58 user: hypnotoad tags: autosetup | |
| 09:13 | Fixed the basekit and sherpa building process. Sherpa now builds directly out of the sanbox/sherpa directory. The basekit builds using sources from sandbox/odielib. Broke the core procs out of autosetup, and placed them in their own file to allow other Tcl applications to access them. check-in: 5617c7dc7d user: hypnotoad tags: autosetup | |
|
2015-03-15
| ||
| 06:39 | Stardarized the storage and use of exe_prefix Added a separate array for odie_prog (indicating where programs reside) Fixes to sqlite build to accomidate the lack of the pwd command in non-mingw Windows check-in: 170e7fa9e8 user: hypnotoad tags: autosetup | |
Changes
Changes to apps/sherpa/Makefile.
| ︙ | ︙ | |||
41 42 43 44 45 46 47 |
gather-src:
eval ${ODIE_RM} ${APPNAME}.vfs manifest.txt plugin.zip
mkdir -p ${APPNAME}.vfs
mkdir -p ${APPNAME}.vfs/apps
cp -a src/* ${APPNAME}.vfs/
| | > > | 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
gather-src:
eval ${ODIE_RM} ${APPNAME}.vfs manifest.txt plugin.zip
mkdir -p ${APPNAME}.vfs
mkdir -p ${APPNAME}.vfs/apps
cp -a src/* ${APPNAME}.vfs/
cp -a $(project-base)/../odielib/modules ${APPNAME}.vfs/lib
cp -a $(project-base)/../sherpa/modules ${APPNAME}.vfs/lib
cp -a $(project-base)/../sherpa/recipes ${APPNAME}.vfs
cp -a ../../../odie/odieConfig.tcl ${APPNAME}.vfs/
cp -a ../../../odie/odieConfig.sh ${APPNAME}.vfs/
cp ${ODIE_SRC_DIR}/apps/e.tcl ${APPNAME}.vfs/apps/edit.tcl
cp ${ODIE_SRC_DIR}/apps/tkdiff.tcl ${APPNAME}.vfs/apps/diff.tcl
cp ${ODIE_SRC_DIR}/scripts/rmdir.tcl ${APPNAME}.vfs/apps/rm.tcl
cp -a ../../recipes/ ${APPNAME}.vfs/recipes/
|
| ︙ | ︙ |
Changes to autosetup/autosetup.
| ︙ | ︙ | |||
186 187 188 189 190 191 192 | configlog "define $n $define($n)" } } exit 0 } | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < > | 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 |
configlog "define $n $define($n)"
}
}
exit 0
}
# Initial settings
set autosetup(exe) $::argv0
set autosetup(istcl) 1
set autosetup(start) [clock millis]
set autosetup(installed) 0
set autosetup(msg-checking) 0
set autosetup(msg-quiet) 0
# Embedded modules are inserted below here
##-- CUT HERE --##
source [file join [file dirname $::argv0] lib core.tcl]
##################################################################
#
# Entry/Exit
#
if {$autosetup(debug)} {
main $argv
|
| ︙ | ︙ |
Changes to autosetup/lib/codebale.tcl.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
###
# codebale.tcl
#
# This file defines routines used to bundle and manage Tcl and C
# code repositories
#
# Copyright (c) 2014 Sean Woods
#
# See the file "license.terms" for information on usage and redistribution of
# this file, and for a DISCLAIMER OF ALL WARRANTIES.
###
#::namespace eval ::codebale {}
set col 0
use fileutil
###
# topic: e1d75c45e58cc525a0a70ce6f767717c
###
| > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
###
# codebale.tcl
#
# This file defines routines used to bundle and manage Tcl and C
# code repositories
#
# Copyright (c) 2014 Sean Woods
#
# See the file "license.terms" for information on usage and redistribution of
# this file, and for a DISCLAIMER OF ALL WARRANTIES.
###
#::namespace eval ::codebale {}
# @synopsis:
#
# CODEBALE modules adds autobuild utilities
#
set col 0
use fileutil
###
# topic: e1d75c45e58cc525a0a70ce6f767717c
###
|
| ︙ | ︙ |
Added autosetup/lib/core.tcl.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 |
# @opt-bool option ...
#
# Check each of the named, boolean options and return 1 if any of them have
# been set by the user.
#
proc opt-bool {args} {
option-check-names {*}$args
opt_bool ::useropts {*}$args
}
# @opt-val option-list ?default=""?
#
# Returns a list containing all the values given for the non-boolean options in 'option-list'.
# There will be one entry in the list for each option given by the user, including if the
# same option was used multiple times.
# If only a single value is required, use something like:
#
## lindex [opt-val $names] end
#
# If no options were set, $default is returned (exactly, not as a list).
#
proc opt-val {names {default ""}} {
option-check-names {*}$names
join [opt_val ::useropts $names $default]
}
proc option-check-names {args} {
foreach o $args {
if {$o ni $::autosetup(options)} {
autosetup-error "Request for undeclared option --$o"
}
}
}
# Parse the option definition in $opts and update
# ::useropts() and ::autosetup(optionhelp) appropriately
#
proc options-add {opts {header ""}} {
global useropts autosetup
# First weed out comment lines
set realopts {}
foreach line [split $opts \n] {
if {![string match "#*" [string trimleft $line]]} {
append realopts $line \n
}
}
set opts $realopts
for {set i 0} {$i < [llength $opts]} {incr i} {
set opt [lindex $opts $i]
if {[string match =* $opt]} {
# This is a special heading
lappend autosetup(optionhelp) $opt ""
set header {}
continue
}
#puts "i=$i, opt=$opt"
regexp {^([^:=]*)(:)?(=)?(.*)$} $opt -> name colon equal value
if {$name in $autosetup(options)} {
autosetup-error "Option $name already specified"
}
#puts "$opt => $name $colon $equal $value"
# Find the corresponding value in the user options
# and set the default if necessary
if {[string match "-*" $opt]} {
# This is a documentation-only option, like "-C <dir>"
set opthelp $opt
} elseif {$colon eq ""} {
# Boolean option
lappend autosetup(options) $name
if {![info exists useropts($name)]} {
set useropts($name) $value
}
if {$value eq "1"} {
set opthelp "--disable-$name"
} else {
set opthelp "--$name"
}
} else {
# String option.
lappend autosetup(options) $name
if {$equal eq "="} {
if {[info exists useropts($name)]} {
# If the user specified the option with no value, the value will be "1"
# Replace with the default
if {$useropts($name) eq "1"} {
set useropts($name) $value
}
}
set opthelp "--$name?=$value?"
} else {
set opthelp "--$name=$value"
}
}
# Now create the help for this option if appropriate
if {[lindex $opts $i+1] eq "=>"} {
set desc [lindex $opts $i+2]
#string match \n* $desc
if {$header ne ""} {
lappend autosetup(optionhelp) $header ""
set header ""
}
# A multi-line description
lappend autosetup(optionhelp) $opthelp $desc
incr i 2
}
}
}
# @module-options optionlist
#
# Like 'options', but used within a module.
proc module-options {opts} {
set header ""
if {$::autosetup(showhelp) > 1 && [llength $opts]} {
set header "Module Options:"
}
options-add $opts $header
if {$::autosetup(showhelp)} {
# Ensure that the module isn't executed on --help
# We are running under eval or source, so use break
# to prevent further execution
#return -code break -level 2
return -code break
}
}
proc max {a b} {
expr {$a > $b ? $a : $b}
}
proc options-wrap-desc {text length firstprefix nextprefix initial} {
set len $initial
set space $firstprefix
foreach word [split $text] {
set word [string trim $word]
if {$word == ""} {
continue
}
if {$len && [string length $space$word] + $len >= $length} {
puts ""
set len 0
set space $nextprefix
}
incr len [string length $space$word]
puts -nonewline $space$word
set space " "
}
if {$len} {
puts ""
}
}
proc options-show {} {
# Determine the max option width
set max 0
foreach {opt desc} $::autosetup(optionhelp) {
if {[string match =* $opt] || [string match \n* $desc]} {
continue
}
set max [max $max [string length $opt]]
}
set indent [string repeat " " [expr $max+4]]
set cols [getenv COLUMNS 80]
catch {
lassign [exec stty size] rows cols
}
incr cols -1
# Now output
foreach {opt desc} $::autosetup(optionhelp) {
if {[string match =* $opt]} {
puts [string range $opt 1 end]
continue
}
puts -nonewline " [format %-${max}s $opt]"
if {[string match \n* $desc]} {
puts $desc
} else {
options-wrap-desc [string trim $desc] $cols " " $indent [expr $max + 2]
}
}
}
# @options options-spec
#
# Specifies configuration-time options which may be selected by the user
# and checked with opt-val and opt-bool. The format of options-spec follows.
#
# A boolean option is of the form:
#
## name[=0|1] => "Description of this boolean option"
#
# The default is name=0, meaning that the option is disabled by default.
# If name=1 is used to make the option enabled by default, the description should reflect
# that with text like "Disable support for ...".
#
# An argument option (one which takes a parameter) is of the form:
#
## name:[=]value => "Description of this option"
#
# If the name:value form is used, the value must be provided with the option (as --name=myvalue).
# If the name:=value form is used, the value is optional and the given value is used as the default
# if is not provided.
#
# Undocumented options are also supported by omitting the "=> description.
# These options are not displayed with --help and can be useful for internal options or as aliases.
#
# For example, --disable-lfs is an alias for --disable=largefile:
#
## lfs=1 largefile=1 => "Disable large file support"
#
proc options {optlist} {
# Allow options as a list or args
options-add $optlist "Local Options:"
if {$::autosetup(showhelp)} {
options-show
exit 0
}
# Check for invalid options
if {[opt-bool option-checking]} {
foreach o [array names ::useropts] {
if {$o ni $::autosetup(options)} {
user-error "Unknown option --$o"
}
}
}
}
proc config_guess {} {
if {[file-isexec $::autosetup(dir)/config.guess]} {
exec-with-stderr sh $::autosetup(dir)/config.guess
if {[catch {exec-with-stderr sh $::autosetup(dir)/config.guess} alias]} {
user-error $alias
}
return $alias
} else {
configlog "No config.guess, so using uname"
string tolower [exec uname -p]-unknown-[exec uname -s][exec uname -r]
}
}
proc config_sub {alias} {
if {[file-isexec $::autosetup(dir)/config.sub]} {
if {[catch {exec-with-stderr sh $::autosetup(dir)/config.sub $alias} alias]} {
user-error $alias
}
}
return $alias
}
# @define name ?value=1?
#
# Defines the named variable to the given value.
# These (name, value) pairs represent the results of the configuration check
# and are available to be checked, modified and substituted.
#
proc define {name {value 1}} {
set ::define($name) $value
#dputs "$name <= $value"
}
# @define-append name value ...
#
# Appends the given value(s) to the given 'defined' variable.
# If the variable is not defined or empty, it is set to $value.
# Otherwise the value is appended, separated by a space.
# Any extra values are similarly appended.
# If any value is already contained in the variable (as a substring) it is omitted.
#
proc define-append {name args} {
if {[get-define $name ""] ne ""} {
# Make a token attempt to avoid duplicates
foreach arg $args {
if {[string first $arg $::define($name)] == -1} {
append ::define($name) " " $arg
}
}
} else {
set ::define($name) [join $args]
}
#dputs "$name += [join $args] => $::define($name)"
}
# @get-define name ?default=0?
#
# Returns the current value of the 'defined' variable, or $default
# if not set.
#
proc get-define {name {default 0}} {
if {[info exists ::define($name)]} {
#dputs "$name => $::define($name)"
return $::define($name)
}
#dputs "$name => $default"
return $default
}
# @is-defined name
#
# Returns 1 if the given variable is defined.
#
proc is-defined {name} {
info exists ::define($name)
}
# @all-defines
#
# Returns a dictionary (name value list) of all defined variables.
#
# This is suitable for use with 'dict', 'array set' or 'foreach'
# and allows for arbitrary processing of the defined variables.
#
proc all-defines {} {
array get ::define
}
# @get-env name default
#
# If $name was specified on the command line, return it.
# If $name was set in the environment, return it.
# Otherwise return $default.
#
proc get-env {name default} {
if {[dict exists $::autosetup(cmdline) $name]} {
return [dict get $::autosetup(cmdline) $name]
}
getenv $name $default
}
# @env-is-set name
#
# Returns 1 if the $name was specified on the command line or in the environment.
# Note that an empty environment variable is not considered to be set.
#
proc env-is-set {name} {
if {[dict exists $::autosetup(cmdline) $name]} {
return 1
}
if {[getenv $name ""] ne ""} {
return 1
}
return 0
}
# @readfile filename ?default=""?
#
# Return the contents of the file, without the trailing newline.
# If the doesn't exist or can't be read, returns $default.
#
proc readfile {filename {default_value ""}} {
set result $default_value
catch {
set f [open $filename]
set result [read -nonewline $f]
close $f
}
return $result
}
# @writefile filename value
#
# Creates the given file containing $value.
# Does not add an extra newline.
#
proc writefile {filename value} {
set f [open $filename w]
puts -nonewline $f $value
close $f
}
proc quote-if-needed {str} {
if {[string match {*[\" ]*} $str]} {
return \"[string map [list \" \\" \\ \\\\] $str]\"
}
return $str
}
proc quote-argv {argv} {
set args {}
foreach arg $argv {
lappend args [quote-if-needed $arg]
}
join $args
}
# @suffix suf list
#
# Takes a list and returns a new list with $suf appended
# to each element
#
## suffix .c {a b c} => {a.c b.c c.c}
#
proc suffix {suf list} {
set result {}
foreach p $list {
lappend result $p$suf
}
return $result
}
# @prefix pre list
#
# Takes a list and returns a new list with $pre prepended
# to each element
#
## prefix jim- {a.c b.c} => {jim-a.c jim-b.c}
#
proc prefix {pre list} {
set result {}
foreach p $list {
lappend result $pre$p
}
return $result
}
# @find-executable name
#
# Searches the path for an executable with the given name.
# Note that the name may include some parameters, e.g. "cc -mbig-endian",
# in which case the parameters are ignored.
# Returns 1 if found, or 0 if not.
#
proc find-executable {name} {
# Ignore any parameters
set name [lindex $name 0]
if {$name eq ""} {
# The empty string is never a valid executable
return 0
}
foreach p [split-path] {
dputs "Looking for $name in $p"
set exec [file join $p $name]
if {[file-isexec $exec]} {
dputs "Found $name -> $exec"
return 1
}
}
return 0
}
# @find-an-executable ?-required? name ...
#
# Given a list of possible executable names,
# searches for one of these on the path.
#
# Returns the name found, or "" if none found.
# If the first parameter is '-required', an error is generated
# if no executable is found.
#
proc find-an-executable {args} {
set required 0
if {[lindex $args 0] eq "-required"} {
set args [lrange $args 1 end]
incr required
}
foreach name $args {
if {[find-executable $name]} {
return $name
}
}
if {$required} {
if {[llength $args] == 1} {
user-error "failed to find: [join $args]"
} else {
user-error "failed to find one of: [join $args]"
}
}
return ""
}
# @configlog msg
#
# Writes the given message to the configuration log, config.log
#
proc configlog {msg} {
if {![info exists ::autosetup(logfh)]} {
set ::autosetup(logfh) [open config.log w]
}
puts $::autosetup(logfh) $msg
}
# @msg-checking msg
#
# Writes the message with no newline to stdout.
#
proc msg-checking {msg} {
if {$::autosetup(msg-quiet) == 0} {
maybe-show-timestamp
puts -nonewline $msg
set ::autosetup(msg-checking) 1
}
}
# @msg-result msg
#
# Writes the message to stdout.
#
proc msg-result {msg} {
if {$::autosetup(msg-quiet) == 0} {
maybe-show-timestamp
puts $msg
set ::autosetup(msg-checking) 0
show-notices
}
}
# @msg-quiet command ...
#
# msg-quiet evaluates it's arguments as a command with output
# from msg-checking and msg-result suppressed.
#
# This is useful if a check needs to run a subcheck which isn't
# of interest to the user.
proc msg-quiet {args} {
incr ::autosetup(msg-quiet)
set rc [uplevel 1 $args]
incr ::autosetup(msg-quiet) -1
return $rc
}
# Will be overridden by 'use misc'
proc error-stacktrace {msg} {
return $msg
}
proc error-location {msg} {
return $msg
}
##################################################################
#
# Debugging output
#
proc dputs {msg} {
if {$::autosetup(debug)} {
puts $msg
}
}
##################################################################
#
# User and system warnings and errors
#
# Usage errors such as wrong command line options
# @user-error msg
#
# Indicate incorrect usage to the user, including if required components
# or features are not found.
# autosetup exits with a non-zero return code.
#
proc user-error {msg} {
show-notices
puts stderr "Error: $msg"
puts stderr "Try: '[file tail $::autosetup(exe)] --help' for options"
exit 1
}
# @user-notice msg
#
# Output the given message to stderr.
#
proc user-notice {msg} {
lappend ::autosetup(notices) $msg
}
# Incorrect usage in the auto.def file. Identify the location.
proc autosetup-error {msg} {
autosetup-full-error [error-location $msg]
}
# Like autosetup-error, except $msg is the full error message.
proc autosetup-full-error {msg} {
show-notices
puts stderr $msg
exit 1
}
proc show-notices {} {
if {$::autosetup(msg-checking)} {
puts ""
set ::autosetup(msg-checking) 0
}
flush stdout
if {[info exists ::autosetup(notices)]} {
puts stderr [join $::autosetup(notices) \n]
unset ::autosetup(notices)
}
}
proc maybe-show-timestamp {} {
if {$::autosetup(msg-timing) && $::autosetup(msg-checking) == 0} {
puts -nonewline [format {[%6.2f] } [expr {([clock millis] - $::autosetup(start)) % 10000 / 1000.0}]]
}
}
proc autosetup_version {} {
return "autosetup v$::autosetup(version)"
}
##################################################################
#
# Directory/path handling
#
proc realdir {dir} {
set oldpwd [pwd]
cd $dir
set pwd [pwd]
cd $oldpwd
return $pwd
}
# Follow symlinks until we get to something which is not a symlink
proc realpath {path} {
while {1} {
if {[catch {
set path [file readlink $path]
}]} {
# Not a link
break
}
}
return $path
}
# Convert absolute path, $path into a path relative
# to the given directory (or the current dir, if not given).
#
proc relative-path {path {pwd {}}} {
set diff 0
set same 0
set newf {}
set prefix {}
set path [file-normalize $path]
if {$pwd eq ""} {
set pwd [pwd]
} else {
set pwd [file-normalize $pwd]
}
if {$path eq $pwd} {
return .
}
# Try to make the filename relative to the current dir
foreach p [split $pwd /] f [split $path /] {
if {$p ne $f} {
incr diff
} elseif {!$diff} {
incr same
}
if {$diff} {
if {$p ne ""} {
# Add .. for sibling or parent dir
lappend prefix ..
}
if {$f ne ""} {
lappend newf $f
}
}
}
if {$same == 1 || [llength $prefix] > 3} {
return $path
}
file join [join $prefix /] [join $newf /]
}
# Add filename as a dependency to rerun autosetup
# The name will be normalised (converted to a full path)
#
proc autosetup_add_dep {filename} {
lappend ::autosetup(deps) [file-normalize $filename]
}
##################################################################
#
# Library module support
#
# @use module ...
#
# Load the given library modules.
# e.g. 'use cc cc-shared'
#
# Note that module 'X' is implemented in either 'autosetup/X.tcl'
# or 'autosetup/X/init.tcl'
#
# The latter form is useful for a complex module which requires additional
# support file. In this form, '$::usedir' is set to the module directory
# when it is loaded.
#
proc use {args} {
foreach m $args {
if {[info exists ::libmodule($m)]} {
continue
}
set ::libmodule($m) 1
if {[info exists ::modsource($m)]} {
automf_load eval $::modsource($m)
} else {
set sources [list $::autosetup(libdir)/${m}.tcl $::autosetup(libdir)/${m}/init.tcl]
set found 0
foreach source $sources {
if {[file exists $source]} {
incr found
break
}
}
if {$found} {
# For the convenience of the "use" source, point to the directory
# it is being loaded from
set ::usedir [file dirname $source]
automf_load source $source
autosetup_add_dep $source
} else {
autosetup-error "use: No such module: $m"
}
}
}
}
# Load module source in the global scope by executing the given command
proc automf_load {args} {
if {[catch [list uplevel #0 $args] msg opts] ni {0 2 3}} {
autosetup-full-error [error-dump $msg $opts $::autosetup(debug)]
}
}
|
Changes to autosetup/lib/cthulhu.tcl.
1 2 3 4 5 6 7 8 9 10 11 |
###
# Utilities for automating the build process of C extensions
###
use codebale
#::namespace eval ::cthulhu {}
###
# title: define which modules the source we are adding contributes to
###
proc cthulhu_config args {
| > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
###
# Utilities for automating the build process of C extensions
###
use codebale
# @synopsis:
#
# CTHULHU modules adds autobuild utilities
#
#::namespace eval ::cthulhu {}
###
# title: define which modules the source we are adding contributes to
###
proc cthulhu_config args {
|
| ︙ | ︙ |
Changes to autosetup/lib/fileutil.tcl.
1 2 3 4 5 6 7 8 9 10 11 12 13 | # fileutil.tcl -- # # Tcl implementations of standard UNIX utilities. # # Copyright (c) 1998-2000 by Ajuba Solutions. # Copyright (c) 2002 by Phil Ehrens <phil@slug.org> (fileType) # Copyright (c) 2005-2013 by Andreas Kupries <andreas_kupries@users.sourceforge.net> # # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # # RCS: @(#) $Id: fileutil.tcl,v 1.78 2010/06/17 04:46:19 andreas_kupries Exp $ | > > > > > | | 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 |
# fileutil.tcl --
#
# Tcl implementations of standard UNIX utilities.
#
# Copyright (c) 1998-2000 by Ajuba Solutions.
# Copyright (c) 2002 by Phil Ehrens <phil@slug.org> (fileType)
# Copyright (c) 2005-2013 by Andreas Kupries <andreas_kupries@users.sourceforge.net>
#
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
# RCS: @(#) $Id: fileutil.tcl,v 1.78 2010/06/17 04:46:19 andreas_kupries Exp $
# @synopsis:
#
# CODEBALE modules adds a jimtcl compadible version of the fileutil package from tcllib
#
package provide cthulhu-fileutil 1.14.8
#namespace eval ::fileutil {
# namespace export \
# find findByPattern cat touch foreachLine \
# jail stripPwd stripN stripPath tempdir tempfile \
# install fileType writeFile appendToFile \
# insertIntoFile removeFromFile replaceInFile \
|
| ︙ | ︙ |
Changes to autosetup/lib/install.tcl.
| ︙ | ︙ | |||
15 16 17 18 19 20 21 |
# First the main script, but only up until "CUT HERE"
set in [open $::autosetup(dir)/autosetup]
while {[gets $in buf] >= 0} {
if {$buf ne "##-- CUT HERE --##"} {
puts $f $buf
continue
}
| | | 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# First the main script, but only up until "CUT HERE"
set in [open $::autosetup(dir)/autosetup]
while {[gets $in buf] >= 0} {
if {$buf ne "##-- CUT HERE --##"} {
puts $f $buf
continue
}
# Insert the static modules here
# i.e. those which don't contain @synopsis:
puts $f "set autosetup(installed) 1"
foreach file [lsort [glob $::autosetup(libdir)/*.tcl]] {
set buf [readfile $file]
if {[string match "*\n# @synopsis:*" $buf]} {
lappend publicmodules $file
|
| ︙ | ︙ |
Changes to scripts/common.tcl.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
###
# Common suite of routines for the odie boostrap process
###
set path [file normalize [file join [file dirname [file normalize [info script]]] ..]]
if {[file exists [file join $path odieConfig.tcl]]} {
source [file join $path odieConfig.tcl]
}
proc ::noop args {}
namespace eval ::sherpa_bootstrap {}
proc ::sherpa_bootstrap::download_fossil {pkg} {
variable distribution
| > > > > > > > > > > > > > > > > > > > > > > | 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 |
###
# Common suite of routines for the odie boostrap process
###
set path [file normalize [file join [file dirname [file normalize [info script]]] ..]]
if {[file exists [file join $path odieConfig.tcl]]} {
source [file join $path odieConfig.tcl]
}
set ::autosetup(exe) $::argv0
set ::autosetup(istcl) 1
set ::autosetup(start) [clock millis]
set ::autosetup(installed) 0
set ::autosetup(msg-checking) 0
set ::autosetup(msg-quiet) 0
set ::autosetup(msg-timing) 0
set ::autosetup(dir) [file join $path autosetup]
set ::autosetup(builddir) [file join $path]
set ::autosetup(srcdir) [file join $path]
set ::autosetup(libdir) [file join $path autosetup lib]
set ::autosetup(debug) 1
set ::autosetup(cmdline) {}
set ::autosetup(options) {}
set ::autosetup(optionhelp) {}
set ::autosetup(showhelp) 0
foreach file {
core.tcl formatting.tcl getopt.tcl misc.tcl
} {
source [file join $::autosetup(libdir) $file]
}
proc ::noop args {}
namespace eval ::sherpa_bootstrap {}
proc ::sherpa_bootstrap::download_fossil {pkg} {
variable distribution
|
| ︙ | ︙ | |||
179 180 181 182 183 184 185 186 187 188 189 190 191 192 |
::sherpa_bootstrap::distribution taolib {
get_proc download_fossil
requires {sqlite tcllib tklib}
build_proc build_sak
}
::sherpa_bootstrap::distribution tcllib {
get_proc download_fossil
build_proc build_sak
}
::sherpa_bootstrap::distribution tklib {
get_proc download_fossil
requires tcllib
build_proc build_sak
}
| > | 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 |
::sherpa_bootstrap::distribution taolib {
get_proc download_fossil
requires {sqlite tcllib tklib}
build_proc build_sak
}
::sherpa_bootstrap::distribution tcllib {
get_proc download_fossil
fossil_branch odie
build_proc build_sak
}
::sherpa_bootstrap::distribution tklib {
get_proc download_fossil
requires tcllib
build_proc build_sak
}
|
| ︙ | ︙ |
Changes to scripts/make_basekit.tcl.
| ︙ | ︙ | |||
18 19 20 21 22 23 24 |
if { $::odie(platform) eq "windows" } {
cd [::realpath ${TK_STATIC_SRCPATH}]
domake tk.res.o
domake wish.res.o
}
}
cd [::realpath $::odie(sandbox)/odie/src/toadkit]
| | > | 18 19 20 21 22 23 24 25 26 27 28 |
if { $::odie(platform) eq "windows" } {
cd [::realpath ${TK_STATIC_SRCPATH}]
domake tk.res.o
domake wish.res.o
}
}
cd [::realpath $::odie(sandbox)/odie/src/toadkit]
puts "Building kits in [pwd]"
source configure.tcl
domake clean
domake install
|
Changes to scripts/make_sherpa.tcl.
1 2 | #!/bin/sh # \ | > > > | | < < < < | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
#!/bin/sh
# Copyright (c) 2006-2011 WorkWare Systems http://www.workware.net.au/
# All rights reserved
# vim:se syntax=tcl:
# \
dir=`dirname "$0"`; exec "`$dir/../autosetup/find-tclsh`" "$0" "$@"
set path [file normalize [file join [file dirname [file normalize [info script]]] ..]]
source [file join $path scripts common.tcl]
proc get_distro {pkg} {
set PKG_SRCPATH $::odie(sandbox)/$pkg
if {![file exists $::odie(download)/$pkg.fos]} {
puts "Fossil clone $pkg"
doexec $::odie(fossil) clone $::odie(mirror_url)/$pkg $::odie(download)/$pkg.fos
}
|
| ︙ | ︙ | |||
26 27 28 29 30 31 32 |
doexec $::odie(fossil) update
return ${PKG_SRCPATH}
}
get_distro odielib
get_distro sherpa
| < < < | > | 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
doexec $::odie(fossil) update
return ${PKG_SRCPATH}
}
get_distro odielib
get_distro sherpa
###
# Build supporting libraries needed by Sherpa
##
# Rebuild sherpa
set SHERPA_SRCPATH $::odie(src_dir)/../sherpa
cd ${SHERPA_SRCPATH}
doexec [info nameofexecutable] autosetup/autosetup
doexec make clean
doexec make install
|
Name change from src/toadkit/Makefile to src/toadkit/Makefile.in.
1 |
| > > > | > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
include ../../odieConfig.sh
NAME = @PKG_NAME@
VER = @PKG_VER@
PKG_OBJECTS = @PKG_OBJECTS@
PKG_SOURCES = @PKG_SOURCES@
TCL_SRCROOT=${SANDBOX}/tcl
TCL_SRCPATH=${SANDBOX}/tcl/${ODIE_TCL_PLATFORM_DIR}
TK_SRCROOT=${SANDBOX}/tk
TK_SRCPATH=${SANDBOX}/tk/${ODIE_TCL_PLATFORM_DIR}
ZIPSRC_SRC = ${ODIE_SRC_DIR}/src/zip30
PWD=${ODIE_SRC_DIR}/src/toadkit
ZLIB_DIR = ${TCL_SRCROOT}/compat/zlib
|
| ︙ | ︙ |
Changes to src/toadkit/configure.tcl.
1 2 3 4 5 6 7 8 | ### # This file assembles the machine-generated portions of this # extension #### set path [file normalize [file dirname [info script]]] set ::project(src) $path set ::project(path) [file normalize [file join $path .. ..]] | | < | | < < < < > > | 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 |
###
# This file assembles the machine-generated portions of this
# extension
####
set path [file normalize [file dirname [info script]]]
set ::project(src) $path
set ::project(path) [file normalize [file join $path .. ..]]
if {![info exists ::odie(host)]} {
source [file join $::project(path) scripts common.tcl]
puts "CALLED EXTERNALLY"
}
use cc system cthulhu
if {$::odie(windows)} {
set ::project(name) odie_static
set ::project(pkgname) odielib_static
} else {
set ::project(name) odie
set ::project(pkgname) odielib
}
set ::project(pkgvers) 2.1
set ::project(h_file) $::project(name).h
set ::project(h_file_int) $::project(name)Int.h
set ::project(c_file) lib${::project(name)}.c
set ::project(init_funct) [string totitle ${::project(name)}lib]_Init
set ::project(target) static
parray ::project
set ::project(standard_header) [subst {
|
| ︙ | ︙ | |||
57 58 59 60 61 62 63 |
dict set config_module math build-ignore-cfiles quaternion.c
#cthulhu_add_directory [file join $::project(src) build] $config
#cthulhu_add_directory [file join $::project(src) generic] $config
#if {$::tcl_platform(platform) eq "unix"} {
# cthulhu_add_directory [file join $::project(src) unix] $config
#}
| | | | 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 |
dict set config_module math build-ignore-cfiles quaternion.c
#cthulhu_add_directory [file join $::project(src) build] $config
#cthulhu_add_directory [file join $::project(src) generic] $config
#if {$::tcl_platform(platform) eq "unix"} {
# cthulhu_add_directory [file join $::project(src) unix] $config
#}
#foreach path [lsort -dictionary [glob [file join $::odie(sandbox) odielib cmodules *]]] {
# if {[file exists [file join $path cthulhu.ini]]} {
# source [file join $path cthulhu.ini]
# }
#}
#foreach dir {logicset odieutil} {
# set path [file join $::odie(sandbox) odielib cmodules $dir]
# if {[file exists [file join $path cthulhu.ini]]} {
# source [file join $path cthulhu.ini]
# }
#}
###
# Add our Zip file system functions
|
| ︙ | ︙ | |||
98 99 100 101 102 103 104 |
cthulhu_add_csource [file join $::odie(sandbox_path) tcl win tclWinReg.c]
} else {
#cthulhu_include_directory [file join $::odie_build(sandbox) tcl unix]
cthulhu_add_csource [file join $::project(src) unix tclsh_packages.c] {scan 0}
cthulhu_add_csource [file join $::odie(sandbox_path) tcl unix tclAppInit.c] {scan 0 extra {-DTCL_LOCAL_APPINIT=Toadkit_AppInit -DTCL_LOCAL_MAIN_HOOK=Toadkit_MainHook}}
}
if {$::odie(windows)} {
| | | | | | | | | | 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 |
cthulhu_add_csource [file join $::odie(sandbox_path) tcl win tclWinReg.c]
} else {
#cthulhu_include_directory [file join $::odie_build(sandbox) tcl unix]
cthulhu_add_csource [file join $::project(src) unix tclsh_packages.c] {scan 0}
cthulhu_add_csource [file join $::odie(sandbox_path) tcl unix tclAppInit.c] {scan 0 extra {-DTCL_LOCAL_APPINIT=Toadkit_AppInit -DTCL_LOCAL_MAIN_HOOK=Toadkit_MainHook}}
}
if {$::odie(windows)} {
if {![file exists [file join $::odie(sandbox) odielib cmodules odieutil password.c]]} {
puts "BUILDING PASSWORD (toadkit)"
source [file join $::odie(sandbox) cmodules odieutil mkPassword.tcl]
}
cthulhu_add_csource [file join $::odie(sandbox) odielib cmodules odieutil password.c]
cthulhu_add_csource [file join $::odie(sandbox) odielib cmodules odieutil memory.c]
cthulhu_add_csource [file join $::odie(sandbox) odielib cmodules odieutil md5.c]
cthulhu_add_csource [file join $::odie(sandbox) odielib cmodules odieutil rc4.c]
cthulhu_add_csource [file join $::odie(sandbox) odielib cmodules odieutil tclextra.c]
} else {
foreach path [lsort -dictionary [glob [file join $::odie(sandbox) odielib cmodules *]]] {
if {[file exists [file join $path cthulhu.ini]]} {
source [file join $path cthulhu.ini]
}
}
}
###
|
| ︙ | ︙ | |||
130 131 132 133 134 135 136 137 |
cthulhu_add_dynamic [file join $::project(src) generic $::project(c_file)] [file join $::project(src) configure.tcl]
cthulhu_add_csource [file join $::project(src) generic $::project(c_file)] {scan 0}
###
# Build our cthulhu.mk file
###
cthulhu_mk_sources build [file join $::project(src) cthulhu.mk]
| > | 127 128 129 130 131 132 133 134 135 |
cthulhu_add_dynamic [file join $::project(src) generic $::project(c_file)] [file join $::project(src) configure.tcl]
cthulhu_add_csource [file join $::project(src) generic $::project(c_file)] {scan 0}
###
# Build our cthulhu.mk file
###
cthulhu_mk_sources build [file join $::project(src) cthulhu.mk]
make-template [file join $::project(src) Makefile.in]
|