<?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-util-linux" role="wrap">
  <?dbhtml filename="util-linux.html"?>

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

  <title>Util-linux-&util-linux-version;</title>

  <indexterm zone="ch-tools-util-linux">
    <primary sortas="a-Util-linux">Util-linux</primary>
    <secondary>tools</secondary>
  </indexterm>

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

    <para>Util-linux 软件包包含一些工具程序。</para>

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

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

  </sect2>

  <sect2 role="installation">
    <title>安装 Util-linux</title>

    <para>准备编译 Util-linux：</para>

<screen><userinput remap="configure">./configure --prefix=/tools                \
            --without-python               \
            --disable-makeinstall-chown    \
            --without-systemdsystemunitdir \
            --without-ncurses              \
            PKG_CONFIG=""</userinput></screen>

    <variablelist>
      <title>配置选项的含义：</title>

      <varlistentry>
        <term><parameter>--without-python</parameter></term>
        <listitem>
          <!--para>This switch disables using <application>Python</application>
          if it is installed on the host system.  It avoids trying to build
          unneeded bindings.</para-->
          <para>如果宿主系统安装了 <application>Python</application>，
			  该选项防止构建系统使用它，这样就不会构建不需要的语言绑定。
		  </para>
        </listitem>
      </varlistentry>

      <varlistentry>
        <term><parameter>--disable-makeinstall-chown</parameter></term>
        <listitem>
          <!--para>This switch disables using the <command>chown</command> command
          during installation.  This is not needed when installing into the
          /tools directory and avoids the necessity of installing as
          root.</para-->
          <para>这个开关在安装时禁用 <command>chown</command>，
			  在安装到 /tools 目录时我们不需要这样做，禁用它就不必用 root
			  身份进行安装。</para>
        </listitem>
      </varlistentry>

      <varlistentry>
        <term><parameter>--without-ncurses</parameter></term>
        <listitem>
          <!--para>This switch disables using the ncurses library for
          the build process. This is not needed when installing into the
          /tools directory and avoids problems on some host distros.</para-->
          <para>这个开关在构建过程中禁用 ncurses 库，在安装到
			  /tools 目录时我们不需要它，
			  禁用它可以避免某些宿主发行版上的问题。</para>
        </listitem>
      </varlistentry>

      <varlistentry>
        <term><parameter>--without-systemdsystemunitdir</parameter></term>
        <listitem>
          <!--para>On systems that use systemd, the package tries to install 
          a systemd specific file to a non-existent directory in /tools.
          This switch disables the unnecessary action.</para-->
          <para>在使用 systemd 的系统上，该软件包会试图向 /tools
			  中一个不存在的目录安装 systemd 专用的文件，
			  该选项可以阻止这个不必要的行为。</para>
        </listitem>
      </varlistentry>

      <varlistentry>
        <term><envar>PKG_CONFIG=""</envar></term>
        <listitem>
          <!--para>Setting this environment variable prevents adding unneeded
          features that may be available on the host. Note that the location
          shown for setting this environment variable is different from other
          LFS sections where variables are set preceding the command.  This
          location is shown to demonstrate an alternative way of setting an
          environment variable when using configure.</para-->
          <para>设置这个环境变量可以防止引入那些宿主系统上可用，
			  但对 LFS 来说不必要的特性。
			  注意到本书中其他环境变量都在命令之前被设置，
			  而这个环境变量设定处于命令行中的不同位置，
			  这是为了展示在使用 configure 脚本时设置环境变量的另一种方法。
		  </para>
        </listitem>
      </varlistentry>
     </variablelist>

    <para>编译该软件包：</para>

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

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

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

  </sect2>

</sect1>
