bc.xml 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  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>-G -O3</parameter></term>
  91. <listitem>
  92. <para>该选项指定编译优化,并保留调试符号。</para>
  93. </listitem>
  94. </varlistentry>
  95. </variablelist>
  96. <para>编译该软件包:</para>
  97. <screen><userinput remap="make">make</userinput></screen>
  98. <!--
  99. <!- -para>To test bc, run the commands below. There is quite a bit of output,
  100. so you may want to redirect it to a file. There are a very small percentage
  101. of tests (10 of 12,144) that will indicate a round off error at the last
  102. digit.</para- ->
  103. <para>为了测试 bc,执行以下命令。它会输出很多内容,
  104. 因此您可能希望把输出重定向到文件。
  105. 少量测试 (12144 个测试中有 10 个)会在最后一位出现舍入误差。
  106. </para>
  107. <screen><userinput remap="test">echo "quit" | ./bc/bc -l Test/checklib.b</userinput></screen>
  108. -->
  109. <para>为了测试 bc,运行:</para>
  110. <screen><userinput remap="test">make test</userinput></screen>
  111. <para>安装该软件包:</para>
  112. <screen><userinput remap="install">make install</userinput></screen>
  113. </sect2>
  114. <sect2 id="contents-bc" role="content">
  115. <title>Bc 的内容</title>
  116. <segmentedlist>
  117. <segtitle>安装的程序</segtitle>
  118. <seglistitem>
  119. <seg>bc 和 dc</seg>
  120. </seglistitem>
  121. </segmentedlist>
  122. <variablelist>
  123. <bridgehead renderas="sect3">简要描述</bridgehead>
  124. <?dbfo list-presentation="list"?>
  125. <?dbhtml list-presentation="table"?>
  126. <varlistentry id="bc">
  127. <term><command>bc</command></term>
  128. <listitem>
  129. <para>一个命令行计算器</para>
  130. <indexterm zone="ch-system-bc bc">
  131. <primary sortas="b-bc">bc</primary>
  132. </indexterm>
  133. </listitem>
  134. </varlistentry>
  135. <varlistentry id="dc">
  136. <term><command>dc</command></term>
  137. <listitem>
  138. <para>一个逆波兰式命令行计算器</para>
  139. <indexterm zone="ch-system-bc dc">
  140. <primary sortas="b-dc">dc</primary>
  141. </indexterm>
  142. </listitem>
  143. </varlistentry>
  144. </variablelist>
  145. </sect2>
  146. </sect1>