bc.xml 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
  3. "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
  4. <!ENTITY % general-entities SYSTEM "../general.ent">
  5. %general-entities;
  6. ]>
  7. <sect1 id="ch-system-bc" role="wrap">
  8. <?dbhtml filename="bc.html"?>
  9. <sect1info condition="script">
  10. <productname>bc</productname>
  11. <productnumber>&bc-version;</productnumber>
  12. <address>&bc-url;</address>
  13. </sect1info>
  14. <title>Bc-&bc-version;</title>
  15. <indexterm zone="ch-system-bc">
  16. <primary sortas="a-Bc">Bc</primary>
  17. </indexterm>
  18. <sect2 role="package">
  19. <title/>
  20. <para>Bc 软件包包含一个任意精度数值处理语言。</para>
  21. <segmentedlist>
  22. <segtitle>&buildtime;</segtitle>
  23. <segtitle>&diskspace;</segtitle>
  24. <seglistitem>
  25. <seg>&bc-ch6-sbu;</seg>
  26. <seg>&bc-ch6-du;</seg>
  27. </seglistitem>
  28. </segmentedlist>
  29. </sect2>
  30. <sect2 role="installation">
  31. <title>安装 Bc</title>
  32. <!--
  33. <para>首先修改一个内部脚本,使它使用 <command>sed</command>,
  34. 而不是 <command>ed</command>:</para>
  35. <screen><userinput remap="pre">cat &gt; bc/fix-libmath_h &lt;&lt; "EOF"
  36. #! /bin/bash
  37. sed -e '1 s/^/{"/' \
  38. -e 's/$/",/' \
  39. -e '2,$ s/^/"/' \
  40. -e '$ d' \
  41. -i libmath.h
  42. sed -e '$ s/$/0}/' \
  43. -i libmath.h
  44. EOF</userinput></screen>
  45. <!- -para>Create temporary symbolic links so the package can find
  46. the readline library and confirm that its required libncurses
  47. library is available. Even though the libraries are in /tools/lib
  48. at this point, the system will use /usr/lib at the end of
  49. this chapter.</para- ->
  50. <para> 创建一个临时的符号链接,使该软件包可以找到 readline 库,
  51. 并确认它需要的 libncurses 库可用。虽然目前它还在 /tools/lib
  52. 中,但在本章结束时系统会使用 /usr/lib 中的最后版本。 </para>
  53. <screen><userinput remap="pre">ln -sv /tools/lib/libncursesw.so.6 /usr/lib/libncursesw.so.6
  54. ln -sfv libncursesw.so.6 /usr/lib/libncurses.so</userinput></screen>
  55. <para>由于LFS 早期阶段缺失了一些文件,需要修正
  56. <command>configure</command> 中的一个问题:</para>
  57. <screen><userinput remap="pre">sed -i -e '/flex/s/as_fn_error/: ;; # &amp;/' configure</userinput></screen>
  58. -->
  59. <para>准备安装 Bc:</para>
  60. <!--
  61. <screen><userinput remap="configure">./configure - -prefix=/usr \
  62. - -with-readline \
  63. - -mandir=/usr/share/man \
  64. - -infodir=/usr/share/info</userinput></screen>
  65. -->
  66. <screen><userinput remap="configure">PREFIX=/usr CC=gcc CFLAGS="-std=c99" ./configure.sh -G -O3</userinput></screen>
  67. <variablelist>
  68. <title>配置选项的含义:</title>
  69. <!--
  70. <varlistentry>
  71. <term><parameter>- -with-readline</parameter></term>
  72. <listitem>
  73. <!- -para>This option tells Bc to use the <filename
  74. class="libraryfile">readline</filename> library that is already
  75. installed on the system rather than using its own readline
  76. version.</para- ->
  77. <para>该选项告诉 Bc 使用系统中已经安装好的
  78. <filename class="libraryfile">readline</filename>
  79. 库,而不是它自己附带的 readline 。</para>
  80. </listitem>
  81. </varlistentry>
  82. -->
  83. <varlistentry>
  84. <term><parameter>CC=gcc CFLAGS="-std=c99"</parameter></term>
  85. <listitem>
  86. <para>该选项指定编译时使用的 C 编译器和标准。</para>
  87. </listitem>
  88. </varlistentry>
  89. <varlistentry>
  90. <term><parameter>-O3</parameter></term>
  91. <listitem>
  92. <para>该选项指定编译时使用的优化等级。</para>
  93. </listitem>
  94. </varlistentry>
  95. <varlistentry>
  96. <term><parameter>-G</parameter></term>
  97. <listitem>
  98. <para>忽略在没有 GNU bc 存在时无法工作的测试。</para>
  99. </listitem>
  100. </varlistentry>
  101. </variablelist>
  102. <para>编译该软件包:</para>
  103. <screen><userinput remap="make">make</userinput></screen>
  104. <!--
  105. <!- -para>To test bc, run the commands below. There is quite a bit of output,
  106. so you may want to redirect it to a file. There are a very small percentage
  107. of tests (10 of 12,144) that will indicate a round off error at the last
  108. digit.</para- ->
  109. <para>为了测试 bc,执行以下命令。它会输出很多内容,
  110. 因此您可能希望把输出重定向到文件。
  111. 少量测试 (12144 个测试中有 10 个)会在最后一位出现舍入误差。
  112. </para>
  113. <screen><userinput remap="test">echo "quit" | ./bc/bc -l Test/checklib.b</userinput></screen>
  114. -->
  115. <para>为了测试 bc,运行:</para>
  116. <screen><userinput remap="test">make test</userinput></screen>
  117. <para>安装该软件包:</para>
  118. <screen><userinput remap="install">make install</userinput></screen>
  119. </sect2>
  120. <sect2 id="contents-bc" role="content">
  121. <title>Bc 的内容</title>
  122. <segmentedlist>
  123. <segtitle>安装的程序</segtitle>
  124. <seglistitem>
  125. <seg>bc 和 dc</seg>
  126. </seglistitem>
  127. </segmentedlist>
  128. <variablelist>
  129. <bridgehead renderas="sect3">简要描述</bridgehead>
  130. <?dbfo list-presentation="list"?>
  131. <?dbhtml list-presentation="table"?>
  132. <varlistentry id="bc">
  133. <term><command>bc</command></term>
  134. <listitem>
  135. <para>一个命令行计算器</para>
  136. <indexterm zone="ch-system-bc bc">
  137. <primary sortas="b-bc">bc</primary>
  138. </indexterm>
  139. </listitem>
  140. </varlistentry>
  141. <varlistentry id="dc">
  142. <term><command>dc</command></term>
  143. <listitem>
  144. <para>一个逆波兰式命令行计算器</para>
  145. <indexterm zone="ch-system-bc dc">
  146. <primary sortas="b-dc">dc</primary>
  147. </indexterm>
  148. </listitem>
  149. </varlistentry>
  150. </variablelist>
  151. </sect2>
  152. </sect1>