<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
  "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
  <!ENTITY % general-entities SYSTEM "../general.ent">
  %general-entities;
]>

<sect1 id="ch-tools-tcl" role="wrap">
  <?dbhtml filename="tcl.html"?>

  <sect1info condition="script">
    <productname>tcl</productname>
    <productnumber>&tcl-version;</productnumber>
    <address>&tcl-url;</address>
  </sect1info>

  <title>Tcl-&tcl-version;</title>

  <indexterm zone="ch-tools-tcl">
    <primary sortas="a-Tcl">Tcl</primary>
  </indexterm>

  <sect2 role="package">
    <title/>

    <!--para>The Tcl package contains the Tool Command Language.</para-->
    <para>Tcl 软件包包含工具命令语言。</para>

    <segmentedlist>
      <segtitle>&buildtime;</segtitle>
      <segtitle>&diskspace;</segtitle>

      <seglistitem>
        <seg>&tcl-ch5-sbu;</seg>
        <seg>&tcl-ch5-du;</seg>
      </seglistitem>
    </segmentedlist>

  </sect2>

  <sect2 role="installation">
    <title>安装 Tcl</title>

    <!--para>This package and the next two (Expect and DejaGNU) are
    installed to support running the test suites for GCC and Binutils and other
    packages.  Installing three packages for testing purposes may seem
    excessive, but it is very reassuring, if not essential, to know that the
    most important tools are working properly. Even if the test suites are not
    run in this chapter (they are not mandatory), these packages are required
    to run the test suites in <xref linkend="chapter-building-system"/>.</para-->
    <para>为了支持 GCC 和 Binutils 等软件包测试套件的运行，
		需要安装这个软件包和接下来的两个 (Expect 与 DejaGNU)。
		为了测试目的安装三个软件包看似浪费，
		但实际上，我们运行了测试，才能放心地确定多数重要工具可以正常工作，
		即使测试不是必要的。另外，即使在本章中不运行测试套件
		（本章中的测试并不必要），我们必须安装这三个软件包，
		才能执行 <xref linkend="chapter-building-system"/> 中的测试套件。
	</para>

    <!--para>Note that the Tcl package used here is a minimal version needed
    to run the LFS tests.  For the full package, see the  
    <ulink url='&blfs-book;general/tcl.html'>BLFS Tcl procedures</ulink>.</para-->
    <para>注意，这里使用的 Tcl 软件包是一个最小版本，仅用于运行 LFS 的测试。
		如果需要完整的软件包，阅读
		<ulink url='&blfs-book;general/tcl.html'>BLFS Tcl 安装过程</ulink>
		。</para>

    <para>准备编译 Tcl：</para>

<screen><userinput remap="configure">cd unix
./configure --prefix=/tools</userinput></screen>

    <para>构建该软件包：</para>

<screen><userinput remap="make">make</userinput></screen>

    <!--para>Compilation is now complete. As discussed earlier, running the test
    suite is not mandatory for the temporary tools here in this chapter. To run
    the Tcl test suite anyway, issue the following command:</para-->
    <para>现在编译已经完成。正如之前讨论的，对于本章中的临时工具而言，
		没有必要运行测试套件。如果无论如何要运行测试套件，
		执行以下命令：</para>

<screen><userinput remap="test">TZ=UTC make test</userinput></screen>

    <!--para>The Tcl test suite may experience failures under certain host
    conditions that are not fully understood. Therefore, test suite failures
    here are not surprising, and are not considered critical. The
    <parameter>TZ=UTC</parameter> parameter sets the time zone to Coordinated
    Universal Time (UTC), but only
    for the duration of the test suite run. This ensures that the clock tests
    are exercised correctly. Details on the <envar>TZ</envar> environment
    variable are provided in <xref linkend="chapter-bootscripts"/>.</para-->

	<para>在某些特定的宿主环境下，Tcl 测试套件可能失败，
		失败原因还没有完全理解清楚。因此，测试套件的失败并不令人吃惊，
		也不会造成严重问题。<parameter>TZ=UTC</parameter>
		参数在测试套件的运行过程中将时区设为协调世界时 (UTC)，
		这保证时钟测试能够正常进行。<envar>TZ</envar>
		环境变量的详细知识在 <xref linkend="chapter-bootscripts"/> 中讲解。
	</para>


    <para>安装该软件包：</para>

<screen><userinput remap="install">make install</userinput></screen>

    <!--para>Make the installed library writable so debugging symbols can
    be removed later:</para-->
    <para>将安装好的库加上写入权限，以便将来移除调试符号：</para>

<screen><userinput remap="install">chmod -v u+w /tools/lib/libtcl&tcl-major-version;.so</userinput></screen>

    <!--para>Install Tcl's headers. The next package, Expect, requires them
    to build.</para-->
    <para>安装 Tcl 的头文件，因为下一个软件包 Expect 需要它们才能构建。
    </para>

<screen><userinput remap="install">make install-private-headers</userinput></screen>

    <!--para>Now make a necessary symbolic link:</para-->
    <para>创建一个必要的符号链接：</para>

<screen><userinput remap="install">ln -sv tclsh&tcl-major-version; /tools/bin/tclsh</userinput></screen>

  </sect2>

  <sect2 id="contents-tcl" role="content">
    <title>Tcl 的内容</title>

    <segmentedlist>
      <segtitle>安装的程序</segtitle>
      <segtitle>安装的库</segtitle>

      <seglistitem>
        <seg>tclsh (到 tclsh&tcl-major-version; 的链接) 和 tclsh&tcl-major-version;</seg>
        <seg>libtcl&tcl-major-version;.so, libtclstub&tcl-major-version;.a</seg>
      </seglistitem>
    </segmentedlist>

    <variablelist>
      <bridgehead renderas="sect3">简要描述</bridgehead>
      <?dbfo list-presentation="list"?>
      <?dbhtml list-presentation="table"?>

      <varlistentry id="tclsh&tcl-major-version;">
        <term><command>tclsh&tcl-major-version;</command></term>
        <listitem>
          <para>Tcl 命令行 shell</para>
          <indexterm zone="ch-tools-tcl tclsh&tcl-major-version;">
            <primary sortas="b-tclsh&tcl-major-version;">tclsh&tcl-major-version;</primary>
          </indexterm>
        </listitem>
      </varlistentry>

      <varlistentry id="tclsh">
        <term><command>tclsh</command></term>
        <listitem>
          <para>一个指向 tclsh&tcl-major-version; 的链接</para>
          <indexterm zone="ch-tools-tcl tclsh">
            <primary sortas="b-tclsh">tclsh</primary>
          </indexterm>
        </listitem>
      </varlistentry>

      <varlistentry id="libtcl&tcl-major-version;.so">
        <term><filename class="libraryfile">libtcl&tcl-major-version;.so</filename></term>
        <listitem>
          <para>Tcl 运行库</para>
          <indexterm zone="ch-tools-tcl libtcl&tcl-major-version;.so">
            <primary sortas="c-libtcl&tcl-major-version;.so">libtcl&tcl-major-version;.so</primary>
          </indexterm>
        </listitem>
      </varlistentry>

      <varlistentry id="libtclstub&tcl-major-version;.a">
        <term><filename class="libraryfile">libtclstub&tcl-major-version;.a</filename></term>
        <listitem>
          <para>Tcl 端桩库</para>
          <indexterm zone="ch-tools-tcl libtclstub&tcl-major-version;.a">
            <primary sortas="c-libtclstub&tcl-major-version;.a">libtclstub&tcl-major-version;.a</primary>
          </indexterm>
        </listitem>
      </varlistentry>

    </variablelist>

  </sect2>

</sect1>
