diff options
author | Andrej Shadura <andrewsh@debian.org> | 2018-06-05 17:46:12 +0200 |
---|---|---|
committer | Andrej Shadura <andrewsh@debian.org> | 2018-06-05 17:46:12 +0200 |
commit | 54125d6d989c8b39763672077b3995069dea31ad (patch) | |
tree | de5b827a302f36e8d7bc89fc68fa8439c5d287ba /lib/app-critcl/critcl.tcl | |
parent | b4466daaef6c0c756b4ab04e7d4f2d97d25b15c4 (diff) |
New upstream version 3.1.8
Diffstat (limited to 'lib/app-critcl/critcl.tcl')
-rw-r--r-- | lib/app-critcl/critcl.tcl | 94 |
1 files changed, 60 insertions, 34 deletions
diff --git a/lib/app-critcl/critcl.tcl b/lib/app-critcl/critcl.tcl index e840148..2068c83 100644 --- a/lib/app-critcl/critcl.tcl +++ b/lib/app-critcl/critcl.tcl @@ -21,7 +21,11 @@ package provide critcl::app [package require critcl] package require cmdline -package require platform + +# It is expected here that critcl already imported platform, or an +# equivalent package, i.e. the critcl::platform fallback. No need to +# do it again. +#package require platform # Note: We can assume here that the commands lassign and dict are # available. The critcl package has made sure of that. @@ -135,7 +139,7 @@ proc ::critcl::app::main {argv} { StopOnFailed if {$v::keep} { - puts stderr "Files left in [critcl::cache]" + ::critcl::print stderr "Files left in [critcl::cache]" } return } @@ -149,11 +153,11 @@ proc ::critcl::app::PackageCache {} { proc ::critcl::app::StopOnFailed {} { if {!$v::failed} return - puts stderr "Files left in [critcl::cache]" - puts stderr "FAILURES $v::failed" - puts stderr "FAILED: [join $v::borken "\nFAILED: "]" - puts stderr "FAILED [join [split [join $v::log \n\n] \n] "\nFAILED "]" - return -code return + ::critcl::print stderr "Files left in [critcl::cache]" + ::critcl::print stderr "FAILURES $v::failed" + ::critcl::print stderr "FAILED: [join $v::borken "\nFAILED: "]" + ::critcl::print stderr "FAILED [join [split [join $v::log \n\n] \n] "\nFAILED "]" + exit 1 ; #return -code return } proc ::critcl::app::Cmdline {argv} { @@ -213,7 +217,7 @@ proc ::critcl::app::Cmdline {argv} { } switch -exact -- $opt { v - -version { - puts stdout [package present critcl] + ::critcl::print [package present critcl] ::exit 0 } I { AddIncludePath $arg } @@ -223,15 +227,15 @@ proc ::critcl::app::Cmdline {argv} { config { set configfile $arg } debug { lappend v::debug $arg - critcl::config lines 0 + #critcl::config lines 0 } force { critcl::config force 1 - puts stderr "Compilation forced" + ::critcl::print stderr "Compilation forced" } keep { critcl::config keepsrc 1 - critcl::config lines 0 + #critcl::config lines 0 set v::keep 1 } help { incr help } @@ -243,6 +247,7 @@ proc ::critcl::app::Cmdline {argv} { lappend ::auto_path $arg lappend ::auto_path [file dirname $arg] + AddLibraryPath $arg } includedir { set v::incdir $arg @@ -326,11 +331,11 @@ proc ::critcl::app::Cmdline {argv} { } if {$showtarget} { - puts stdout [critcl::targetplatform] + ::critcl::print [critcl::targetplatform] } if {$targets} { - puts [critcl::knowntargets] + ::critcl::print [critcl::knowntargets] } if {$show || $showall || $targets || $showtarget} { @@ -446,14 +451,14 @@ proc ::critcl::app::AddLibraryPath {path} { proc ::critcl::app::Log {text} { if {!$v::verbose} return - puts -nonewline $text + ::critcl::print -nonewline $text flush stdout return } proc ::critcl::app::LogLn {text} { if {!$v::verbose} return - puts $text + ::critcl::print $text flush stdout return } @@ -461,10 +466,10 @@ proc ::critcl::app::LogLn {text} { proc ::critcl::app::Usage {args} { global argv0 if {[llength $args]} { - puts stderr "$argv0 error: [join $args]" + ::critcl::print stderr "$argv0 error: [join $args]" } - puts stderr [string map [list @ $argv0] {To compile and run a tcl script + ::critcl::print stderr [string map [list @ $argv0] {To compile and run a tcl script @ [-force] [-keep] [-cache dir] file[.tcl] To compile and build a package @@ -499,11 +504,11 @@ You can display the built-in help wiki on most platforms using: proc ::critcl::app::Help {} { if {[catch {package require Mk4tcl} msg] || [catch {package require Wikit} msg]} { - puts $msg + ::critcl::print $msg set txt "Couldn't load the Critcl help Wiki\n" append txt "To display the Critcl help wiki run \"critcl\" " append txt "without any options.\n" - puts $txt + ::critcl::print $txt exit } else { Wikit::init [file join $::starkit::topdir doc critcl.tkd] @@ -599,8 +604,8 @@ proc ::critcl::app::ProcessInput {} { set found [file exists $fn] } if {!$found} { - if {!$first} { puts stderr "" } - puts stderr "$f doesn't exist" + if {!$first} { ::critcl::print stderr "" } + ::critcl::print stderr "$f doesn't exist" incr missing continue } @@ -682,7 +687,7 @@ proc ::critcl::app::ProcessInput {} { uplevel #0 [list source $fn] if {[critcl::cnothingtodo $fn]} { - puts stderr "nothing to build for $f" + ::critcl::print stderr "nothing to build for $f" continue } @@ -711,14 +716,22 @@ proc ::critcl::app::ProcessInput {} { # maximum information about problems from a single run, not # fix things one by one. + set results [critcl::cresults $fn] if {$failed} { lappend v::borken $f - lappend v::log [dict get [critcl::cresults $fn] log] + lappend v::log [dict get $results log] Log "(FAILED) " + } elseif {[dict exists $results warnings]} { + # There might be warnings to print even if the build did + # not fail. + set warnings [dict get $results warnings] + if {[llength $warnings]} { + ::critcl::print stderr "\n\nWarning [join $warnings "\nWarning "]" + } } if {$v::failed || ($v::mode ne "pkg")} continue - array set r [critcl::cresults $fn] + array set r $results append v::edecls "extern Tcl_AppInitProc $r(initname)_Init;\n" append v::initnames " if ($r(initname)_Init(ip) != TCL_OK) return TCL_ERROR;\n" @@ -780,7 +793,7 @@ proc ::critcl::app::License {file text} { } proc ::critcl::app::BuildBracket {} { - puts "\nLibrary: [file tail $v::shlname]" + ::critcl::print "\nLibrary: [file tail $v::shlname]" # The overarching initialization code, the bracket, has no real # file behind it. Fake it based on the destination shlib, this @@ -856,7 +869,7 @@ proc ::critcl::app::ExportHeaders {} { set stem [file tail $dir] set dst [file join $incdir $stem] - puts "Headers: $v::incdir/$stem" + ::critcl::print "Headers: $v::incdir/$stem" file mkdir $dst foreach f [glob -nocomplain -directory $dir *] { @@ -887,7 +900,7 @@ proc ::critcl::app::AssemblePackage {} { } else { set dir $pkgdir } - puts "Package: $dir" + ::critcl::print "Package: $dir" file mkdir $pkgdir file mkdir $shlibdir @@ -951,7 +964,7 @@ proc ::critcl::app::Mapping {} { } if {[llength $plats]} { - puts "Platform: [join $plats {, }] $minver and later" + ::critcl::print "Platform: [join $plats {, }] $minver and later" } set map {} @@ -985,7 +998,7 @@ proc ::critcl::app::Preload {shlibdir} { [file join [critcl::cache] preload[critcl::sharedlibext]] \ $shlibdir - puts "Preload: [join $preload {, }]" + ::critcl::print "Preload: [join $preload {, }]" return $preload } @@ -1101,10 +1114,11 @@ proc ::critcl::app::LoadCommand {version libname tsources shlibdir} { # for low probability of collision with anything else. # NOTE: We have to catch the auto-delete command because # the procedure may have been redefined and destroyed by - # recursive package require's. + # recursive calls to 'package require' of more critcl-based + # packages. set n __critcl_load__ append loadcmd "\n catch \{rename $n {}\}";# auto delete - set loadcmd "\"\[list proc $n \{dir\} \{$loadcmd\n\}\] ; \[list $n \$dir\]\"" + set loadcmd "\"\[list proc $n \{dir\} \{[string map [list \n { ; }] $loadcmd]\}\] ; \[list $n \$dir\]\"" } lappend v::meta [list entrytclcommand [list "eval $loadcmd"]] @@ -1542,7 +1556,12 @@ proc ::critcl::app::PlaceTEASupport {pkgdir pkgname pversion porg} { set here [pwd] cd $pkgdir - exec [LocateAutoconf] + if {$::tcl_platform(platform) eq "windows"} { + # msys/mingw, cygwin, or other unix emulation on windows. + exec sh [LocateAutoconf 1] + } else { + exec [LocateAutoconf 0] + } file delete -force autom4te.cache lappend v::meta [list included configure] @@ -1659,14 +1678,21 @@ proc ::critcl::app::PlaceInputFiles {pkgdir} { return } -proc ::critcl::app::LocateAutoconf {} { +proc ::critcl::app::LocateAutoconf {iswin} { set ac [auto_execok autoconf] if {$ac eq {}} { return -code error "autoconf 2.59 or higher required, not found" } - set v [lindex [split [eval [linsert [linsert $ac 0 exec] end --version]] \n] 0 end] + if {$iswin} { + # msys/mingw, cygwin, or other unix emulation on windows. + set cmd [linsert $ac 0 exec sh] + } else { + set cmd [linsert $ac 0 exec] + } + + set v [lindex [split [eval [linsert $cmd end --version]] \n] 0 end] if {![package vsatisfies $v 2.59]} { return -code error "$ac $v is not 2.59 or higher, as required" |