The tcl
component (like the parallel
tk
component) is paradoxically easy to
configure, partly because its distributed
./configure
script is generated by a version
of autoconf too old for us to handle directly, which means
that we want to avoid touching it as much as possible, but
also because the Tcl distribution has an installation
mechanism which is too complicated to be handled by the
simple scheme in the previous cfitsio
section. The method we use instead, as described below,
actually looks simpler, but you should probably not resort
to it unless necessary, since the starconf macro is uses
-- STAR_SPECIAL_INSTALL_COMMAND -- is a
dangerously blunt instrument.
After being unpacked and imported as described above, the top-level of the checked out Tcl distribution looks like this:
The way that the distributedptolemy:tcl> ls CVS/ README compat/ generic/ license.terms tests/ unix/ ChangeLog changes doc/ library/ mac/ tools/ win/
README
tells us
to compile Tcl is to change to the unix/
subdirectory, and type ./configure; make
. We
want to create files Makefile.am
and
configure.ac
in this directory, which handle
this for us.We add a component.xml.in
as before, plus
non-standard configure.ac
and
Makefile.am
files. The
configure.ac
should look like this:
dnl Process this file with autoconf to produce a configure script AC_REVISION($Revision: 1.116 $) AC_INIT(tclsys, 8.2.3, ussc@star.rl.ac.uk) AC_PREREQ(2.50) AM_INIT_AUTOMAKE(1.8.2-starlink) AC_CONFIG_SRCDIR([license.terms]) STAR_DEFAULTS AC_PROG_MAKE_SET dnl To configure Tcl, run ./configure in the `unix' directory. dnl Do not invoke AC_CONFIG_SUBDIRS, since that prompts autoreconf dnl to try to reconfigure that directory, and automake to assume dnl it's allowed to play there, too. ( cd unix ./configure --prefix=$prefix ) STAR_SPECIAL_INSTALL_COMMAND([cd unix; $(MAKE) INSTALL_ROOT=$$DESTDIR install]) AC_CONFIG_FILES([Makefile component.xml]) AC_OUTPUT
This looks rather like the cfitsio example, except for the addition of the new macro, which uses a parameterised version of the distribution's own install command to make the installation into the Starlink tree.
As described in Appendix A.27,
this adapts
the standard Makefile install
target so that
it uses the given command to make an installation. Note
that the version of autoconf which generated the Tcl
Makefile.in
template was one which used the
INSTALL_ROOT
variable instead of the
DESTDIR
variable used by more modern
versions, and so we have to adjust this in this command
line. This DESTDIR
variable is important, as
it is used during the installation of the component, to do
a staged installation, from which a manifest can be
derived.
This staging step is important, and is rather easy to get
wrong. If you do get it wrong, then the installed
manifest will be wrong, probably causing problems later
when it comes to deinstalling or packaging this component.
The role of the INSTALL_ROOT
variable above
was discovered only by inspecting the
Makefile.in
in the Tcl distribution: if there
were no such facility, we could (probably) fake much of it
by using something like $(MAKE)
prefix=$$DESTDIR$$prefix install
in the
installation macro. The distributed Tcl Makefile appears
to respect the variable, but it is important to check for
errors such as making absolute links, or using the current
directory incautiously (search for LN_S
or
`pwd`
in the Makefile.in
).
The Makefile.am
file is even simpler:
## Process this file with automake to produce Makefile.in @SET_MAKE@ RECURSIVE_TARGETS = all clean default: all $(RECURSIVE_TARGETS): cd unix; $(MAKE) $@
After writing the Makefile.am
and
configure.ac
files, all you need to do is run
starconf to create a ./bootstrap
file, and
check in the files which starconf suggests.
That's it!