Annotation of htdocs/docs/pkgsrc/tools.html, revision 1.11

1.1       dsieger     1: <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
                      2: <html>
                      3: <head>
                      4: <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
1.5       rillig      5: <title>Chapter 18. Tools needed for building or running</title>
1.2       rillig      6: <link rel="stylesheet" href="/global.css" type="text/css">
1.1       dsieger     7: <meta name="generator" content="DocBook XSL Stylesheets VX.X.X">
                      8: <link rel="start" href="index.html" title="The pkgsrc guide">
                      9: <link rel="up" href="developers-guide.html" title="Part II. The pkgsrc developer's guide">
1.5       rillig     10: <link rel="prev" href="build.html" title="Chapter 17. The build process">
                     11: <link rel="next" href="fixes.html" title="Chapter 19. Making your package work">
1.1       dsieger    12: </head>
                     13: <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
                     14: <div class="navheader">
                     15: <table width="100%" summary="Navigation header">
1.5       rillig     16: <tr><th colspan="3" align="center">Chapter 18. Tools needed for building or running</th></tr>
1.1       dsieger    17: <tr>
                     18: <td width="20%" align="left">
                     19: <a accesskey="p" href="build.html">Prev</a> </td>
                     20: <th width="60%" align="center">Part II. The pkgsrc developer's guide</th>
                     21: <td width="20%" align="right"> <a accesskey="n" href="fixes.html">Next</a>
                     22: </td>
                     23: </tr>
                     24: </table>
                     25: <hr>
                     26: </div>
                     27: <div class="chapter" lang="en">
                     28: <div class="titlepage"><div><div><h2 class="title">
1.5       rillig     29: <a name="tools"></a>Chapter 18. Tools needed for building or running</h2></div></div></div>
1.1       dsieger    30: <div class="toc">
                     31: <p><b>Table of Contents</b></p>
                     32: <dl>
1.5       rillig     33: <dt><span class="sect1"><a href="tools.html#pkgsrc-tools">18.1. Tools for pkgsrc builds</a></span></dt>
                     34: <dt><span class="sect1"><a href="tools.html#package-tools">18.2. Tools needed by packages</a></span></dt>
                     35: <dt><span class="sect1"><a href="tools.html#platform-tools">18.3. Tools provided by platforms</a></span></dt>
                     36: <dt><span class="sect1"><a href="tools.html#tools.questions">18.4. Questions regarding the tools</a></span></dt>
1.1       dsieger    37: </dl>
                     38: </div>
                     39: <p>The <code class="varname">USE_TOOLS</code> definition is used both internally
                     40: by pkgsrc and also for individual packages to define what commands
                     41: are needed for building a package (like <code class="varname">BUILD_DEPENDS</code>)
                     42: or for later run-time of an installed packaged (such as
                     43: <code class="varname">DEPENDS</code>).
                     44: If the native system provides an adequate tool, then in many cases, a pkgsrc
                     45: package will not be used.</p>
                     46: <p>When building a package, the replacement tools are
                     47: made available in a directory (as symlinks or wrapper scripts)
                     48: that is early in the executable search path. Just like the buildlink
                     49: system, this helps with consistent builds.</p>
                     50: <p>A tool may be needed to help build a specific package. For example,
                     51: perl, GNU make (gmake) or yacc may be needed.</p>
                     52: <p>Also a tool may be needed, for example, because the native system's supplied
                     53: tool may be inefficient for building a package with pkgsrc.
                     54: For example, a package may need GNU awk, bison (instead of
                     55: yacc) or a better sed.</p>
                     56: <p>The tools used by a package can be listed by running
1.8       hubertf    57: <span class="command"><strong>make show-tools</strong></span>.</p>
1.1       dsieger    58: <div class="sect1" lang="en">
                     59: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.5       rillig     60: <a name="pkgsrc-tools"></a>18.1. Tools for pkgsrc builds</h2></div></div></div>
1.1       dsieger    61: <p>The default set of tools used by pkgsrc is defined in
                     62: <code class="filename">bsd.pkg.mk</code>. This includes standard Unix tools,
1.8       hubertf    63: such as: <span class="command"><strong>cat</strong></span>, <span class="command"><strong>awk</strong></span>,
                     64: <span class="command"><strong>chmod</strong></span>, <span class="command"><strong>test</strong></span>, and so on.
1.1       dsieger    65: These can be seen by running:
1.8       hubertf    66: <span class="command"><strong>make show-var VARNAME=USE_TOOLS</strong></span>.</p>
1.1       dsieger    67: <p>If a package needs a specific program to build
                     68: then the <code class="varname">USE_TOOLS</code> variable can be used
                     69: to define the tools needed.</p>
                     70: </div>
                     71: <div class="sect1" lang="en">
                     72: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.5       rillig     73: <a name="package-tools"></a>18.2. Tools needed by packages</h2></div></div></div>
1.1       dsieger    74: <p>In the following examples, the :pkgsrc means to use the pkgsrc version
                     75: and not the native version for a build dependency.
                     76: And the :run means that it is used for a
                     77: run-time dependencies also (and becomes a DEPENDS).
                     78: The default is a build dependency which can be set with
                     79: :build. (So in this example, it is the same as gmake:build
                     80: and pkg-config:build.)</p>
                     81: <pre class="programlisting">
                     82: USE_TOOLS+=     mktemp:pkgsrc
                     83: USE_TOOLS+=     gmake perl:run pkg-config
                     84: </pre>
                     85: <p>When using the tools framework, a
                     86: <code class="varname">TOOLS_PATH.foo</code> variable is defined
                     87: which contains the full path to the appropriate tool. For example,
                     88: <code class="varname">TOOLS_PATH.bash</code> could be &#8220;<span class="quote">/bin/bash</span>&#8221;
                     89: on Linux systems.</p>
                     90: <p>If you always need a pkgsrc version of the
                     91: tool at run-time, then just use <code class="varname">DEPENDS</code> instead.
                     92: </p>
                     93: </div>
                     94: <div class="sect1" lang="en">
                     95: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.5       rillig     96: <a name="platform-tools"></a>18.3. Tools provided by platforms</h2></div></div></div>
1.1       dsieger    97: <p>When improving or porting pkgsrc to a new platform, have a look
                     98: at (or create) the corresponding platform specific make file fragment under
                     99: <code class="filename">pkgsrc/mk/tools/tools.${OPSYS}.mk</code> which defines
                    100: the name of the common tools. For example:</p>
                    101: <pre class="programlisting">
                    102: .if exists(/usr/bin/bzcat)
                    103: TOOLS_PLATFORM.bzcat?=          /usr/bin/bzcat
                    104: .elif exists(/usr/bin/bzip2)
                    105: TOOLS_PLATFORM.bzcat?=          /usr/bin/bzip2 -cd
                    106: .endif
                    107: 
                    108: TOOLS_PLATFORM.true?=           true                    # shell builtin
                    109: </pre>
                    110: </div>
                    111: <div class="sect1" lang="en">
                    112: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.5       rillig    113: <a name="tools.questions"></a>18.4. Questions regarding the tools</h2></div></div></div>
1.1       dsieger   114: <div class="qandaset">
                    115: <dl>
1.5       rillig    116: <dt>18.4.1. <a href="tools.html#tools.new">How do I add a new tool?</a>
1.1       dsieger   117: </dt>
1.5       rillig    118: <dt>18.4.2. <a href="tools.html#tools.listall">How do I get a list of all available
1.1       dsieger   119:        tools?</a>
                    120: </dt>
1.5       rillig    121: <dt>18.4.3. <a href="tools.html#tools.used">How can I get a list of all the tools that a
1.1       dsieger   122:        package is using while being built? I want to know whether it
                    123:        uses sed or not.</a>
                    124: </dt>
                    125: </dl>
                    126: <table border="0" summary="Q and A Set">
                    127: <col align="left" width="1%">
                    128: <tbody>
                    129: <tr class="question">
                    130: <td align="left" valign="top">
1.11    ! weinem    131: <a name="tools.new"></a><a name="id2749185"></a><p><b>18.4.1.</b></p>
1.1       dsieger   132: </td>
                    133: <td align="left" valign="top"><p>How do I add a new tool?</p></td>
                    134: </tr>
                    135: <tr class="answer">
                    136: <td align="left" valign="top"></td>
                    137: <td align="left" valign="top"><p>TODO</p></td>
                    138: </tr>
                    139: <tr class="question">
                    140: <td align="left" valign="top">
1.11    ! weinem    141: <a name="tools.listall"></a><a name="id2749194"></a><p><b>18.4.2.</b></p>
1.1       dsieger   142: </td>
                    143: <td align="left" valign="top"><p>How do I get a list of all available
                    144:        tools?</p></td>
                    145: </tr>
                    146: <tr class="answer">
                    147: <td align="left" valign="top"></td>
                    148: <td align="left" valign="top"><p>TODO</p></td>
                    149: </tr>
                    150: <tr class="question">
                    151: <td align="left" valign="top">
1.11    ! weinem    152: <a name="tools.used"></a><a name="id2749205"></a><p><b>18.4.3.</b></p>
1.1       dsieger   153: </td>
                    154: <td align="left" valign="top"><p>How can I get a list of all the tools that a
                    155:        package is using while being built? I want to know whether it
                    156:        uses sed or not.</p></td>
                    157: </tr>
                    158: <tr class="answer">
                    159: <td align="left" valign="top"></td>
                    160: <td align="left" valign="top"><p>Currently, you can't. (TODO: But I want to be able
                    161:        to do it.)</p></td>
                    162: </tr>
                    163: </tbody>
                    164: </table>
                    165: </div>
                    166: </div>
                    167: </div>
                    168: <div class="navfooter">
                    169: <hr>
                    170: <table width="100%" summary="Navigation footer">
                    171: <tr>
                    172: <td width="40%" align="left">
                    173: <a accesskey="p" href="build.html">Prev</a> </td>
                    174: <td width="20%" align="center"><a accesskey="u" href="developers-guide.html">Up</a></td>
                    175: <td width="40%" align="right"> <a accesskey="n" href="fixes.html">Next</a>
                    176: </td>
                    177: </tr>
                    178: <tr>
1.5       rillig    179: <td width="40%" align="left" valign="top">Chapter 17. The build process </td>
1.1       dsieger   180: <td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td>
1.5       rillig    181: <td width="40%" align="right" valign="top"> Chapter 19. Making your package work</td>
1.1       dsieger   182: </tr>
                    183: </table>
                    184: </div>
                    185: </body>
                    186: </html>

CVSweb <webmaster@jp.NetBSD.org>