From 67c8605f03399f75c8328698ed3ac20c9a360d8f Mon Sep 17 00:00:00 2001 From: Jean-Claude Wippler Date: Sat, 31 Mar 2007 11:15:56 +0000 Subject: [PATCH] added build dependency handling git-svn-id: svn://svn.equi4.com/kitgen/trunk@1353 9e558909-932a-0410-a563-af77432da1eb --- extdefs/Itk.kbs | 4 ++-- kbs.tcl | 40 +++++++++++++++++++++++++++++++++++----- 2 files changed, 37 insertions(+), 7 deletions(-) diff --git a/extdefs/Itk.kbs b/extdefs/Itk.kbs index 34d87af..60b3d1a 100644 --- a/extdefs/Itk.kbs +++ b/extdefs/Itk.kbs @@ -1,8 +1,8 @@ Version 3.3 -Requires incrtcl +Requires Itcl -Sources symlink [Topdir]/8.x/incrtcl-[Version] +Sources symlink [Topdir]/8.x/Itcl-[Version] Build { Sh [Srcdir]/itk/configure \ diff --git a/kbs.tcl b/kbs.tcl index f4866e0..6be7d5c 100644 --- a/kbs.tcl +++ b/kbs.tcl @@ -10,7 +10,9 @@ proc kbs {command args} { uplevel 1 ::kbs::$command $args } -namespace eval kbs {} +namespace eval kbs { + variable seq 0 +} proc kbs::help {} { puts "Kitgen Build System @@ -23,11 +25,11 @@ proc kbs::help {} { } proc kbs::list {} { - puts [glob -directory ../../extdefs -tails *.kbs] + puts [lsort -dict [glob -directory ../../extdefs -tails *.kbs]] } proc kbs::make {} { - foreach f [lsort [glob -directory ../../extdefs -tails *.kbs]] { + foreach f [lsort -dict [glob -directory ../../extdefs -tails *.kbs]] { set target [file root $f] if {![file exists build/$target]} { puts $target: @@ -43,9 +45,11 @@ proc kbs::build {target} { } namespace eval config { + proc init {name} { - namespace eval v [list set package $name] - namespace eval v [list set maindir [pwd]] + namespace eval v {} + set v::package $name + set v::maindir [pwd] file mkdir build/$name cd build/$name source [Topdir]/extdefs/$name.kbs @@ -56,6 +60,32 @@ namespace eval config { return $v::version } + proc Requires {args} { + # build all the other required extensions first, then resume this one + # this recurses into kbs::build, so we need to save/restore all state + foreach target $args { + if {![file exists $v::maindir/build/$target]} { + puts ">>> $target (required by $v::package)" + set pwd [pwd] + cd $v::maindir + + set keep {} + foreach x [info vars v::*] { lappend keep $x [set $x] } + namespace delete ::config::v + + set r [catch { ::kbs::build $target } err] + + catch { namespace delete ::config::v } + namespace eval ::config::v {} + foreach {x y} $keep { set $x $y } + + cd $pwd + if {$r} { return -code error $err} + puts "<<< $target (resuming build of $v::package)" + } + } + } + proc Sources {type args} { if {![file exists [Srcdir]]} { eval [linsert $args 0 src-$type] -- 2.23.0