# Call this script with the tclsh you'd like to build the extension against # Optional argument is the location of tclConfig.sh set zliblib [lindex [glob -nocomplain -directory ./ zlib-1.*] 0] if { [llength $argv] == 0 } { foreach tclconfig [info library] { if { [file exists $tclconfig/tclConfig.sh] } { break } else { if { [file exists [file dirname $tclconfig]/tclConfig.sh] } { set tclconfig [file dirname $tclconfig] break } } } if { ![file exists $tclconfig/tclConfig.sh] } { puts stderr "Could not find tclConfig.sh in the standard locations." puts stderr "You can specify it by running build.tcl like:" puts stderr " $ tclsh build.tcl /directory/name/containing/tclconfig.sh/" exit } } else { set tclconfig [lindex $argv 0] } puts "Using tclConfig.sh in $tclconfig" # Optional build of bundled zlib if { $zliblib ne "" && [file exists $zliblib] } { cd $zliblib puts "**** Configure zlib ****" exec sh configure --shared >@ stdout 2>@ stderr puts "**** Build zlib ****" exec make >@ stdout 2>@ stderr cd .. } puts "**** Configure zlib extension ****" exec sh configure --with-tcl=$tclconfig --with-zlib=$zliblib >@ stdout 2>@ stderr puts "**** Build tcl extension ****" exec make test >@ stdout 2>@ stderr puts "**** Done. You may want to run 'make install' ****"