-README.autosetup created by autosetup v0.6.7
+README.autosetup created by autosetup v0.6.8
This is the autosetup directory for a local install of autosetup.
It contains autosetup, support files and loadable modules.
# \
dir=`dirname "$0"`; exec "`$dir/autosetup-find-tclsh`" "$0" "$@"
-set autosetup(version) 0.6.7
+set autosetup(version) 0.6.8
# Can be set to 1 to debug early-init problems
set autosetup(debug) [expr {"--debug" in $argv}]
ref:=text manual:=text
reference:=text => "display the autosetup command reference. 'text', 'wiki', 'asciidoc' or 'markdown'"
debug => "display debugging output as autosetup runs"
- sysinstall:path => "install standalone autosetup to the given directory (e.g.: /usr/local)"
install:=. => "install autosetup to the current or given directory"
+ }
+ if {$autosetup(installed)} {
+ # hidden options so we can produce a nice error
+ options-add {
+ sysinstall:path
+ }
+ } else {
+ options-add {
+ sysinstall:path => "install standalone autosetup to the given directory (e.g.: /usr/local)"
+ }
+ }
+ options-add {
force init:=help => "create initial auto.def, etc. Use --init=help for known types"
# Undocumented options
option-checking=1
#
proc define-append {name args} {
if {[get-define $name ""] ne ""} {
- # Make a token attempt to avoid duplicates
+ # Avoid duplicates
foreach arg $args {
- if {[string first $arg $::define($name)] == -1} {
+ set found 0
+ foreach str [split $::define($name) " "] {
+ if {$str eq $arg} {
+ incr found
+ }
+ }
+ if {!$found} {
append ::define($name) " " $arg
}
}
# shared=1 means that we are trying to do a sysinstall. This is only possible from the development source.
proc autosetup_install {dir {shared 0}} {
- if {$shared && $::autosetup(installed)} {
- user-error "Can only --sysinstall from development sources"
+ global autosetup
+ if {$shared} {
+ if {$autosetup(installed) || $autosetup(sysinstall)} {
+ user-error "Can only --sysinstall from development sources"
+ }
+ } elseif {$autosetup(installed)} {
+ user-error "Can't --install from project install"
}
- if {$::autosetup(sysinstall)} {
+ if {$autosetup(sysinstall)} {
# This is the sysinstall version, so install just uses references
cd $dir
set publicmodules {}
# First the main script, but only up until "CUT HERE"
- set in [open $::autosetup(dir)/autosetup]
+ set in [open $autosetup(dir)/autosetup]
while {[gets $in buf] >= 0} {
if {$buf ne "##-- CUT HERE --##"} {
puts $f $buf
# All modules are inserted if $shared is set
puts $f "set autosetup(installed) 1"
puts $f "set autosetup(sysinstall) $shared"
- foreach file [lsort [glob $::autosetup(libdir)/*.{tcl,auto}]] {
+ foreach file [lsort [glob $autosetup(libdir)/*.{tcl,auto}]] {
set modname [file tail $file]
set ext [file ext $modname]
set buf [readfile $file]
puts $f "\}\n"
}
if {$shared} {
- foreach {srcname destname} [list $::autosetup(libdir)/README.autosetup-lib README.autosetup \
- $::autosetup(srcdir)/LICENSE LICENSE] {
+ foreach {srcname destname} [list $autosetup(libdir)/README.autosetup-lib README.autosetup \
+ $autosetup(srcdir)/LICENSE LICENSE] {
dputs "install: importing $srcname as $destname"
puts $f "\nset modsource($destname) \\\n[list [readfile $srcname]\n]\n"
}
}
close $in
close $f
- exec chmod 755 $target
+ catch {exec chmod 755 $target}
set installfiles {autosetup-config.guess autosetup-config.sub autosetup-test-tclsh}
set removefiles {}
lassign $fileinfo source
set dest $source
}
- autosetup_install_file $::autosetup(dir)/$source $targetdir/$dest
- exec chmod 755 $targetdir/$dest
+ autosetup_install_file $autosetup(dir)/$source $targetdir/$dest
}
# Remove obsolete files
error "Missing installation file '$source'"
}
writefile $target [readfile $source]\n
+ # If possible, copy the file mode
+ file stat $source stat
+ set mode [format %o [expr {$stat(mode) & 0x1ff}]]
+ catch {exec chmod $mode $target}
}
proc autosetup_install_readme {target sysinstall} {
#!/bin/sh
# Looks for a suitable tclsh or jimsh in the PATH
# If not found, builds a bootstrap jimsh from source
+# Prefer $autosetup_tclsh if is set in the environment
d=`dirname "$0"`
{ "$d/jimsh0" "$d/autosetup-test-tclsh"; } 2>/dev/null && exit 0
PATH="$PATH:$d"; export PATH
-for tclsh in jimsh tclsh tclsh8.5 tclsh8.6; do
+for tclsh in $autosetup_tclsh jimsh tclsh tclsh8.5 tclsh8.6; do
{ $tclsh "$d/autosetup-test-tclsh"; } 2>/dev/null && exit 0
done
echo 1>&2 "No installed jimsh or tclsh, building local bootstrap jimsh0"
module-options {}
-# Note that the return code is not meaningful
-proc cc-check-something {name code} {
- uplevel 1 $code
-}
-
# Checks for the existence of the given function by linking
#
proc cctest_function {function} {
# @cc-check-defines define ...
#
-# Checks that the given preprocessor symbol is defined.
+# Checks that the given preprocessor symbols are defined.
proc cc-check-defines {args} {
cc-check-some-feature $args {
cctest_define $each
}
}
}
- if {$found} {
- define [feature-define-name $function]
- } else {
+ define-feature $function $found
+ if {!$found} {
msg-result "no"
}
return $found
# @make-template template ?outfile?
#
-# Reads the input file '<srcdir>/$template' and writes the output file '$outfile'.
+# Reads the input file '<srcdir>/$template' and writes the output file '$outfile'
+# (unless unchanged).
# If '$outfile' is blank/omitted, '$template' should end with '.in' which
# is removed to create the output file name.
#
}
lappend result $line
}
- writefile $out [string map $mapping [join $result \n]]\n
-
- msg-result "Created [relative-path $out] from [relative-path $template]"
+ write-if-changed $out [string map $mapping [join $result \n]]\n {
+ msg-result "Created [relative-path $out] from [relative-path $template]"
+ }
}
# build/host tuples and cross-compilation prefix
define prefix $prefix
define builddir $autosetup(builddir)
define srcdir $autosetup(srcdir)
-# Allow this to come from the environment
-define top_srcdir [get-env top_srcdir [get-define srcdir]]
+define top_srcdir $autosetup(srcdir)
+define abs_top_srcdir [file-normalize $autosetup(srcdir)]
+define abs_top_builddir [file-normalize $autosetup(builddir)]
# autoconf supports all of these
set exec_prefix [lindex [opt-val exec-prefix $prefix] end]
set objdir [get-env BUILDDIR objdir]
make-config-header $objdir/include/autoconf.h
-make-tmake-settings $objdir/settings.conf {[A-Z]*}
+make-tmake-settings $objdir/settings.conf {[A-Z]*} *dir lib_*
}
autosetup_check_create project.spec \
{# Initial project.spec created by 'autosetup --init=tmake'
+tmake-require-version 0.7.3
+
# vim:set syntax=tcl:
define? DESTDIR _install
# XXX If configure creates additional/different files than include/autoconf.h
# that should be reflected here
+Autosetup include/autoconf.h
-# We use [set AUTOREMAKE] here to avoid rebuilding settings.conf
-# if the AUTOREMAKE command changes
-Depends {settings.conf include/autoconf.h} auto.def -msg {note Configuring...} -do {
- run [set AUTOREMAKE] >$build/config.out
-} -onerror {puts [readfile $build/config.out]} -fatal
-Clean config.out
-DistClean --source config.log
-DistClean settings.conf include/autoconf.h
-
-# If not configured, configure with default options
-# Note that it is expected that configure will normally be run
-# separately. This is just a convenience for a host build
-define? AUTOREMAKE configure TOPBUILDDIR=$TOPBUILDDIR --conf=auto.def
-
-Load settings.conf
-
-# e.g. for up autoconf.h
+# e.g. for autoconf.h
IncludePaths include
-ifconfig CONFIGURED
-
-# Hmmm, but should we turn off AutoSubDirs?
-#AutoSubDirs off
+ifconfig !CONFIGURED {
+ # Not configured, so don't process subdirs
+ AutoSubDirs off
+ # And don't process this file any further
+ ifconfig false
+}
}
if {![file exists build.spec]} {