You are viewing a plain text version of this content. The canonical link for it is here.
Posted to rivet-dev@tcl.apache.org by da...@apache.org on 2003/08/20 19:20:48 UTC
cvs commit: tcl-rivet/src/buildscripts LICENSE aardvark.tcl buildscripts.tcl findapxs.tcl findconfig.tcl parsetclConfig.tcl
davidw 2003/08/20 10:20:48
Modified: . ChangeLog
debian rules
doc/html index.html.en
src make.tcl
src/buildscripts LICENSE aardvark.tcl buildscripts.tcl
Added: src configure.in.tcl configure.tcl
Removed: src/buildscripts findapxs.tcl findconfig.tcl
parsetclConfig.tcl
Log:
* src/buildscripts/aardvark.tcl (aardvark::getconfigs): Added new
function to fetch the config info out of configs.tcl.
* src/make.tcl: Removed debinstall target, because we can now
accomplish the same thing by overriding configure options on make's
command line. Removed the configure-style code at the top of the
file.
* src/configure.in.tcl: Specify the variables to test for/create, as
well as some command line options specific to Rivet.
* src/configure.tcl: Added new configure-like system to obtain
information about the environment where Rivet is being compiled.
Running ./configure.tcl creates a file, configs.tcl, with the its
findings. make.tcl now uses those values as its defaults, unless
they are overridden on make.tcl's command line.
Revision Changes Path
1.130 +24 -0 tcl-rivet/ChangeLog
Index: ChangeLog
===================================================================
RCS file: /home/cvs/tcl-rivet/ChangeLog,v
retrieving revision 1.129
retrieving revision 1.130
diff -u -r1.129 -r1.130
--- ChangeLog 5 Aug 2003 17:00:13 -0000 1.129
+++ ChangeLog 20 Aug 2003 17:20:47 -0000 1.130
@@ -1,3 +1,27 @@
+2003-08-20 David N. Welton <da...@dedasys.com>
+
+ * src/buildscripts/aardvark.tcl (aardvark::getconfigs): Added new
+ function to fetch the config info out of configs.tcl.
+
+ * src/make.tcl: Removed debinstall target, because we can now
+ accomplish the same thing by overriding configure options on
+ make's command line. Removed the configure-style code at the top
+ of the file.
+
+ * src/configure.in.tcl: Specify the variables to test for/create,
+ as well as some command line options specific to Rivet.
+
+ * src/configure.tcl: Added new configure-like system to obtain
+ information about the environment where Rivet is being compiled.
+ Running ./configure.tcl creates a file, configs.tcl, with the
+ its findings. make.tcl now uses those values as its defaults,
+ unless they are overridden on make.tcl's command line.
+
+2003-08-11 David N. Welton <da...@dedasys.com>
+
+ * src/make.tcl: Added fileutils Tcl package to buildscripts, in
+ order to utilize the 'install' command.
+
2003-08-05 David N. Welton <da...@dedasys.com>
* contrib/rvt.vim: Added contributed vim mode for editing Rivet
1.4 +2 -2 tcl-rivet/debian/rules
Index: rules
===================================================================
RCS file: /home/cvs/tcl-rivet/debian/rules,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- rules 26 Mar 2003 09:39:42 -0000 1.3
+++ rules 20 Aug 2003 17:20:47 -0000 1.4
@@ -29,7 +29,7 @@
-rm -rf debian/tmp
install -d debian/tmp
cd debian/tmp && install -d `cat ../dirs`
- ( cd src ; ./make.tcl debinstall )
+ ( cd src ; ./make.tcl install PREFIX=$(CURDIR)/debian/tmp/usr/lib LIBEXECDIR=$(CURDIR)/debian/tmp/usr/lib/ )
cp debian/500mod_rivet.info debian/tmp/usr/lib/apache/1.3/
dh_installdocs doc/
dh_installchangelogs
1.8 +1 -1 tcl-rivet/doc/html/index.html.en
Index: index.html.en
===================================================================
RCS file: /home/cvs/tcl-rivet/doc/html/index.html.en,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
1.48 +6 -60 tcl-rivet/src/make.tcl
Index: make.tcl
===================================================================
RCS file: /home/cvs/tcl-rivet/src/make.tcl,v
retrieving revision 1.47
retrieving revision 1.48
diff -u -r1.47 -r1.48
--- make.tcl 11 Aug 2003 21:04:17 -0000 1.47
+++ make.tcl 20 Aug 2003 17:20:48 -0000 1.48
@@ -9,52 +9,15 @@
# Source the other scripts we need.
source [file join [file dirname [info script]] buildscripts buildscripts.tcl]
-# Do we have a threaded Tcl?
-if { [info exists tcl_platform(threaded)] } {
- set TCL_THREADED "-DTCL_THREADED=1"
-} else {
- set TCL_THREADED "-DTCL_THREADED=0"
-}
-
namespace import ::aardvark::*
-## Add variables
-
-##
-## Set this variable to the location of your apxs script if it cannot be
-## found by make.tcl, or use the environmental variable 'APXS_LOCATION'.
-##
-
-set APXS "apxs"
-
-if { [info exists env(APXS_LOCATION)] } {
- set APXS $env(APXS_LOCATION)
-} else {
- ## Try to find the Apache apxs script.
- set APXS [FindAPXS $APXS]
-}
-
-# set APXS "path/to/apxs"
-
-if { ![string length $APXS] } {
- puts stderr "Could not find Apache apxs script."
- append err "You need to edit 'make.tcl' to supply the location of "
- append err "Apache's apxs tool."
- puts stderr $err
- exit 1
-}
-
-set INCLUDEDIR [exec $APXS -q INCLUDEDIR]
-set LIBEXECDIR [exec $APXS -q LIBEXECDIR]
-set PREFIX $TCL_PACKAGE_PATH
-
-set INC "-I$INCLUDEDIR -I$TCL_PREFIX/include"
-
-set COMPILE "$TCL_CC $TCL_CFLAGS_DEBUG $TCL_CFLAGS_OPTIMIZE $TCL_CFLAGS_WARNING $TCL_SHLIB_CFLAGS $INC $TCL_EXTRA_CFLAGS $TCL_THREADED -c"
+# Get the configuration options generated by ./configure.tcl
+getconfigs configs.tcl
+# These are targets
set MOD_STLIB mod_rivet.a
set MOD_SHLIB mod_rivet[info sharedlibextension]
-set MOD_OBJECTS "apache_multipart_buffer.o apache_request.o rivetChannel.o rivetParser.o rivetCore.o mod_rivet.o TclWebapache.o"
+set MOD_OBJECTS {apache_multipart_buffer.o apache_request.o rivetChannel.o rivetParser.o rivetCore.o mod_rivet.o TclWebapache.o}
set RIVETLIB_STLIB librivet.a
set RIVETLIB_SHLIB librivet[info sharedlibextension]
@@ -63,8 +26,6 @@
set PARSER_SHLIB librivetparser[info sharedlibextension]
set PARSER_OBJECTS "rivetParser.o parserPkgInit.o"
-set TCL_LIBS "$TCL_LIBS -lcrypt"
-
set XML_DOCS [glob [file join .. doc packages * *].xml]
set HTML_DOCS [string map {.xml .html} $XML_DOCS]
set HTML "[file join .. doc html]/"
@@ -160,7 +121,7 @@
AddNode $RIVETLIB_SHLIB {
depends $RIVETLIB_OBJECTS
- sh {$TCL_SHLIB_LD -o $RIVETLIB_SHLIB $RIVETLIB_OBJECTS $TCL_LIB_SPEC $TCL_LIBS}
+ sh {$TCL_SHLIB_LD -o $RIVETLIB_SHLIB $RIVETLIB_OBJECTS $TCL_LIB_SPEC $TCL_LIBS $CRYPT_LIB}
}
AddNode $MOD_STLIB {
@@ -226,26 +187,11 @@
AddNode install {
depends $MOD_SHLIB $RIVETLIB_SHLIB $PARSER_SHLIB
- tcl file delete -force [file join $LIBEXECDIR rivet]
tcl file delete -force [file join $PREFIX rivet]
tcl fileutil::install -m o+r $MOD_SHLIB $LIBEXECDIR
tcl fileutil::install -m o+r [file join .. rivet] $PREFIX
tcl fileutil::install -m o+r $RIVETLIB_SHLIB [file join $PREFIX rivet packages rivet]
tcl fileutil::install -m o+r $PARSER_SHLIB [file join $PREFIX rivet packages rivet]
-}
-
-# Install everything when creating a deb. We need to find a better
-# way of doing this. It would involve passing arguments on the
-# command line.
-
-set DEBPREFIX [file join [pwd] .. debian tmp]
-AddNode debinstall {
- depends $MOD_SHLIB $RIVETLIB_SHLIB $PARSER_SHLIB
- tcl {file delete -force [file join $DEBPREFIX/$LIBEXECDIR rivet]}
- tcl {fileutil::install -m o+r $MOD_SHLIB "$DEBPREFIX/$LIBEXECDIR"}
- tcl {fileutil::install -m o+r [file join .. rivet] "$DEBPREFIX/$PREFIX"}
- tcl {fileutil::install -m o+r $RIVETLIB_SHLIB "$DEBPREFIX/[file join $PREFIX rivet packages rivet]"}
- tcl {fileutil::install -m o+r $PARSER_SHLIB "$DEBPREFIX/[file join $PREFIX rivet packages rivet]"}
}
foreach doc $HTML_DOCS {
1.1 tcl-rivet/src/configure.in.tcl
Index: configure.in.tcl
===================================================================
# This file specifies the actual things to test for.
# $Id: configure.in.tcl,v 1.1 2003/08/20 17:20:48 davidw Exp $
# Add some command-line configuration options specific to Rivet.
configure::AddOption -flag with-apxs -var APXS \
-desc "Location of the apxs binary" -arg -default apxs
configure::AddOption -flag with-tcl -var TCL_CONFIG \
-desc "Location of tclConfig.sh" -arg
configure::ProcessOptions
configure::test TCL_CONFIG {
configure::findtclconfig
}
configure::parsetclconfig $::configs::TCL_CONFIG
configure::test APXS {
source [file join [file dirname [info script]] buildscripts findapxs.tcl]
findapxs::FindAPXS [set APXS]
}
configure::test TCL_THREADED {
set tmp "-DTCL_THREADED=[info exists tcl_platform(threaded)]"
}
configure::test INCLUDEDIR {
exec $APXS -q INCLUDEDIR
}
configure::test LIBEXECDIR {
exec $APXS -q LIBEXECDIR
}
configure::test PREFIX {
set TCL_PACKAGE_PATH
}
configure::test INC {
set tmp "-I$INCLUDEDIR -I[file join $TCL_PREFIX include]"
}
configure::test COMPILE {
if { $DEBUGSYMBOLS } {
set tmp "$TCL_CC $TCL_CFLAGS_DEBUG $TCL_CFLAGS_OPTIMIZE $TCL_CFLAGS_WARNING $TCL_SHLIB_CFLAGS $INC $TCL_EXTRA_CFLAGS $TCL_THREADED -c"
} else {
set tmp "$TCL_CC $TCL_CFLAGS_OPTIMIZE $TCL_CFLAGS_WARNING $TCL_SHLIB_CFLAGS $INC $TCL_EXTRA_CFLAGS $TCL_THREADED -c"
}
}
configure::test CRYPT_LIB {
configure::lib_has_function crypt crypt
}
1.1 tcl-rivet/src/configure.tcl
Index: configure.tcl
===================================================================
#!/bin/sh
# the next line restarts using tclsh \
exec tclsh "$0" "$@"
# Tcl configure-like system.
# ./configure.tcl -help for options.
# $Id: configure.tcl,v 1.1 2003/08/20 17:20:48 davidw Exp $
source [file join [file dirname [info script]] buildscripts buildscripts.tcl]
namespace eval configure {
array set errors {}
set useroptions {}
array set optionvars {}
}
namespace eval configs {}
# configure::ProcessOptions --
#
# This is called to process the command line options to configure.
#
# Arguments:
# None.
#
# Side Effects:
# Sets up the 'optionvars' array, which links command line
# options with the variable names they set. Exits on error.
#
# Results:
# None.
proc configure::ProcessOptions {} {
global argv argv0
variable useroptions
variable optionvars
set optionvars(prefix) PREFIX
set optionvars(enable-symbols) DEBUGSYMBOLS
set options {
{prefix.arg "" "prefix - where"}
{enable-symbols "enable debugging symbols"}
}
set options [concat $options $useroptions]
set usage "options:"
if { [ catch {
array set params [::cmdline::getoptions argv $options $usage]
} err] } {
errorexit "$err"
}
# Process each option.
foreach {key val} [array get params] {
if { [info exists optionvars($key)] } {
set ::configs::[set optionvars($key)] $val
}
}
}
# configure::AddOption --
#
# Add an option to the ./configure command line parser.
#
# Arguments:
# -flag flagname
# -var variable name
# -desc description of the option
# -arg Set this flag if the option takes an argument.
# -default Default value for the argument.
#
# Side Effects:
# Set up 'useroptions' to be used in ProcessOptions.
#
# Results:
# None.
proc configure::AddOption {args} {
variable useroptions
variable optionvars
set options {
{flag.arg "" "name of configure flag"}
{var.arg "" "name of variable name to store info in"}
{desc.arg "" "description of option"}
{arg "Use this if the flag takes an argument"}
{default.arg "" "If arg is 1, default argument"}
}
set usage "[info level 0]:"
if { [ catch {
array set params [::cmdline::getoptions args $options $usage]
} err] } {
puts "$err"
exit 1
}
if { $params(flag) == "" } {
puts "-flag option takes an argument"
exit 1
}
if { $params(var) == "" } {
errorexit "-var option takes an argument"
}
if { $params(desc) == "" } {
errorexit "-desc option takes an argument"
}
if { $params(arg) } {
lappend useroptions [list "$params(flag).arg" $params(default)\
$params(desc)]
} else {
if { $params(default) } {
errorexit "-default invalid without -arg option"
}
lappend useroptions [list "$params(flag)" $params(desc)]
}
set optionvars($params(flag)) $params(var)
}
# configure::test --
#
# Test something in the environment, and set a variable
# accordingly. Note that the 'body' code is run
#
# Arguments:
# varname - name of the variable to set.
# body - code to execute. The return value of the last command
# is the value for the variable
#
# Side Effects:
# Creates variables in the ::configs:: namespace. Populates the
# 'errors' array with failed configuration tests.
#
# Results:
# None.
proc configure::test {varname body} {
variable errors
puts -nonewline "."
flush stdout
if { [info exists ::configs::${varname}] && [set ::configs::[set varname]] != "" } {
# It already exists - it was probably passed on the command
# line.
return
}
set val ""
set oldvars [lsort [info vars ::configs::*]]
if { [catch {set val [namespace eval ::configs $body]} err] } {
set errors($varname) $err
} else {
set ::configs::${varname} $val
}
set newvars [lsort [info vars ::configs::*]]
# Clean up temporary variables.
foreach var $newvars {
if { [lsearch $oldvars $var] < 0 } {
if { $var != "::configs::$varname" } {
unset $var
}
}
}
}
# Helper procedures for findtclconfig
proc configure::RelToExec {exe cf} {
return [file join [file dirname [file dirname $exe]] lib $cf]
}
proc configure::RelToExec2 {cf} {
return [file join [info library] $cf]
}
# configure::findtclconfig --
#
# Finds the tclConfig.sh of the tclsh running. This is included
# here, because we can use that file to find out just how Tcl
# itself was compiled that gives us most of the information we
# need about compiling extensions.
#
# Arguments:
# None.
#
# Side Effects:
# None.
#
# Results:
# Returns the location of the tclConfig.sh file.
proc configure::findtclconfig {} {
set exec [file tail [info nameofexecutable]]
# If we're running tclsh...
if {[string match -nocase "*tclsh*" $exec]} {
set cf [RelToExec [info nameofexecutable] tclConfig.sh]
if {[file readable $cf]} {
return $cf
} else {
set cf [RelToExec2 tclConfig.sh]
if {[file readable $cf]} {
return $cf
}
}
}
# If tcl_pkgPath is available, look there...
global tcl_pkgPath
if {[info exists tcl_pkgPath]} {
foreach libdir $tcl_pkgPath {
if {[file readable [file join $libdir tclConfig.sh]]} {
return [file join $libdir tclConfig.sh]
}
}
}
# Not in usual places, go searching for tclsh...
set candshells [list]
if {[regsub -nocase wish $exec tclsh shell]} {
lappend candshells $shell
}
lappend candshells tclsh[package provide Tcl]
lappend candshells tclsh[join [split [package provide Tcl] .] ""] foreach shell $candshells {
set shell [auto_execok $shell]
if {[string length $shell]} {
set cf [RelToExec $shell tclConfig.sh]
if {[file readable $cf]} {
return $cf
}
}
}
error "tclConfig.sh not found"
}
# configure::parsetclconfig --
#
# Parses the tclConfig.sh to extract the values contained
# therein.
#
# Arguments:
# config - tclConfig.sh file.
#
# Side Effects:
# Uses the names of the variables in tclConfig.sh to create
# variables with the same names in the configs namespace.
#
# Results:
# None.
proc configure::parsetclconfig { config } {
set fl [open $config r]
while { ! [eof $fl] } {
gets $fl line
if { [string index $line 0] != "#" } {
set line [ split $line = ]
if { [llength $line] == 2 } {
set val ""
set var [lindex $line 0]
catch {
set val [subst [string trim [lindex $line 1] ']]
}
set ::configs::[set var] $val
}
}
}
}
# configure::lib_has_function --
#
# Attempts to determine if a C library provides a function. Idea
# copied from autoconf. Maybe there is a better way to do
# it?
#
# Arguments:
# library - library name (without leading -l).
# function - C function name.
#
# Side Effects:
# None.
#
# Results:
# Returns -l$library on success, empty string on failure.
proc configure::lib_has_function { library function } {
set retval ""
set program {
int main() {
%s();
return 0;
}
}
set program [format $program $function]
set fl [open testconfig.c w]
puts $fl $program
close $fl
if { ! [catch {
exec cc -o testconfig testconfig.c -l$library
} err] } {
set retval "-l$library"
}
eval file delete [glob testconfig*]
return $retval
}
# configure::writeconfigs --
#
# Write variables from ::configs:: namespace to a file,
# defaulting to configs.tcl.
#
# Arguments:
# filename - where to write the variables.
#
# Side Effects:
# None.
#
# Results:
# None.
proc configure::writeconfigs { {filename configs.tcl} } {
set fl [open $filename w]
puts $fl "namespace eval ::configs {}"
foreach var [lsort [info vars ::configs::*]] {
puts $fl "set $var {[set $var]}"
}
close $fl
}
# Prints an error messages and exits.
proc configure::errorexit { msg } {
puts stderr $msg
exit 1
}
puts -nonewline "Configuring "
# Here is where we actually read in the user's tests.
source [file join [file dirname [info script]] configure.in.tcl]
puts "done."
# If there were errors, report them.
set errlist [array get ::configure::errors]
if { [llength $errlist] > 0 } {
puts "Errors:"
foreach {var val} [lsort [array get ::configure::errors]] {
puts "$var = $val"
}
}
# Everything ok. Write the config file.
configure::writeconfigs configs.tcl
1.3 +1 -1 tcl-rivet/src/buildscripts/LICENSE
Index: LICENSE
===================================================================
RCS file: /home/cvs/tcl-rivet/src/buildscripts/LICENSE,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- LICENSE 23 Feb 2002 10:55:56 -0000 1.2
+++ LICENSE 20 Aug 2003 17:20:48 -0000 1.3
@@ -1,7 +1,7 @@
/* ====================================================================
* The Apache Software License, Version 1.1
*
- * Copyright (c) 2000, 2001 The Apache Software Foundation. All rights
+ * Copyright (c) 2000-2003 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
1.15 +59 -5 tcl-rivet/src/buildscripts/aardvark.tcl
Index: aardvark.tcl
===================================================================
RCS file: /home/cvs/tcl-rivet/src/buildscripts/aardvark.tcl,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- aardvark.tcl 23 May 2003 16:41:43 -0000 1.14
+++ aardvark.tcl 20 Aug 2003 17:20:48 -0000 1.15
@@ -45,7 +45,7 @@
puts "Output: $txt"
}
node {
- puts -nonewline "$txt -> "
+ puts -nonewline "$txt -> "
}
result {
puts "Result: $txt"
@@ -192,7 +192,7 @@
if { ! [info exists grph] } {
# Lazy graph creation.
- set grph [ ::struct::graph::graph ]
+ set grph [::struct::graph::graph]
}
set dependencies {}
@@ -205,7 +205,7 @@
puts "Error: $err"
}
createnode $name
- $grph node set $name -key buildinfo [ array get buildinfo ]
+ $grph node set $name -key buildinfo [array get buildinfo]
foreach dep $dependencies {
# puts -nonewline "$dep/"
createnode $dep
@@ -229,6 +229,21 @@
return [$grph nodes]
}
+
+# aardvark::Run --
+#
+# Run the build process.
+#
+# Arguments:
+# None.
+#
+# Side Effects:
+# Process the list of nodes, running the build commands
+# associated with each one.
+#
+# Results:
+# None.
+
proc aardvark::Run { } {
variable grph
set start [lindex $::argv 0]
@@ -245,6 +260,45 @@
unset grph
}
+# aardvark::getconfigs --
+#
+# Fetch configuration settings from a file, defaulting to
+# configs.tcl. These are generated by the configure.tcl and
+# configure.in.tcl scripts.
+#
+# Arguments:
+# None.
+#
+# Side Effects:
+# Creates variables in the current namespace from variables in
+# the configs.tcl file.
+#
+# Results:
+# None.
+
+proc aardvark::getconfigs { {filename configs.tcl} } {
+ catch {namespace delete ::configs}
+ if { [catch {source $filename}] } {
+ puts stderr "You must run ./configure.tcl before running ./make.tcl"
+ exit 1
+ }
+
+ # Take any options that are passed to us on the command line, in
+ # order to be able to override ./configure options.
+ foreach arg [lrange $::argv 1 end] {
+ # set var and val
+ foreach {var val} [split $arg =] {}
+ set ::configs::$var $val
+ }
+
+ foreach var [info vars ::configs::*] {
+ set var [namespace tail $var]
+ uplevel [list set $var [set ::configs::$var]]
+ }
+
+
+}
+
namespace eval aardvark {
- namespace export AddNode Run Verbose sh tcl depends Nodes
+ namespace export AddNode Run Verbose sh tcl depends Nodes getconfigs
}
1.3 +0 -2 tcl-rivet/src/buildscripts/buildscripts.tcl
Index: buildscripts.tcl
===================================================================
RCS file: /home/cvs/tcl-rivet/src/buildscripts/buildscripts.tcl,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- buildscripts.tcl 11 Aug 2003 21:01:27 -0000 1.2
+++ buildscripts.tcl 20 Aug 2003 17:20:48 -0000 1.3
@@ -7,8 +7,6 @@
cmdline.tcl
fileutil.tcl
helpers.tcl
- parsetclConfig.tcl
- findapxs.tcl
} {
source [file join [file dirname [info script]] $script]
}
---------------------------------------------------------------------
To unsubscribe, e-mail: rivet-cvs-unsubscribe@tcl.apache.org
For additional commands, e-mail: rivet-cvs-help@tcl.apache.org