diff options
author | Xin LI <delphij@FreeBSD.org> | 2006-11-17 15:01:43 +0000 |
---|---|---|
committer | Xin LI <delphij@FreeBSD.org> | 2006-11-17 15:01:43 +0000 |
commit | 8efb078b092c86c2a4e63f686b7f41b6be0ad412 (patch) | |
tree | f100a81eae9d7513fdfc03eeb5ab980bed717018 /zh_CN.GB2312/books | |
parent | 496c355bfa7e60dbe39ccbd9fdc585428d0a7450 (diff) |
Notes
Diffstat (limited to 'zh_CN.GB2312/books')
-rw-r--r-- | zh_CN.GB2312/books/porters-handbook/book.sgml | 1154 |
1 files changed, 1092 insertions, 62 deletions
diff --git a/zh_CN.GB2312/books/porters-handbook/book.sgml b/zh_CN.GB2312/books/porters-handbook/book.sgml index 4e08447b72..41c5fecaef 100644 --- a/zh_CN.GB2312/books/porters-handbook/book.sgml +++ b/zh_CN.GB2312/books/porters-handbook/book.sgml @@ -2,7 +2,7 @@ The FreeBSD Documentation Project The FreeBSD Simplified Chinese Project - Original Revision: 1.762 + Original Revision: 1.769 $FreeBSD$ --> @@ -3352,8 +3352,8 @@ PKGNAMESUFFIX= ${RESOLUTION} RESOLUTION?= 300 .if ${RESOLUTION} != 118 && ${RESOLUTION} != 240 && \ ${RESOLUTION} != 300 && ${RESOLUTION} != 400 - @${ECHO} "Error: invalid value for RESOLUTION: \"${RESOLUTION}\"" - @${ECHO} "Possible values are: 118, 240, 300 (default) and 400." + @${ECHO_MSG} "Error: invalid value for RESOLUTION: \"${RESOLUTION}\"" + @${ECHO_MSG} "Possible values are: 118, 240, 300 (default) and 400." @${FALSE} .endif</programlisting> @@ -4948,7 +4948,7 @@ BUILD_DEPENDS+= Xvfb:${X_VFBSERVER_PORT} \ <para>在 Ports Collection 中有许多不同的 JDK, 它们的版本各不相同, 或是来自不同的供应商。 如果您的 port 必须使用其中的某个特定的版本, 也可以予以定义。 最新的稳定版本是 - <filename role="package">java/jdk14</filename>。</para> + <filename role="package">java/jdk15</filename>。</para> <table frame="none"> <title>用到 Java 的 port 可以使用的变量</title> @@ -5887,84 +5887,1093 @@ USE_SDL+= mixer </sect1> <sect1 id="using-wx"> - <title>使用 wxWidgets</title> + <title>使用 <application>wxWidgets</application></title> - <para>如果您的 port 用到了跨平台工具套件 <application>wxWidgets</application>, - 则应定义 <literal>USE_WX</literal>。 此外, 必须通过类似 - <literal>USE_WX=2.6</literal> 这样的形式来指定具体的版本。 除此之外, - 还可以指定范围 (<literal>2.4-2.6</literal>) - 和开区间 (<literal>-2.4</literal>、 <literal>2.6+</literal>) - 这样的形式。</para> + <para>这一节介绍了在 ports tree 中的 + <application>wxWidgets</application> 库的现状, + 以及它与 ports 系统的集成。</para> - <para>所需的 wxWidgets 组件可以通过 - <makevar>WX_COMPS</makevar> 来设置。 除非另外指定, - port 将依赖于 wxWidgets 库 (<literal>wx</literal>)。 - 可用的组件包括:</para> + <sect2 id="wx-introduction"> + <title>介绍</title> - <table frame="none"> - <title><makevar>WX_COMPS</makevar> 的可选值</title> + <para>许多不同版本的 + <application>wxWidgets</application> 库之间是存在相互冲突的 (它们会安装同名的文件) + 在 ports 系统中, 这一问题是通过将不同的版本以包含版本号后缀的名字安装来解决的。</para> - <tgroup cols="2"> - <thead> - <row> - <entry>值</entry> + <para>这样做的一个最明显的缺点是, 应用程序必须进行修改, 才能找到所希望的版本。 + 幸运的是, 多数应用程序会调用 <command>wx-config</command> 脚本来确定需要的编译器和连接器选项。 + 这个脚本会随可用的版本不同而有不同的名字。 主要的应用程序都会尊重环境变量的配置, + 或提供一个 configure 参数, 用以指定调用哪个 <command>wx-config</command>。 + 如果不是这样的话, 就需要对应用程序打补丁了。</para> + </sect2> - <entry>意义</entry> - </row> - </thead> + <sect2 id="wx-version"> + <title>版本的选择</title> - <tbody> - <row> - <entry><literal>wx</literal></entry> + <para>为了让您的 port 使用指定版本的 + <application>wxWidgets</application>, 可以定义两个变量 (如果只定义了一个, + 则另一个会取默认值):</para> - <entry>wxWidget 函数库</entry> - </row> + <table id="wx-ver-sel-table" frame="none"> + <title>用于选择 <application>wxWidgets</application> + 版本的变量</title> - <row> - <entry><literal>contrib</literal></entry> + <tgroup cols="3"> + <thead> + <row> + <entry>变量</entry> - <entry>wxWidget 第三方函数库</entry> - </row> + <entry>说明</entry> - <row> - <entry><literal>python</literal></entry> + <entry>默认值</entry> + </row> + </thead> - <entry>wxPython</entry> - </row> + <tbody> + <row> + <entry><makevar>USE_WX</makevar></entry> - <row> - <entry><literal>mozilla</literal></entry> + <entry>列出这个 port 能使用的版本</entry> - <entry>wxMozilla (仅限于 2.4 以上版本)</entry> - </row> + <entry>全部版本</entry> + </row> - <row> - <entry><literal>svg</literal></entry> + <row> + <entry><makevar>USE_WX_NOT</makevar></entry> - <entry>wxSVG (仅限于 2.6 以上版本)</entry> - </row> - </tbody> - </tgroup> - </table> + <entry>列出这个 port 不能使用的版本</entry> + + <entry>无</entry> + </row> + </tbody> + </tgroup> + </table> + + <para>下面是可用的 + <application>wxWidgets</application> 版本, 以及对应的 + ports:</para> + + <table frame="none"> + <title>可用的 <application>wxWidgets</application> + versions</title> + + <tgroup cols="2"> + <thead> + <row> + <entry>版本</entry> + + <entry>Port</entry> + </row> + </thead> + + <tbody> + <row> + <entry><literal>2.4</literal></entry> + + <entry><filename + role="package">x11-toolkits/wxgtk24</filename></entry> + </row> + + <row> + <entry><literal>2.6</literal></entry> + + <entry><filename + role="package">x11-toolkits/wxgtk26</filename></entry> + </row> + </tbody> + </tgroup> + </table> + + <note> + <para><literal>2.6</literal> 版也提供了一个 Unicode + 版本, 这个版本可以通过 slave port <filename + role="package">x11-toolkits/wxgtk26-unicode</filename> 来安装, + 但这也是通过变量来指定的 (参见 <xref + linkend="wx-unicode">)。</para> + </note> + + <para>在 <xref linkend="wx-ver-sel-table"> 中的变量, + 可以设为下列值或由空格分隔的组合:</para> + + <table frame="none"> + <title><application>wxWidgets</application> 版本</title> + + <tgroup cols="2"> + <thead> + <row> + <entry>说明</entry> + + <entry>例子</entry> + </row> + </thead> + + <tbody> + <row> + <entry>单个版本</entry> + + <entry><literal>2.4</literal></entry> + </row> + + <row> + <entry>某版本以上版本</entry> + + <entry><literal>2.4+</literal></entry> + </row> + + <row> + <entry>某版本以下版本</entry> + + <entry><literal>2.6-</literal></entry> + </row> + + <row> + <entry>某段版本 (版本号较小的必须在前)</entry> + + <entry><literal>2.4-2.6</literal></entry> + </row> + </tbody> + </tgroup> + </table> + + <para>除此之外, 还有一些用以从可用的本那本中选择所希望的版本的变量。 + 这种变量也可以设为一组版本, 而靠前的版本的优先级更高。</para> + + <table frame="none"> + <title>用于选择希望的版本的 + <application>wxWidgets</application> versions</title> + + <tgroup cols="2"> + <thead> + <row> + <entry>变量名</entry> + + <entry>用于</entry> + </row> + </thead> + + <tbody> + <row> + <entry><makevar>WANT_WX_VER</makevar></entry> + + <entry>port</entry> + </row> + + <row> + <entry><makevar>WITH_WX_VER</makevar></entry> + + <entry>用户</entry> + </row> + </tbody> + </tgroup> + </table> + + <sect2 id="wx-components"> + <title>选择组件</title> + + <para>也有一些其他应用, 尽管它们本身并不是 + <application>wxWidgets</application> 库, 但却与之相关。 + 这些应用程序可以在 + <makevar>WX_COMPS</makevar> 变量中使用, 以下是可用的组件:</para> + + <table frame="none"> + <title>可用的 <application>wxWidgets</application> + 组件</title> + + <tgroup cols="3"> + <thead> + <row> + <entry>名称</entry> + + <entry>说明</entry> + + <entry>版本限制</entry> + </row> + </thead> + + <tbody> + <row> + <entry><literal>wx</literal></entry> + + <entry>主库</entry> + + <entry>无</entry> + </row> + + <row> + <entry><literal>contrib</literal></entry> + + <entry>第三方库</entry> + + <entry><literal>无</literal></entry> + </row> + + <row> + <entry><literal>python</literal></entry> + + <entry><application>wxPython</application> + (<application>Python</application> 绑定)</entry> + + <entry><literal>无</literal></entry> + </row> + + <row> + <entry><literal>mozilla</literal></entry> + + <entry><application>wxMozilla</application></entry> + + <entry><literal>2.4</literal></entry> + </row> + + <row> + <entry><literal>svg</literal></entry> + + <entry><application>wxSVG</application></entry> + + <entry><literal>2.6</literal></entry> + </row> + </tbody> + </tgroup> + </table> + + <para>您可以为每个依赖的组件, 通过冒号分隔的后缀指定其类型。 + 如果没有指定, 则会使用默认的依赖类型 (参见 <xref linkend="wx-def-dep-types">)。 + 下面是可用的类型:</para> + + <table frame="none"> + <title>可用的 <application>wxWidgets</application> 依赖类型</title> + + <tgroup cols="2"> + <thead> + <row> + <entry>名称</entry> + + <entry>说明</entry> + </row> + </thead> + + <tbody> + <row> + <entry><literal>build</literal></entry> + + <entry>联编时需要该组件, 相当于 + <makevar>BUILD_DEPENDS</makevar></entry> + </row> + + <row> + <entry><literal>run</literal></entry> + + <entry>运行时需要该组件, 相当于 + <makevar>RUN_DEPENDS</makevar></entry> + </row> + + <row> + <entry><literal>lib</literal></entry> + + <entry>联编和运行时均需要该组件, + 相当于 <makevar>LIB_DEPENDS</makevar> + </row> + </tbody> + </tgroup> + </table> + + <para>组件的默认依赖关系类型, 如下表所示:</para> + + <table id="wx-def-dep-types" frame="none"> + <title>默认的 <application>wxWidgets</application> 依赖关系类型</title> + + <tgroup cols="2"> + <thead> + <row> + <entry>组件</entry> + + <entry>依赖关系类型</entry> + </row> + </thead> + + <tbody> + <row> + <entry><literal>wx</literal></entry> + + <entry><literal>lib</literal></entry> + </row> + + <row> + <entry><literal>contrib</literal></entry> + + <entry><literal>lib</literal></entry> + </row> + + <row> + <entry><literal>python</literal></entry> + + <entry><literal>run</literal></entry> + </row> + + <row> + <entry><literal>mozilla</literal></entry> + + <entry><literal>lib</literal></entry> + </row> + + <row> + <entry><literal>svg</literal></entry> + + <entry><literal>lib</literal></entry> + </row> + </tbody> + </tgroup> + </table> + + <example id="wx-components-example"> + <title>选择 <application>wxWidgets</application> + 组件</title> + + <para>下面的片段展示了使用 + <application>wxWidgets</application> 版本 + <literal>2.4</literal> 及第三方库的方法。</para> + + <programlisting>USE_WX= 2.4 +WX_COMPS= wx contrib</programlisting> + </example> + </sect2> + <sect2 id="wx-unicode"> + <title>Unicode</title> + + <para><application>wxWidgets</application> 库从其 <literal>2.5</literal> + 版开始支持 Unicode 了。 在 ports 系统中, 这两种版本均有提供, + 并可以通过下列变量来选择:</para> + + <table id="wx-unicode-var-table" frame="none"> + <title>用以在 Unicode 版本的 + <application>wxWidgets</application> + 的变量</title> + + <tgroup cols="3"> + <thead> + <row> + <entry>变量</entry> + + <entry>说明</entry> + + <entry>作用</entry> + </row> + </thead> + + <tbody> + <row> + <entry><makevar>WX_UNICODE</makevar></entry> + + <entry>该 port <emphasis>只能</emphasis> 配合 + Unicode 版本使用</entry> + + <entry>port</entry> + </row> + + <row> + <entry><makevar>WANT_UNICODE</makevar></entry> + + <entry>port 能够与两种版本配合使用, 但希望使用 + Unicode 版本</entry> + + <entry>port</entry> + </row> + + <row> + <entry><makevar>WITH_UNICODE</makevar></entry> + + <entry>令 port 使用 Unicode 版本</entry> + + <entry>用户</entry> + </row> + + <row> + <entry><makevar>WITHOUT_UNICODE</makevar></entry> + + <entry>令 port 使用普通版本, + 如果支持的话 (即未定义 <makevar>WX_UNICODE</makevar>)</entry> + + <entry>用户</entry> + </row> + </tbody> + </tgroup> + </table> + + <warning> + <para>如果 port 同时支持 Unicode 和普通版本, + 请不要使用 <makevar>WX_UNICODE</makevar>。 如果希望默认启用 + Unicode, 应定义 <makevar>WANT_UNICODE</makevar>。</para> + </warning> + </sect2> + + <sect2 id="wx-version-detection"> + <title>检测已安装的版本</title> + + <para>要检测系统中安装的版本, 就需要定义 + <makevar>WANT_WX</makevar>。 如果没有将其设置为特定的版本, + 则组件将包含版本后缀。 + <makevar>HAVE_WX</makevar> 变量在检测完成后会自动填入内容。</para> + + <example id="wx-ver-det-example"> + <title>检测已安装的 <application>wxWidgets</application> + 版本和组件</title> + + <para>下面的片段可以在安装 + <application>wxWidgets</application> 的系统中令 port 使用它, + 反之则作为一项选项提供。</para> + + <programlisting>WANT_WX= yes + +.include <bsd.port.pre.mk> + +.if defined(WITH_WX) || ${HAVE_WX:Mwx-2.4} != "" +USE_WX= 2.4 +CONFIGURE_ARGS+=--enable-wx +.endif</programlisting> + + <para>下面的片段在系统中有安装过时启用 + <application>wxPython</application> 支持, + 或在没有安装时作为选项提供; 对 + <application>wxWidgets</application> 也是如此办理, 版本皆为 + <literal>2.6</literal>。</para> + + <programlisting>USE_WX= 2.6 +WX_COMPS= wx +WANT_WX= 2.6 + +.include <bsd.port.pre.mk> + +.if defined(WITH_WXPYTHON) || ${HAVE_WX:Mpython} != "" +WX_COMPS+= python +CONFIGURE_ARGS+=--enable-wxpython +.endif</programlisting> + </example> + </sect2> + + <sect2 id="wx-defined-variables"> + <title>定义的变量</title> + + <para>以下是一些可以在 port 中使用的变量 + (这之前需要定义 <xref linkend="wx-ver-sel-table"> 中的至少一个变量)。</para> + + <table frame="none"> + <title>为使用 + <application>wxWidgets</application> 的 port 定义的变量</title> + + <tgroup cols="2"> + <thead> + <row> + <entry>变量名</entry> + + <entry>说明</entry> + </row> + </thead> + + <tbody> + <row> + <entry><makevar>WX_CONFIG</makevar></entry> + + <entry>到 <application>wxWidgets</application> + <command>wx-config</command> 脚本的路径 (名字会随版本不同而不同)</entry> + </row> + <row> + <entry><makevar>WXRC_CMD</makevar></entry> + + <entry>到 <application>wxWidgets</application> + <command>wxrc</command> 程序的路径 (名字会随版本不同而不同)</entry> + </row> + <row> + <entry><makevar>WX_VERSION</makevar></entry> + + <entry>将要用到的 <application>wxWidgets</application> 版本 + (例如, <literal>2.6</literal>)</entry> + </row> + + <row> + <entry><makevar>WX_UNICODE</makevar></entry> + + <entry>如果没有定义, 而将会使用 Unicode 时, 系统将自动定义此变量。</entry> + </row> + </tbody> + </tgroup> + </table> + </sect2> + + <sect2 id="wx-premk"> + <title>在 <filename>bsd.port.pre.mk</filename> 中进行处理</title> + + <para>如果您需要在引用了 <filename>bsd.port.pre.mk</filename> 之后立即对一些变量进行处理, + 则需要定义 <makevar>WX_PREMK</makevar>。</para> + + <important> + <para>如果定义了 <makevar>WX_PREMK</makevar>, 则在此 + <emphasis>之后</emphasis> 定义的依赖关系、 组件和变量将不会生效, + 您在引用 <filename>bsd.port.pre.mk</filename> + 之前的 <application>wxWidgets</application> port 变量将直接起作用。</para> + </important> + + <example id="wx-premk-example"> + <title>在命令中使用 <application>wxWidgets</application> 变量</title> + + <para>下面的片段以执行 + <command>wx-config</command> 脚本来得到完整的版本号, + 将其赋值到变量中, 并传递给一个程序举例说明了 + <makevar>WX_PREMK</makevar> 的用法。</para> + + <programlisting>USE_WX= 2.4 +WX_PREMK= yes + +.include <bsd.port.pre.mk> + +.if exists(${WX_CONFIG}) +VER_STR!= ${WX_CONFIG} --release + +PLIST_SUB+= VERSION="${VER_STR}" +.endif</programlisting> + </example> + + <note> + <para>在 target 中的 <application>wxWidgets</application> 变量可以直接使用, + 而无需 <makevar>WX_PREMK</makevar> 的参与。</para> + </note> + </sect2> + </sect1> + + <sect1 id="using-lua"> + <title>使用 <application>Lua</application></title> + + <para>这一节描述了在 ports 系统中的 + <application>Lua</application> 库的现状, 以及它与 ports 系统的集成。</para> + + <sect2 id="lua-introduction"> + <title>介绍</title> + + <para>许多不同版本的 <application>Lua</application> + 库和相关的解释器之间是相互冲突的 (它们会安装同名的文件)。 + 在 ports 系统中, 这一问题是通过将不同版本的文件以不同的版本号作为后缀名解决的。</para> + + <para>这样做最大的一个问题是, 每个程序都需要进行修改才能找到它所需要的版本。 + 不过, 通过将适当的参数传给编译器和连接器很容易解决这个问题。</para> + </sect2> + + <sect2 id="lua-version"> + <title>选择版本</title> + + <para>要让您的 port 使用指定版本的 + <application>Lua</application>, + 可以定义两个变量的值 (如果只定义了其中的一个, 则另一个会使用默认值):</para> + + <table id="lua-ver-sel-table" frame="none"> + <title>用于选择 <application>Lua</application> + 版本的变量</title> + + <tgroup cols="3"> + <thead> + <row> + <entry>变量</entry> + + <entry>说明</entry> + + <entry>默认值</entry> + </row> + </thead> + + <tbody> + <row> + <entry><makevar>USE_LUA</makevar></entry> + + <entry>port 能够使用的 Lua 版本列表</entry> + + <entry>全部可用版本</entry> + </row> + + <row> + <entry><makevar>USE_LUA_NOT</makevar></entry> + + <entry>与 port 不兼容的版本列表</entry> + + <entry>无</entry> + </row> + </tbody> + </tgroup> + </table> + + <para>下面是目前 ports 系统提供的可用 + <application>Lua</application> 版本和对应的目录:</para> + + <table frame="none"> + <title>可用的 <application>Lua</application> 版本</title> + + <tgroup cols="2"> + <thead> + <row> + <entry>版本</entry> + + <entry>Port</entry> + </row> + </thead> + + <tbody> + <row> + <entry><literal>4.0</literal></entry> + + <entry><filename role="package">lang/lua4</filename></entry> + </row> + + <row> + <entry><literal>5.0</literal></entry> + + <entry><filename role="package">lang/lua50</filename></entry> + </row> + + <row> + <entry><literal>5.1</literal></entry> + + <entry><filename role="package">lang/lua</filename></entry> + </row> + </tbody> + </tgroup> + </table> + + <para>在 <xref linkend="lua-ver-sel-table"> 中的变量, + 可以设置为下面的版本之一, 或用空格分隔的若干版本:</para> + + <table frame="none"> + <title>指定 <application>Lua</application> 版本</title> + + <tgroup cols="2"> + <thead> + <row> + <entry>说明</entry> + + <entry>例子</entry> + </row> + </thead> + + <tbody> + <row> + <entry>一个版本</entry> + + <entry><literal>4.0</literal></entry> + </row> + + <row> + <entry>某个版本或更高版本</entry> + + <entry><literal>5.0+</literal></entry> + </row> + + <row> + <entry>不高于某个版本</entry> + + <entry><literal>5.0-</literal></entry> + </row> + + <row> + <entry>版本范围 (低版本必须在前)</entry> + + <entry><literal>5.0-5.1</literal></entry> + </row> + </tbody> + </tgroup> + </table> + + <para>除此之外, 也有一些用来从可用版本中选择推荐版本的其它变量。 这些变量也可以设置为一组版本, + 而前面的版本优先级较高。</para> + + <table frame="none"> + <title>用于选择推荐 <application>Lua</application> + 版本的变量</title> + + <tgroup cols="2"> + <thead> + <row> + <entry>变量名</entry> + + <entry>用于</entry> + </row> + </thead> + + <tbody> + <row> + <entry><makevar>WANT_LUA_VER</makevar></entry> + + <entry>port</entry> + </row> + + <row> + <entry><makevar>WITH_LUA_VER</makevar></entry> + + <entry>用户</entry> + </row> + </tbody> + </tgroup> + </table> + + <example id="lua-version-example"> + <title>选择 <application>Lua</application> 版本</title> + + <para>下面是一个用到 + <application>Lua</application> 版本 <literal>5.0</literal> 或 + <literal>5.1</literal>, 并默认使用 <literal>5.0</literal> + 的 port 的片段。 这个默认值可以通过 + <makevar>WITH_LUA_VER</makevar> 来另外指定。</para> + + <programlisting>USE_LUA= 5.0-5.1 +WANT_LUA_VER= 5.0</programlisting> + </example> + </sect2> + + <sect2 id="lua-components"> + <title>组件的选择</title> + + <para>也有一些其它的应用, 尽管本身并不是 + <application>Lua</application> 库, 但却与它们相关。 + 这些应用可以通过 <makevar>LUA_COMPS</makevar> + 变量来指定。 可用的组件如下:</para> + + <table frame="none"> + <title>可用的 <application>Lua</application> 组件</title> + + <tgroup cols="3"> + <thead> + <row> + <entry>名字</entry> + + <entry>说明</entry> + + <entry>版本限制</entry> + </row> + </thead> + + <tbody> + <row> + <entry><literal>lua</literal></entry> + + <entry>主库</entry> + + <entry>无</entry> + </row> + + <row> + <entry><literal>tolua</literal></entry> + + <entry>用于访问 C/C++ 代码的库</entry> + + <entry><literal>4.0-5.0</literal></entry> + </row> + + <row> + <entry><literal>ruby</literal></entry> + + <entry>Ruby 绑定</entry> + + <entry><literal>4.0-5.0</literal></entry> + </row> + </tbody> + </tgroup> + </table> + + <note> + <para>还有一些其它的组件, 但这些组件是由解释器, + 而不是由应用程序使用的 (也就是不被其它模块使用)。</para> + </note> + + <para>每个组件的依赖关系类型可以通过手工添加分隔符为冒号的后缀来指定。 + 如果不指定, 则会采用默认类型 (请参见 <xref linkend="lua-def-dep-types">)。 + 以下是可用的依赖关系类型:</para> - <para>如果查找 wxWidget 函数库需要通过 <makevar>WX_CONFIG</makevar> 变量以外的 - configure 参数 来指定, 则应在 port 中设置 - <makevar>WX_CONF_ARGS</makevar>。 可选的值包括表示 - <literal>--with-wx-config=${WX_CONFIG}</literal> 的 - <literal>absolute</literal>, 以及表示 - <literal>--with-wx=${X11BASE} --with-wx-config=${WX_CONFIG}</literal> 的 - <literal>relative</literal>; 这些参数将作为 configure 的参数。</para> + <table frame="none"> + <title>可用的 <application>Lua</application> 依赖关系类型</title> + + <tgroup cols="2"> + <thead> + <row> + <entry>名字</entry> + + <entry>说明</entry> + </row> + </thead> + + <tbody> + <row> + <entry><literal>build</literal></entry> + + <entry>这个组件是联编过程所必需的, 相当于 + <makevar>BUILD_DEPENDS</makevar></entry> + </row> + + <row> + <entry><literal>run</literal></entry> + + <entry>在运行时需要这个组件, 相当于 + <makevar>RUN_DEPENDS</makevar></entry> + </row> + + <row> + <entry><literal>lib</literal></entry> + + <entry>这个组件在联编和运行时都需要, + 相当于 <makevar>LIB_DEPENDS</makevar> + </row> + </tbody> + </tgroup> + </table> + + <para>组件的默认依赖关系类型如下:</para> + + <table id="lua-def-dep-types" frame="none"> + <title>默认的 <application>Lua</application> 依赖关系类型</title> + + <tgroup cols="2"> + <thead> + <row> + <entry>组件</entry> + + <entry>依赖关系类型</entry> + </row> + </thead> + + <tbody> + <row> + <entry><literal>lua</literal></entry> + + <entry>对于 <literal>4.0-5.0</literal> 是 <literal>lib</literal> + (动态连接) 而对于 <literal>5.1</literal> 则是 + <literal>build</literal> (静态连接)</entry> + </row> + + <row> + <entry><literal>tolua</literal></entry> - <para>如果您的 port 需要 Unicode 版本的 wxWidgets 函数库, 则应定义 - <literal>WX_UNICODE=yes</literal>。</para> + <entry><literal>build</literal> (静态连接)</entry> + </row> + + <row> + <entry><literal>ruby</literal></entry> + + <entry><literal>lib</literal> (动态连接)</entry> + </row> + </tbody> + </tgroup> + </table> + + <example id="lua-components-example"> + <title>选择 <application>Lua</application> 组件</title> + + <para>下面是一个使用了 + <application>Lua</application> 版本 <literal>4.0</literal> + 及其 <application>Ruby</application> 绑定的 port 片段。</para> + + <programlisting>USE_LUA= 4.0 +LUA_COMPS= lua ruby</programlisting> + </example> + </sect2> + + <sect2 id="lua-version-detection"> + <title>检测系统中已安装的版本</title> + + <para>要检测系统中已安装的版本, 您必须定义 + <makevar>WANT_LUA</makevar>。 如果没有将其设定为具体的版本, + 则组件会包含版本后缀。 在检测之后, + <makevar>HAVE_LUA</makevar> 变量将设为检测到的版本。</para> + + <example id="lua-ver-det-example"> + <title>检测已安装的 <application>Lua</application> 版本和组件</title> + + <para>下面是一个如果系统中有安装 + <application>Lua</application> 或选择了选项时使用它的 port 片段。</para> + + <programlisting>WANT_LUA= yes + +.include <bsd.port.pre.mk> - <para>下面是一个表示 port 需要 Unicode 版本的 wxWidgets 2.6 和 - contrib 函数库的例子:</para> +.if defined(WITH_LUA5) || ${HAVE_LUA:Mlua-5.[01]} != "" +USE_LUA= 5.0-5.1 +CONFIGURE_ARGS+=--enable-lua5 +.endif</programlisting> + + <para>下面的这段 port 在系统中已经有安装, 或用户选择了 + <application>tolua</application> 和 + <application>Lua</application> 支持时加以安装, 版本均选择 + <literal>4.0</literal>。</para> + + <programlisting>USE_LUA= 4.0 +LUA_COMPS= lua +WANT_LUA= 4.0 + +.include <bsd.port.pre.mk> + +.if defined(WITH_TOLUA) || ${HAVE_LUA:Mtolua} != "" +LUA_COMPS+= tolua +CONFIGURE_ARGS+=--enable-tolua +.endif</programlisting> + </example> + </sect2> + + <sect2 id="lua-defined-variables"> + <title>定义的变量</title> - <programlisting>USE_WX= 2.6 -WX_COMPS= wx contrib -WX_UNICODE= yes</programlisting> + <para>在 port 中可以使用下列变量 (在定义了 + <xref linkend="lua-ver-sel-table"> 中至少一个变量之后)。</para> + <table frame="none"> + <title>为用到 + <application>Lua</application> 的 port 定义的变量</title> + + <tgroup cols="2"> + <thead> + <row> + <entry>变量名</entry> + + <entry>说明</entry> + </row> + </thead> + + <tbody> + <row> + <entry><makevar>LUA_VER</makevar></entry> + + <entry>将要使用的 <application>Lua</application> 版本。 + (例如, <literal>5.1</literal>)</entry> + </row> + + <row> + <entry><makevar>LUA_VER_SH</makevar></entry> + <entry><application>Lua</application> 动态连接库的主版本 + (例如, <literal>1</literal>)</entry> + </row> + + <row> + <entry><makevar>LUA_VER_STR</makevar></entry> + + <entry>不带点的 <application>Lua</application> 版本 + (例如, <literal>51</literal>)</entry> + </row> + + <row> + <entry><makevar>LUA_PREFIX</makevar></entry> + + <entry>安装 <application>Lua</application> (及其组件) 使用的后缀</entry> + </row> + + <row> + <entry><makevar>LUA_SUBDIR</makevar></entry> + + <entry>在 <filename>${PREFIX}/bin</filename>、 + <filename>${PREFIX}/share</filename> 和 + <filename>${PREFIX}/lib</filename> 中用于安装 + <application>Lua</application> 的子目录</entry> + </row> + + <row> + <entry><makevar>LUA_INCDIR</makevar></entry> + + <entry>用以安装 <application>Lua</application> 和 + <application>tolua</application> 头文件的目录</entry> + </row> + + <row> + <entry><makevar>LUA_LIBDIR</makevar></entry> + + <entry>用以安装 <application>Lua</application> 和 + <application>tolua</application> 库文件的目录</entry> + </row> + + <row> + <entry><makevar>LUA_MODLIBDIR</makevar></entry> + + <entry>用以安装 <application>Lua</application> + 模块动态连接库 (<filename>.so</filename>) 的目录</entry> + </row> + + <row> + <entry><makevar>LUA_MODSHAREDIR</makevar></entry> + + <entry>用以安装 <application>Lua</application> + 模块 (<filename>.lua</filename>) 的目录</entry> + </row> + + <row> + <entry><makevar>LUA_PKGNAMEPREFIX</makevar></entry> + + <entry><application>Lua</application> 模块包的后缀名</entry> + </row> + <row> + <entry><makevar>LUA_CMD</makevar></entry> + + <entry>到 <application>Lua</application> + 解释器的路径</entry> + </row> + <row> + <entry><makevar>LUAC_CMD</makevar></entry> + + <entry>到 <application>Lua</application> + 编译器的路径</entry> + </row> + <row> + <entry><makevar>TOLUA_CMD</makevar></entry> + + <entry>到 <application>tolua</application> + 程序的路径</entry> + </row> + </tbody> + </tgroup> + </table> + + <example id="lua-variables-example"> + <title>告诉 port 到什么地方去找 + <application>Lua</application></title> + + <para>下面的 port 片段展示了如何告诉使用的 + configure 脚本去什么地方查找 <application>Lua</application> + 的头文件和库文件。</para> + + <programlisting> +USE_LUA= 4.0 +GNU_CONFIGURE= yes +CONFIGURE_ENV= CPPFLAGS="-I${LUA_INCDIR}" LDFLAGS="-L${LUA_LIBDIR}"</programlisting> + </example> + </sect2> + + <sect2 id="lua-premk"> + <title>在 <filename>bsd.port.pre.mk</filename> 时进行处理</title> + + <para>如果您需要在使用引用 <filename>bsd.port.pre.mk</filename> 之后就得到变量, + 以便将其用于执行一些命令, 需要定义 <makevar>LUA_PREMK</makevar>。</para> + + <important> + <para>如果您定义了 <makevar>LUA_PREMK</makevar>, 则在您引用 + <filename>bsd.port.pre.mk</filename> <emphasis>之后</emphasis>, + 即使修改了 <application>Lua</application> port 变量, + 版本和依赖关系也都不会随之发生变化了。</para> + </important> + + <example id="lua-premk-example"> + <title>在命令中使用 <application>Lua</application> 变量</title> + + <para>下面的片段展示了如何利用 + <makevar>LUA_PREMK</makevar>, 并运行 + <application>Lua</application> 解释器得到完整的版本串, + 将其赋值给一个变量, 并传递给程序。</para> + + <programlisting>USE_LUA= 5.0 +LUA_PREMK= yes + +.include <bsd.port.pre.mk> + +.if exists(${LUA_CMD}) +VER_STR!= ${LUA_CMD} -v + +CFLAGS+= -DLUA_VERSION_STRING="${VER_STR}" +.endif</programlisting> + </example> + + <note> + <para>在 target 中的 <application>Lua</application> 变量可以在命令中安全的使用, + 而无需使用 + <makevar>LUA_PREMK</makevar>。</para> + </note> + </sect2> </sect1> <sect1 id="rc-scripts"> @@ -6317,6 +7326,23 @@ etc/orbit.conf.sample 这一特性通常可以用于在 &man.pkg.add.1; 之后显示一些附加的安装步骤, 或显示关于授权的信息。</para> + <para>当需要显示一些编译开关或警告时, + 请使用 <makevar>ECHO_MSG</makevar>。 + <filename>pkg-message</filename> 文件只是为显示安装后的执行操作指导使用的。 + 类似地, 还需要留意 + <makevar>ECHO_MSG</makevar> 和 <makevar>ECHO_CMD</makevar> + 之间的区别。 前一个是在屏幕上显示消息性的文字, 而后一个则用于在执行命令时使用管道。</para> + + <para>下面是用到了这两个宏的例子 + <filename>shells/bash2/Makefile</filename>:</para> + + <programlisting>update-etc-shells: + @${ECHO_MSG} "updating /etc/shells" + @${CP} /etc/shells /etc/shells.bak + @( ${GREP} -v ${PREFIX}/bin/bash /etc/shells.bak; \ + ${ECHO_CMD} ${PREFIX}/bin/bash) >/etc/shells + @${RM} /etc/shells.bak</programlisting> + <note> <para><filename>pkg-message</filename> 文件, 并不需要明确地加到 <filename>pkg-plist</filename> 中。 @@ -8932,6 +9958,10 @@ Reference: <http://www.freebsd.org/ports/portaudit/74a9541d-5d6c-11d8-80e3-00 <entry>汇入 OpenSSL 0.9.8d 之后的 7.0-CURRENT。</entry> <entry>700024</entry> </row> + <row> + <entry>加入了 libelf 之后的 7.0-CURRENT。</entry> + <entry>700025</entry> + </row> </tbody> </tgroup> </table> |