added a few extensions to try out the new kbs
authorJean-Claude Wippler <jcw@equi4.com>
Fri, 30 Mar 2007 16:30:31 +0000 (16:30 +0000)
committerJean-Claude Wippler <jcw@equi4.com>
Fri, 30 Mar 2007 16:30:31 +0000 (16:30 +0000)
git-svn-id: svn://svn.equi4.com/kitgen/trunk@1336 9e558909-932a-0410-a563-af77432da1eb

extdefs/incrtcl.kbs [new file with mode: 0644]
extdefs/mk4tcl.kbs [new file with mode: 0644]
extdefs/sqlite.kbs [new file with mode: 0644]
extdefs/tls.kbs [new file with mode: 0644]
extdefs/xotcl.kbs [new file with mode: 0644]
kbs.tcl
setupvfs.tcl

diff --git a/extdefs/incrtcl.kbs b/extdefs/incrtcl.kbs
new file mode 100644 (file)
index 0000000..c5bf8ba
--- /dev/null
@@ -0,0 +1,12 @@
+Version 3.3
+
+Sources cvs incrtcl.cvs.sourceforge.net:/cvsroot/incrtcl incrTcl
+
+Build {
+    Sh [Srcdir]/itcl/configure --with-tcl=[Libdir]
+    Sh make binaries ITCL_LIBRARY=
+    Sh make install-binaries
+    Sh strip -x [Unglob ../lib/itcl3*/libitcl3*]
+}
+
+Result [Unglob ../lib/itcl3*]
\ No newline at end of file
diff --git a/extdefs/mk4tcl.kbs b/extdefs/mk4tcl.kbs
new file mode 100644 (file)
index 0000000..b68f53f
--- /dev/null
@@ -0,0 +1,20 @@
+Version 2.4.9.6
+
+Sources fetch http://www.equi4.com/pub/mk/metakit-2.4.9.6.tar.gz
+
+Build {
+    Sh [Srcdir]/unix/configure --with-tcl=[Incdir]
+    Sh make tcl
+    Sh strip -x Mk4tcl[info sharedlibext]
+
+    file delete -force out
+    file mkdir out
+    file copy Mk4tcl[info sharedlibext] out/libmk4tcl[info sharedlibext]
+    
+    set fd [open out/pkgIndex.tcl w]
+    puts $fd "package ifneeded Mk4tcl [Version] \\"
+    puts $fd { [list load [file join $dir libmk4tcl[info sharedlibext]] Mk4tcl]}
+    close $fd
+}
+
+Result out
\ No newline at end of file
diff --git a/extdefs/sqlite.kbs b/extdefs/sqlite.kbs
new file mode 100644 (file)
index 0000000..ba7b532
--- /dev/null
@@ -0,0 +1,11 @@
+Version 3.3.13
+
+Sources fetch http://www.sqlite.org/sqlite-3_3_13-tea.tar.gz
+
+Build {
+    Sh [Srcdir]/configure --with-tcl=[Libdir]
+    Sh make install-binaries
+    Sh strip -x [Unglob ../lib/sqlite3*/libsqlite3*]
+}
+
+Result [Unglob ../lib/sqlite3*]
\ No newline at end of file
diff --git a/extdefs/tls.kbs b/extdefs/tls.kbs
new file mode 100644 (file)
index 0000000..80dcc39
--- /dev/null
@@ -0,0 +1,11 @@
+Version 1.6.1
+
+Sources cvs tls.cvs.sourceforge.net:/cvsroot/tls
+
+Build {
+    Sh [Srcdir]/configure --with-tcl=[Libdir] --with-ssl-dir=/usr
+    Sh make install-binaries
+    Sh strip -x [Unglob ../lib/tls1*/libtls1*]
+}
+
+Result [Unglob ../lib/tls1*]
\ No newline at end of file
diff --git a/extdefs/xotcl.kbs b/extdefs/xotcl.kbs
new file mode 100644 (file)
index 0000000..d710b0d
--- /dev/null
@@ -0,0 +1,11 @@
+Version 1.5.3
+
+Sources fetch http://media.wu-wien.ac.at/download/xotcl-1.5.3.tar.gz
+
+Build {
+    Sh [Srcdir]/configure --with-tcl=[Libdir]
+    Sh make install-binaries install-libraries
+    Sh strip -x [Unglob ../lib/xotcl1*/libxotcl1*]
+}
+
+Result [Unglob ../lib/xotcl1*]
\ No newline at end of file
diff --git a/kbs.tcl b/kbs.tcl
index 1325cc297ea13d973e82c81cf6a5b37c83e357da..c77dd0e865d139ae5146a4012a44db856eecfde1 100644 (file)
--- a/kbs.tcl
+++ b/kbs.tcl
@@ -13,15 +13,140 @@ proc kbs {command args} {
 namespace eval kbs {}
     
 proc kbs::help {} {
-    puts {Kitgen Build System [$Id:$]
-    
+    puts "Kitgen Build System
+
+  kbs build target      build the specified extension
   kbs ?help?            this text
   kbs list              list all the extensions which can be built
-}
+  kbs make              build all extensions which haven't been built before
+"
 }
 
 proc kbs::list {} {
-    puts [glob -directory ../../8.x -tails *.kbs]
+    puts [glob -directory ../../extdefs -tails *.kbs]
+}
+
+proc kbs::make {} {
+    foreach f [glob -directory ../../extdefs -tails *.kbs] {
+        set target [file root $f]
+        if {![file exists build/$target]} {
+            puts $target:
+            build $target
+        }
+    }
+}
+
+proc kbs::build {target} {
+    set pwd [pwd]
+    config::init $target
+    cd $pwd
+}
+
+namespace eval config {
+    proc init {name} {
+        namespace eval v [list set package $name]
+        namespace eval v [list set maindir [pwd]]
+        file mkdir build/$name
+        cd build/$name
+        source [Topdir]/extdefs/$name.kbs
+    }
+    
+    proc Version {{ver ""}} {
+        if {$ver ne ""} { set v::version $ver }
+        return $v::version
+    }
+    
+    proc Sources {type args} {
+        if {![file exists [Srcdir]]} {
+            eval [linsert $args 0 src-$type]
+        }
+    }
+    
+    proc src-cvs {path {module ""}} {
+        if {$module eq ""} { set module [file tail $path]}
+        if {[string first @ $path] < 0} { set path :pserver:anonymous@$path }
+        Sh cvs -d $path -z3 co -P -d tmp $module
+        file rename tmp [Srcdir]
+    }
+    
+    proc src-svn {path} {
+        Sh svn co $path [Srcdir]
+    }
+    
+    proc src-fetch {path} {
+        set file [Topdir]/downloads/[file tail $path]
+        if {![file exists $file]} {
+            package require http
+            
+            file mkdir [Topdir]/downloads
+            puts "  fetching $file"
+
+            set fd [open $file w]
+            set t [http::geturl $path -channel $fd]
+            close $fd
+
+            scan [http::code $t] {HTTP/%f %d} ver ncode
+            #puts [http::status $t]
+            http::cleanup $t
+
+            if {$ncode != 200 || [file size $file] == 0} {
+                file delete $file
+                error "fetch failed"
+            }
+        }
+        puts "  untarring $file"
+        file mkdir tmp
+        exec tar xfz $file -C tmp
+        set untarred [glob tmp/*]
+        if {[llength $untarred] == 1 && [file isdir [lindex $untarred 0]]} {
+            file rename [lindex $untarred 0] [Srcdir]
+            file delete tmp
+        } else {
+            file rename tmp [Srcdir]
+        }
+    }
+    
+    proc src-symlink {path} {
+        file link -symbolic [Srcdir] $path
+    }
+    
+    proc Build {script} {
+        puts [Srcdir]
+        eval $script
+    }
+    
+    proc Topdir {} {
+        file normalize $v::maindir/../..
+    }
+    
+    proc Srcdir {} {
+        return [Topdir]/8.x/$v::package-$v::version
+    }
+    
+    proc Incdir {} {
+        file normalize $v::maindir/build/include
+    }
+    
+    proc Libdir {} {
+        file normalize $v::maindir/build/lib
+    }
+    
+    proc Unglob {match} {
+        set paths [glob $match]
+        if {[llength $paths] != 1} { error "not unique: $match" }
+        lindex $paths 0
+    }
+    
+    proc Sh {args} {
+        lappend args >@stdout 2>@stderr
+        eval [linsert $args 0 exec]
+    }
+    
+    proc Result {path} {
+        file mkdir $v::maindir/ext
+        file delete -force $v::maindir/ext/$v::package-$v::version
+        file copy $path $v::maindir/ext/$v::package-$v::version
+    }
 }
 
 # now process the command line to call one of the kbs::* procs
index 70d8f5d6427a6da3c026ba28e1e1cfa7ce3ec007..0f087f5d6dc4a6176704750f686ad7d87459c4f1 100644 (file)
@@ -59,10 +59,10 @@ if {$debugOpt} {
 }
 
 set tcl_library ../tcl/library
-source ../tcl/library/init.tcl       ;# for tcl::CopyDirectory
-source ../tclvfs/library/vfsUtils.tcl
-source ../tclvfs/library/vfslib.tcl   ;# overrides vfs::memchan in vfsUtils.tcl
-source ../vlerq/library/m2mvfs.tcl
+source ../tcl/library/init.tcl ;# for tcl::CopyDirectory
+source ../../8.x/tclvfs/library/vfsUtils.tcl
+source ../../8.x/tclvfs/library/vfslib.tcl ;# override vfs::memchan/vfsUtils.tcl
+source ../../8.x/vlerq/library/m2mvfs.tcl
 
 set clifiles {
   boot.tcl