From 374fc96e9ae092d70af9ff8aa64c938ea6938d6b Mon Sep 17 00:00:00 2001
From: Jean-Claude Wippler <jcw@equi4.com>
Date: Fri, 30 Mar 2007 11:26:55 +0000
Subject: [PATCH] started kbs.tcl

git-svn-id: svn://svn.equi4.com/kitgen/trunk@1335 9e558909-932a-0410-a563-af77432da1eb
---
 Makefile         | 29 ++++++++++++++---------------
 README           |  2 +-
 kbs.tcl          | 42 ++++++++++++++++++++++++++++++++++++++++++
 makefile.include |  9 +++++----
 4 files changed, 62 insertions(+), 20 deletions(-)
 create mode 100644 kbs.tcl

diff --git a/Makefile b/Makefile
index e400e8d..c9411d9 100644
--- a/Makefile
+++ b/Makefile
@@ -10,35 +10,34 @@ unspecified-target:
 8.4:
 	mkdir -p $@ && cd $@ && \
 	  cvs -d $(TCL_CVS) co -r core-8-4-branch tcl && \
-	  cvs -d $(TCL_CVS) co thread && \
-	  cvs -d $(TK_CVS) co -r core-8-4-branch tk && \
-	  cvs -d $(VFS_CVS) co tclvfs && \
-	  cvs -d $(VLERQ_CVS) co -d vlerq vlerq/tcl && \
-	  cvs -d $(ZLIB_CVS) co zlib
-	#sh config.sh 8.4/base-aqua sym univ aqua
-	#sh config.sh 8.4/base-x11 sym univ
-	sh config.sh 8.4/base-std sym
+	  cvs -d $(TK_CVS) co -r core-8-4-branch tk
+	#sh config.sh 8.4/base-aqua univ aqua
+	#sh config.sh 8.4/base-x11 univ
+	sh config.sh 8.4/base-std
 
 8.5:
 	mkdir -p $@ && cd $@ && \
 	  cvs -d $(TCL_CVS) co tcl && \
+	  cvs -d $(TK_CVS) co tk
+	#sh config.sh 8.5/base-aqua univ aqua thread
+	#sh config.sh 8.5/base-x11 univ thread
+	sh config.sh 8.5/base-std thread
+
+8.x:
+	mkdir -p $@ && cd $@ && \
 	  cvs -d $(TCL_CVS) co thread && \
-	  cvs -d $(TK_CVS) co tk && \
 	  cvs -d $(VFS_CVS) co tclvfs && \
 	  cvs -d $(VLERQ_CVS) co -d vlerq vlerq/tcl && \
 	  cvs -d $(ZLIB_CVS) co zlib
-	#sh config.sh 8.5/base-aqua sym univ aqua thread
-	#sh config.sh 8.5/base-x11 sym univ thread
-	sh config.sh 8.5/base-std sym thread
-
+	
 cvs:
 	for i in 8*/*/CVS; do (cd `dirname $$i`; cvs up); done
 
-small: 8.4
+small: 8.x 8.4
 	sh config.sh 8.4/kit-small cli dyn
 	cd 8.4/kit-small && $(MAKE) && $(MAKE) clean
 
-large: 8.5
+large: 8.x 8.5
 	sh config.sh 8.5/kit-large aqua univ thread allenc allmsgs tzdata
 	cd 8.5/kit-large && $(MAKE) && $(MAKE) clean
 
diff --git a/README b/README
index 65a6671..3b5dc2b 100644
--- a/README
+++ b/README
@@ -9,7 +9,7 @@ variations of [Tclkit Lite][2], a version of [Tclkit][3] based on [Vlerq][4].
   [3]: http://www.equi4.com/tclkit.html
   [4]: http://www.vlerq.org/
 
-Kitgen is pronounced "kit-chen", which also means "little kit" in German.
+Kitgen is pronounced "kit-chen".
 
 
 News
diff --git a/kbs.tcl b/kbs.tcl
new file mode 100644
index 0000000..1325cc2
--- /dev/null
+++ b/kbs.tcl
@@ -0,0 +1,42 @@
+# kbs.tcl -- Kitgen Build System
+#
+#       Launch as "8.4/base-std/tclkit-cli kbs.tcl" to get a brief help text
+#
+# jcw, 2007-03-30
+
+cd [file dirname [info nameofexe]]
+
+proc kbs {command args} {
+    uplevel 1 ::kbs::$command $args
+}
+
+namespace eval kbs {}
+    
+proc kbs::help {} {
+    puts {Kitgen Build System [$Id:$]
+    
+  kbs ?help?            this text
+  kbs list              list all the extensions which can be built
+}
+}
+
+proc kbs::list {} {
+    puts [glob -directory ../../8.x -tails *.kbs]
+}
+
+# now process the command line to call one of the kbs::* procs
+namespace eval kbs {
+    set cmd [lindex $argv 0]
+    if {[info commands ::kbs::$cmd] ne ""} {
+        eval $argv
+    } elseif {$cmd eq ""} {
+        help
+    } else {
+        set cmdlist {}
+        foreach knowncmd [lsort [info commands ::kbs::*]] {
+            lappend cmdlist [namespace tail $knowncmd]
+        }
+        puts "'$cmd' not found, should be one of: [join $cmdlist {, }]"
+        exit 1
+    }
+}
diff --git a/makefile.include b/makefile.include
index 4e5f451..2541503 100644
--- a/makefile.include
+++ b/makefile.include
@@ -9,6 +9,7 @@
 #LDFLAGS = -framework CoreFoundation -framework Carbon -framework IOKit
 #LDSTRIP = -x
 
+EXTDIR = ../../../../8.x
 KITSRC = ../../kitInit.c ../../pwb.c ../../rechan.c ../../zlib.c \
 	 ../tcl/$(PLAT)/tclAppInit.c
 STATIC = --disable-shared
@@ -53,7 +54,7 @@ build/tcl:
 threaded: build/threaddyn
 build/threaddyn: build/tcl
 	mkdir -p $@ && cd $@ && CFLAGS="$(CFLAGS)" && export CFLAGS && \
-	  sh ../../../thread/configure $(TCLDIR) $(THREADDYN_OPTS) && \
+	  sh $(EXTDIR)/thread/configure $(TCLDIR) $(THREADDYN_OPTS) && \
 	  $(MAKE) install-binaries install-libraries
 
 build/tk: build/tcl
@@ -69,16 +70,16 @@ build/tkdyn: build/tcl
 
 build/tclvfs: build/tcl
 	mkdir -p $@ && cd $@ && CFLAGS="$(CFLAGS)" && export CFLAGS && \
-	  sh ../../../tclvfs/configure $(STATIC) $(TCLDIR) $(VFS_OPTS) && \
+	  sh $(EXTDIR)/tclvfs/configure $(STATIC) $(TCLDIR) $(VFS_OPTS) && \
 	  $(MAKE) install
 
 build/vlerq: build/tcl
 	mkdir -p $@ && cd $@ && CFLAGS="$(CFLAGS)" && export CFLAGS && \
-	  sh ../../../vlerq/configure $(STATIC) $(TCLDIR) $(VLERQ_OPTS) && \
+	  sh $(EXTDIR)/vlerq/configure $(STATIC) $(TCLDIR) $(VLERQ_OPTS) && \
 	  $(MAKE) install
 
 build/zlib: build/tcl
-	cp -R ../zlib/. $@
+	cp -R ../../8.x/zlib/. $@
 	cd $@ && $(MAKE) install prefix=.. CC="$(CC)" CFLAGS="-O $(CFLAGS)"
 
 base: build/tcl build/tk
-- 
2.23.0