\documentclass[]{article}
\usepackage{amsmath,graphicx,supertabular,hyperref,tabularx,ifthen}
\title{TIP \#12: The "Batteries Included" Distribution}
\date{September 15, 2000}
\author{George A. Howlett, Larry W. Virden}
\urlstyle{sf}
\setlength{\parskip}{1ex}
\setlength{\parindent}{0pt}
\def\tipversion$#1${\texttt{\$#1\$}}
\def\tiplangle#1{\ensuremath{<}}
\def\tiprangle#1{\ensuremath{>}}
\def\tipbar#1{\ensuremath{|}}
\def\tipmail#1#2{\(\langle\){\small\expandafter\url{#1@#2}}\(\rangle\)}
\ifx\pdfoutput\undefined
\newcommand{\tipimage}[2]{\typeout{Make sure you download #1.eps}\ifthenelse{\lengthtest{0.8\textwidth>#2}\and\lengthtest{0pt<#2}}{\includegraphics{#1.eps}}{\includegraphics[width=0.8\textwidth]{#1.eps}}}
\newcommand{\tipxref}[1]{}
\newcommand{\tipxrefend}{}
\else
\newcommand{\tipimage}[2]{\typeout{Make sure you create #1.pdf}\ifthenelse{\lengthtest{0.8\textwidth>#2}\and\lengthtest{0pt<#2}}{\includegraphics{#1.pdf}}{\includegraphics[width=0.8\textwidth]{#1.pdf}}}
\pdfcatalog{/PageMode /UseOutlines}
\newcommand{\tipxref}[1]{\pdfannotlink attr {/C [0.5 0.5 1.0] /Border [0 0 1]} goto name {#1}}
\newcommand{\tipxrefend}{\pdfendlink}
\fi
\newenvironment{tipabstract}{\begin{abstract}}{\end{abstract}}
\begin{document}\maketitle
\begin{center}\begin{tabularx}{\linewidth}{|r@{: }X|}\hline
\textbf{TIP \#12}&\textbf{The "Batteries Included" Distribution}\\\hline
Author&

George A. Howlett \tipmail{gah}{siliconmetrics.com}
\par
Larry W. Virden \tipmail{lvirden}{yahoo.com}
\\
Created&Friday, \(\text{15}^{\text{th}}\) September 2000\\
Type&Informative\\
State&Draft\\
Vote&Pending\\
Version&\tipversion$Revision: 1.3 $\\
Post History&\\
Discussions To&news:comp.lang.tcl\\
\hline\end{tabularx}\end{center}
\thispagestyle{empty}\pagestyle{empty}
\begin{tipabstract}

This document describes a comprehensive Tcl/Tk distribution. Its primary purpose is to create a standard source tree that includes Tcl, Tk, and extensions so that they can be built and installed in an simple and easy manner.
\end{tipabstract}
\tableofcontents\setcounter{page}{0}\clearpage\pagestyle{plain}

\section{Introduction}

One of the most enduring complaints about Tcl/Tk is that it lacks features, especially when compared to Perl, Python, or Java. We patiently explain that some particular feature is available in extension ``XYZ'' only to hear how hard it is to build and install extensions.

Frank Stajano (``The SMS server, or why I switched from Tcl to Python'') describes the problem succinctly.

\begin{quote}
``But if I had to put the finger on the single most important reason that has me now working in Python rather than in Tcl/[incr Tcl] it would not be a language issue but a library issue. I prefer Python because its standard library is a gold mine. Sure, for anything I want to do there's bound to be an extension available in the Tcl code repository on the FTP site. Now I just have to find it, fetch it, recompile the interpreter with it (Oh wait --- this may mean getting and installing a C compiler for this system. Will the GNU one compile the windowing stuff properly or do I need to get VC++, or Borland? Who wants to have some fun discovering where another IDE has hidden the useful compiler flags this week?), hope that it won't clash with other extensions I've had to install, hope that it will not require a different version of the interpreter from the one I am running, and so on. Python supports the same C extension mechanism as Tcl --- but the practical difference is that the stuff I want is, most of the time, already included and shipped in the standard distribution of the language!''
\end{quote}

\begin{quote}
``But, as a general-purpose tool, Python's single most important selling point is the richness of its standard library --- an idea that Tcl is only now starting to internalise. It's all in the distribution. You can attack your practical problem using the stuff that's already installed on your system, and documented in the library manual you already printed. Python is great because it comes with batteries included.''
\end{quote}

It's true. There are too many things to know to maintain even a moderate set of extensions. There are too many different places to download extensions, too many extension-specific configuration options, etc.

My hope is that this proposal will mark the beginning of the end of the ``Batteries Included'' problem. One evidence of success will be that words ``core'' and ``extension'' disappear from our Tcl vocabularies. We've lived their artifical distinctions that are useful only to core developers and extension writers. It's skewed our thinking about relationship between Tcl and its parts. After all, application writers first care about whether a feature or capability is available, not how it's structured under the hood.

\section{The "Batteries Included" Distribution.}

Let's start with a very modest example. Let's imagine that the ``Batteries Included'' distribution is nothing more than an archive file of the source code for Tcl/Tk and several extensions.
\begingroup\small\begin{verbatim}
            Unix    Windows  Mac
             ----    -------  ---
  Tcl 8.3       x       x      x
  Tk 8.3        x       x      x
  [incr Tcl]    x       x      x
  expect        x       ?
  TclX          x
  BLT           x       x
  Trf           
  Html widget
  XML
  ...lots more...
\end{verbatim}
\endgroup

Tcl, Tk, and the packages are configured such that they can be built and installed just from a top level directory (not individually). Someone can download and try out all sorts of new features without repeating the same ``configure'', ``make'', ``make install'' sequences.

With this simple tar file, the following benefits are automatically generated:
\begin{itemize}
\item{}
It provides a simple way for users to try out extensions. Users only have to run download, configure, compile and install, at most, once.
\item{}
It describes a clear framework for extensions. We will have established a directory structure for both source code and installed binaries. It will be much more clear how to inter-operate. This is TEA in action.
\item{}
It's better for Tcl/Tk application writers. You can count on features being universally available. Your program can again be just a Tcl script, not an array of packages that everyone needs to download and install.
\item{}
It's better for extension writers. Configuration is simpler, since you know where all the sources and the compiler-specific information will reside. You don't need to search for \textit{tclConfig.sh} or \textit{tkConfig.sh} files.
\item{}
It's better for Tcl/Tk distribution builders. This includes both the Linux distributors and company sysadmins that build Tcl/Tk. They don't have to fear installing extensions because of version dependencies.

Let's give Redhat and SuSE a good reason to move off of version 8.0. One the big advantages of Linux over (let's say) Solaris is that each new Redhat or SuSE distribution comes with updated versions of utilities already built.
\item{}
It's better for the core developers. Extension writers will willing the adopt changes in exchange for the wider distribution. The core team will in turn gain better understanding of the burdens of extension writers.
\item{}
It's better for Tcl library writers. With [incr Tcl], we now have a basis for a real, extensible Tcl-code library. Library code rely on a full set of extensions being available.
\end{itemize}

\section{Rationale}

We want to create an open door procedure that makes it easy for contributors to add new features and commands to Tcl and Tk. By creating a framework for extensions to be built and distributed, the ``Batteries Included'' distribution will provide a path for great new features to quickly become available to the Tcl community.

The ``Batteries Included'' distributed is not designed to be one size that fits all. I assume there will be many distributions to suit many needs. There may be one for Tcl web servers and another for embedded systems. The goal is that the ``Batteries Included'' distribution will become a prototype for other distributions. Distribution creators will be able to pull code from the same CVS source tree.

What will distinguish the ``Batteries Included'' distribution is that it will be the most comprehensive and most up-to-date distribution. We will explicitly not choose one package or extension over another. That decision should remain with the Tcl user community. The only requirement is that the extensions are robust and/or actively maintained.

If the ``Batteries Included'' distribution is to become successful, it must be a cooperative effort between Tcl core developers, extension writers, and the Tcl user community. For example, we need the help of extension writers to adopt the new configuration scheme and directory structure.

\section{Particulars}

We can stage the project with small milestones while still focusing on longer range goals. For example, the first phase can be as simple as creating a tar file. It will start to address questions that were raised by TEA. For example, how do we manage documentation?

The biggest reason why this proposal will succeed is the incredible talent in the Tcl community. We can leverage the skills and experiences of the foremost experts on the core, extensions, and applications.

\section{Tcl/Tk Version.}

The distribution will be based on 8.3.2 (or 8.3.3 when it is released). While there's no assurance when 8.4 will be released and in what state, we also want to place a premium on stable, robust extensions, that have been thoroughly tested. Most extensions will be unlikely to have been tested against the 8.4 alphas.

\section{Phase 1.}
\begin{itemize}
\item{}
Identify extensions. 

What extensions should be included in the near term? We need extension authors that are willing to work with us to build a directory framework, change configuration files, etc. Extensions do not need to work on all platforms. For example, there is a wealth of Windows-based extensions that should be included in a Windows specific build.

What are the minimum requirements for extensions in the short term? Manual pages, html, tests, demos all would be nice. We need to temper this with what's practical. This is a learning process. We can adjust requirements in future phases.
\item{}
Determine build and install directory structures. 

We need to make this work with more that one release installed. Don't suppose that there only one version will ever be used.
\item{}
Setup CVS archives.
\item{}
Create configuration files. 

This will require negotiation with extension writers. We want their buy-in so they will maintain the changes.

There may be more than one form of configuration required. One subtle but important issue is that extensions must be able to be configured without Tcl or Tk libraries already existing. This is a ``trusted'' configure. The extension must trust that the library will exist. Right now, most extensions work from ``untrusted'' configurations.
\item{}
Test builds on multiple platforms. 

For now, the Windows and Mac build files can be hand-generated. It may be too hard to create a seamless build environment. We're not trying to satisfy every Windows/Mac developer here. We can focus on creating pre-built binary distributions for these platforms.
\item{}
Create self-installing executables for Windows and the Mac. 

If we want, we can provide Linux, Solaris, etc. binaries by reviving Michael McLennan's Tclish installer.
\end{itemize}

\section{Phase 2.}
\begin{itemize}
\item{}
Handle documentation issues. 

Generate platform specific doc with Richard Hipp's XML code.
\item{}
Establish Tcl code library.
\item{}
Identify more extensions.
\item{}
Determine the release schedule for ``batteries included'' distribution. 

How often do you release a new version? It must be more frequent than Tcl/Tk. We can start by planning for quarterly releases and then adding more frequent releases if necessary.
\item{}
Determine what core changes (if any) are needed for the distribution.
\item{}
Start looking at network-based updates.
\item{}
Start looking at selective builds. Allow builders to compile/install subsets of the distribution.
\item{}
Push on Redhat, SuSE, etc. to pick up distribution.
\end{itemize}

\section{Phase 3.}
\begin{itemize}
\item{}
Network-based installs.
\item{}
Selective installations/builds.
\item{}
Include applications tree.
\item{}
Identify more extensions.
\end{itemize}

The last phases are sketchy. Feel free to add to this list, further breaking down goals into subtasks.

\section{Open Issues}
\begin{itemize}
\item{}
Windows and MacIntosh sources.

Given the dearth of configuration tools for these platforms, it's likely that only binary installations will be available for the near term.
\item{}
Documentation

Overlap in command and widget names can be neatly handled by namespaces. Need to consider how to handle manual pages.
\end{itemize}

\section{More Information}

If anyone has interest to participate or would like to add comments to the ``Batteries Included'' proposal, please send mail to George Howlett \tipmail{gah}{siliconmetrics.com}.

\section{Copyright}

This document has been placed in the public domain.

\section{See Also}

\cite{tip4} by Brent Welch \tipmail{welch}{acm.org}.

\section{Colophon}

\textit{TIP AutoGenerator --- written by Donal K. Fellows}
\begin{thebibliography}{TIP \#1}
\addcontentsline{toc}{section}{References}
\bibitem[TIP \#4]{tip4}
Brent Welch,
Donal K. Fellows,
Larry W. Virden,
Larry W. Virden,
\emph{Tcl Release and Distribution Philosophy},
on-line at \url{http://purl.org/tcl/tip/4.html}
\end{thebibliography}
\end{document}
