Index: Makefile.in =================================================================== diff -u -r8eebb7d3d20fbdc1566b4c1729d63a90e5d67882 -r57d74ca7442169f0317dbbbbac1b479aee30ec21 --- Makefile.in (.../Makefile.in) (revision 8eebb7d3d20fbdc1566b4c1729d63a90e5d67882) +++ Makefile.in (.../Makefile.in) (revision 57d74ca7442169f0317dbbbbac1b479aee30ec21) @@ -209,8 +209,6 @@ xotcl_pkglibdir = $(pkglibdir)/xotcl -installed_shells = $(DESTDIR)$(bindir)/nxsh $(DESTDIR)$(bindir)/nxwish $(DESTDIR)$(bindir)/xotclsh $(DESTDIR)$(bindir)/xowish - #======================================================================== # TCLLIBPATH seeds the auto_path in Tcl's init.tcl so we can test our # package without installing. The other environment variables allow us @@ -481,13 +479,9 @@ $(INSTALL_DATA) $(xotcl_src_lib_dir)/$$i $(DESTDIR)$(xotcl_pkglibdir)/$$i ; \ done; -install-xotcl-shells: - @if test -f $(xotcl_srcdir)/xotclsh; then \ - $(INSTALL_PROGRAM) $(xotcl_srcdir)/xotclsh $(DESTDIR)$(bindir); \ - fi - @if test -f $(xotcl_srcdir)/xowish; then \ - $(INSTALL_PROGRAM) $(xotcl_srcdir)/xowish $(DESTDIR)$(bindir); \ - fi +install-xotcl-shells: xotclsh xowish + $(INSTALL_PROGRAM) xotclsh $(DESTDIR)$(bindir) + $(INSTALL_PROGRAM) xowish $(DESTDIR)$(bindir) install-xotcl-apps: install-xotcl-libraries @echo "Installing Applications to $(DESTDIR)$(xotcl_pkglibdir)/apps/" @@ -696,6 +690,11 @@ install-pkgIndex: # @echo package ifneeded nsf $(PACKAGE_VERSION) [list load [file join \$$dir .. "$(PKG_LIB_FILE)"] nsf] > "$(pkglibdir)/pkgIndex.tcl" +nxsh nxwish xotclsh xowish: + $(TCLSH_PROG) $(top_builddir)/build.tcl $@ $@ + chmod +x $@ + + #nxsh: tclAppInit.o $(PKG_OBJECTS) $(CONDITIONAL_STUB_OBJECTS) # $(CC) -rdynamic -o $@ tclAppInit.o \ # $(CFLAGS) $(TCL_LIB_SPEC) \ @@ -707,13 +706,9 @@ # $(CFLAGS) $(TCL_LIB_SPEC) $(TK_LIB_SPEC) \ # $(DMALLOC_LIB) $(CONDITIONAL_STUB_OBJECTS) -install-shells: - @if test -f nxsh; then \ - $(INSTALL_PROGRAM) nxsh $(DESTDIR)$(bindir); \ - fi - @if test -f nxwish; then \ - $(INSTALL_PROGRAM) nxwish $(DESTDIR)$(bindir); \ - fi +install-shells: nxsh nxwish + $(INSTALL_PROGRAM) nxsh $(DESTDIR)$(bindir) + $(INSTALL_PROGRAM) nxwish $(DESTDIR)$(bindir) #======================================================================== # We need to enumerate the list of .c to .o lines here. Index: build.tcl.in =================================================================== diff -u --- build.tcl.in (revision 0) +++ build.tcl.in (revision 57d74ca7442169f0317dbbbbac1b479aee30ec21) @@ -0,0 +1,181 @@ +#! /usr/bin/env tclsh + + +proc fputs {filename content} { + set chan [open $filename w] + try { + puts $chan $content + } finally { + close $chan + } +} + + +proc heredoc doc { + if {![regexp {^(?:\s*?\n)(.*?)\n(?:\s(?!\n))*$} $doc[ + set doc {}] -> doc]} { + + error [list {bad heredoc format (missing final newline)}] + } + regsub -all {\\\\\n} [string trim $doc[set doc {}]] "\\\n" doc + regsub -lineanchor -all {^\t} $doc[set doc {}] {} doc + return $doc +} + + +proc innerscript namevar { + upvar script script + namespace upvar [namespace current] $namevar innerscript + append script \n$innerscript +} + + +proc requirescript name { + variable autopath + upvar script script + namespace upvar [namespace current] \ + ${name}_requirescript requirescript + append script \n[string map [list @requirescript@ [ + list $requirescript] @requirescript2@ $requirescript] $autopath] +} + + +proc runshell {} { + upvar script script + append script \n [heredoc { + set exitCode [nx::shell run $argc $argv] + exit $exitCode + }] +} + + +proc shellscript {name filename} { + shelltotclsh $name + requirescript $name + innerscript $name + runshell + fputs $filename $script +} + + +proc shelltotclsh name { + variable shelltotclsh + upvar script script + set script [string map {@name@ $name} $shelltotclsh] +} + + +variable autopath [heredoc { + apply {{} { + if {[catch @requirescript@ cres copts]} { + set pkgdir @PACKAGE_NAME@@PACKAGE_VERSION@ + + set autopath [list ::apply {{dir pkgdir} { + global auto_path + set candidate $dir/$pkgdir + if {[file exists $candidate]} { + foreach tcldir [glob -directory $dir tcl*] { + set candidate1 $tcldir/site-tcl + if {[file exists $candidate1]} { + set auto_path [linsert $auto_path[ + set auto_path {}] 0 $candidate1] + } + } + + set auto_path [linsert $auto_path[ + set auto_path {}] 0 $candidate] + } + }}] + + set findpkgindex [list ::apply {{top pkgdir} { + upvar 1 autopath autopath + foreach dir {lib lib64} { + {*}$autopath $top/$dir $pkgdir + } + set dirs [glob -nocomplain -directory $top -type d *] + foreach dir $dirs { + {*}$autopath $dir $pkgdir + } + foreach dir $dirs { + foreach dir [glob -nocomplain -directory \ + $top/$dir -type d *] { + {*}$autopath $dir $pkgdir + } + } + }}] + + + set top [file dirname [file dirname [file dirname [ + file normalize [info script]/...]]]] + {*}$findpkgindex $top $pkgdir + + @requirescript2@ + } + }} +}] + +variable shelltotclsh [heredoc { + #! /bin/sh + # Lookup a Tcl interpreter \\ + INTERP="tclsh@TCL_VERSION@"; \\ + INTERPS="@NSF_COMPATIBLE_TCLSH@ @TCL_EXEC_PREFIX@/bin/$INTERP"; \\ + for interp in $INTERPS; \\ + do if [ -x $interp ]; then INTERP=$interp; break; \\ + fi; done; \\ + exec $INTERP "$0" ${1+"$@"} + + # -*- tcl -*- + # + # Tiny scripted replacement of a binary @name@. This script can be used + # as interactive shell for testing or like a regular shell with the #! + # markup in the first line of a script. It is designed to work with + # multiple installed Tcl shells during development. + # +}] + + +variable nxsh { + namespace import -force ::nx::* +} + +variable nxsh_requirescript { + package require nx::shell 1.1 +} + + +variable nxwish $nxsh + +variable nxwish_requirescript { + package require Tk + package require nx::shell 1.1 +} + + +variable xotclsh { + namespace import -force ::xotcl::* +} + +variable xotclsh_requirescript { + package require XOTcl 2 + package require nx::shell 1.1 +} + + +variable xowish $xotclsh + +variable xowish_requirescript { + package require Tk + package require XOTcl 2 + package require nx::shell 1.1 +} + + +namespace ensemble create -map { + nxsh {shellscript nxsh} + nxwish {shellscript nxwish} + xotclsh {shellscript xotclsh} + xowish {shellscript xowish} +} + + +[namespace current] {*}$argv Index: configure.ac =================================================================== diff -u -rc80b57b9fbb2735d12418c3f634390141b50a94b -r57d74ca7442169f0317dbbbbac1b479aee30ec21 --- configure.ac (.../configure.ac) (revision c80b57b9fbb2735d12418c3f634390141b50a94b) +++ configure.ac (.../configure.ac) (revision 57d74ca7442169f0317dbbbbac1b479aee30ec21) @@ -394,7 +394,6 @@ AC_SUBST([NSF_SRC_DIR]) eval "NSF_PKG_LIBDIR=\"${libdir}/${PACKAGE_NAME}${PACKAGE_VERSION}\"" -AC_SUBST([NSF_PKG_LIBDIR]) if test "${TEA_PLATFORM}" != "windows" ; then @@ -461,7 +460,7 @@ dnl Change the value of -this- macro if you want to add or remove dnl such files. -AC_DEFUN([CONFIG_OUTPUT_FILES], [[Makefile ${srcdir}/nsfConfig.sh ${srcdir}/library/xotcl/xotclsh ${srcdir}/library/xotcl/xowish ${srcdir}/unix/pkgIndex.unix nxsh nxwish ${srcdir}/doc/version.inc]]) +AC_DEFUN([CONFIG_OUTPUT_FILES], [[Makefile ${srcdir}/nsfConfig.sh ${srcdir}/unix/pkgIndex.unix build.tcl ${srcdir}/doc/version.inc]]) #-------------------------------------------------------------------- # the value of this variable is set to the files which are to be @@ -486,8 +485,6 @@ AC_OUTPUT -chmod +x nxsh nxwish ${srcdir}/library/xotcl/xotclsh ${srcdir}/library/xotcl/xowish - for subdir in ${subdirs} do echo "==================== configure $subdir" Fisheye: Tag 57d74ca7442169f0317dbbbbac1b479aee30ec21 refers to a dead (removed) revision in file `library/xotcl/xotclsh.in'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 57d74ca7442169f0317dbbbbac1b479aee30ec21 refers to a dead (removed) revision in file `library/xotcl/xowish.in'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 57d74ca7442169f0317dbbbbac1b479aee30ec21 refers to a dead (removed) revision in file `nxsh.in'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 57d74ca7442169f0317dbbbbac1b479aee30ec21 refers to a dead (removed) revision in file `nxwish.in'. Fisheye: No comparison available. Pass `N' to diff?