Annotation of htdocs/docs/pkgsrc/tools.html, revision 1.1
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">
! 5: <title>Chapter 17. Tools needed for building or running</title>
! 6: <link rel="stylesheet" href="/NetBSD.css" type="text/css">
! 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">
! 10: <link rel="prev" href="build.html" title="Chapter 16. The build process">
! 11: <link rel="next" href="fixes.html" title="Chapter 18. Making your package work">
! 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">
! 16: <tr><th colspan="3" align="center">Chapter 17. Tools needed for building or running</th></tr>
! 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">
! 29: <a name="tools"></a>Chapter 17. Tools needed for building or running</h2></div></div></div>
! 30: <div class="toc">
! 31: <p><b>Table of Contents</b></p>
! 32: <dl>
! 33: <dt><span class="sect1"><a href="tools.html#pkgsrc-tools">17.1. Tools for pkgsrc builds</a></span></dt>
! 34: <dt><span class="sect1"><a href="tools.html#package-tools">17.2. Tools needed by packages</a></span></dt>
! 35: <dt><span class="sect1"><a href="tools.html#platform-tools">17.3. Tools provided by platforms</a></span></dt>
! 36: <dt><span class="sect1"><a href="tools.html#tools.questions">17.4. Questions regarding the tools</a></span></dt>
! 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
! 57: <span><strong class="command">make show-tools</strong></span>.</p>
! 58: <div class="sect1" lang="en">
! 59: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
! 60: <a name="pkgsrc-tools"></a>17.1. Tools for pkgsrc builds</h2></div></div></div>
! 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,
! 63: such as: <span><strong class="command">cat</strong></span>, <span><strong class="command">awk</strong></span>,
! 64: <span><strong class="command">chmod</strong></span>, <span><strong class="command">test</strong></span>, and so on.
! 65: These can be seen by running:
! 66: <span><strong class="command">make show-var VARNAME=USE_TOOLS</strong></span>.</p>
! 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">
! 73: <a name="package-tools"></a>17.2. Tools needed by packages</h2></div></div></div>
! 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 “<span class="quote">/bin/bash</span>”
! 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">
! 96: <a name="platform-tools"></a>17.3. Tools provided by platforms</h2></div></div></div>
! 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">
! 113: <a name="tools.questions"></a>17.4. Questions regarding the tools</h2></div></div></div>
! 114: <div class="qandaset">
! 115: <dl>
! 116: <dt>17.4.1. <a href="tools.html#tools.new">How do I add a new tool?</a>
! 117: </dt>
! 118: <dt>17.4.2. <a href="tools.html#tools.listall">How do I get a list of all available
! 119: tools?</a>
! 120: </dt>
! 121: <dt>17.4.3. <a href="tools.html#tools.used">How can I get a list of all the tools that a
! 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">
! 131: <a name="tools.new"></a><a name="id2728788"></a><b>17.4.1.</b>
! 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">
! 141: <a name="tools.listall"></a><a name="id2728797"></a><b>17.4.2.</b>
! 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">
! 152: <a name="tools.used"></a><a name="id2728808"></a><b>17.4.3.</b>
! 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>
! 179: <td width="40%" align="left" valign="top">Chapter 16. The build process </td>
! 180: <td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td>
! 181: <td width="40%" align="right" valign="top"> Chapter 18. Making your package work</td>
! 182: </tr>
! 183: </table>
! 184: </div>
! 185: </body>
! 186: </html>
CVSweb <webmaster@jp.NetBSD.org>