Version 0 of kbs packages

Updated 2007-05-26 13:01:17 by RZ

kbs means Tclkit Kitgen Build System


Package definitions

  • What is a package?

Originally it is a Tcl extension based on the TEA system. but you can use whatever you want.

  • What do I need to build one?

A "Package" definition in the "kbs/kbs/defs.kbs" file and the sources of the package. The "kbs/kbs/defs.kbs" file will be sourced on startup. It contain the available package definitions. If you will add definitions from another file just source the file like:

 catch {source [file join kbs z.kbs]};# project definitions
  • What is the syntax of the definition file?

Some online help is available with:

 ./kbs.tcl kbs

Here are some parts with comments.

Package {name script}

 The "Package" command is available in definition files.
 @arg name   -- unique name of package
 @arg script -- contain definitions in the following order. For a detailed
  description look in the related commands.
 * Require
 * Source
 * Configure
 * Make
 * Install
 * Clean
 * Result

proc Require {args}

 The given "Package"´s in args will be recursively called.
 @arg args - one or more "Package" names

proc Source {type args}

 Procedure to build source tree of current "Package" definition.
 @arg pkg - name of package source dir under "-sourcedir"
 @arg type - describe action to get source tree of "Package"
 Available are:
  cvs path ... - call "cvs -d path ..."
  svn path     - call "svn co path"
  fetch path   - call "http get path", unpack *.tar.gz or *.tgz files
  tgz file     - call "tar xzf file"
  link path      - use sources from "path"

proc Configure {script}

 If [Makedir] not exist create it and eval script.
 @arg script - tcl script to evaluate

proc Make {script}

 Eval script in [Makedir].
 @arg script - tcl script to evaluate

proc Install {script}

 Eval script in [Makedir].
 @arg script - tcl script to evaluate

proc Test {script}

 Eval script in [Makedir].
 @arg script - tcl script to evaluate

proc Clean {script}

 Eval script in [Makedir].
 @arg script - tcl script to evaluate

proc Result {args}

 Copy all in args to "-resultdir". Remove old entries.
 @arg args - list with files/directories in [Builddir]

Here are some usefull helper procedures.

proc Srcdir {type}

 Return fully qualified path to current "Package" source dir.
 The parent dir can be set on the command line with "-sourcedir".
 @par type: one of "tcl" used in tcl commands and "sys" used in system commands

proc Makedir {type}

 Return fully qualified path to current "Package" make dir.
 Path is in dir [Builddir].
 @par type: one of "tcl" used in tcl commands and "sys" used in system commands

proc Builddir {type}

 Return path of current building dir. This dir contain all [Makedir]
 and is used in the "Install" target.
 The dir can be set on the command line with "-builddir".
 @par type: one of "tcl" used in tcl commands and "sys" used in system commands

proc Run {args}

 The procedure call the args as external command with options.
 The procedure is available in all script arguments.

proc tclConfig {varname}

 The procedure return the content of TCL* variables of the tclConfig.sh file.
 The variables are also available in the "_" array.
 The procedure is intended for use in the "Configure" target.

proc tclConfig {varname}

 The procedure return the content of TK* variables of the tkConfig.sh file.
 The variables are also available in the "_" array.
 The procedure is intended for use in the "Configure" target.

Commenting the "kbs/kbs/defs.kbs" file

  • Provide default version for Require command:
 Package tcl { Require tcl-8.5 }
  • Clear build area and rebuild some packages:
 Package packages {
  file delete -force [Builddir tcl]/lib
  Require tcl-8.5 tk-8.5 bwidget-1.8.0 img-1.3 itcl-3.3 itk-3.3 iwidgets-4.0.2
 }
  • Checkout with tag and from HEAD
 Source cvs tcllib.cvs.sourceforge.net:/cvsroot/tcllib -r tklib-0-4-1 tklib
 Source cvs tclx.cvs.sourceforge.net:/cvsroot/tclx
  • Get file with http
 Source fetch http://www.sqlite.org/sqlite-3_3_17-tea.tar.gz
  • Use sources from another Package
 Source link itcl-3.3
  • Use different directory names for windows builds
 [Builddir tcl] -- used in tcl commands ("C:/")
 [Builddir sys] -- used in system commands e.g. make ("/c/")

[ Category Tclkit | Category Deployment Category Development ]