Annotation of htdocs/docs/pkgsrc/tools.html, revision 1.84
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.23 spz 6: <link rel="stylesheet" type="text/css" href="/global.css">
1.1 dsieger 7: <meta name="generator" content="DocBook XSL Stylesheets VX.X.X">
1.13 rillig 8: <link rel="home" href="index.html" title="The pkgsrc guide">
1.1 dsieger 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>
1.39 asau 27: <div class="chapter">
1.1 dsieger 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>
1.79 wiz 32: <dl class="toc">
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.39 asau 58: <div class="sect1">
1.1 dsieger 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>
1.39 asau 71: <div class="sect1">
1.1 dsieger 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.26 wiz 74: <p>In the following examples, the :run means that it is needed at
75: run-time (and becomes a DEPENDS).
1.1 dsieger 76: The default is a build dependency which can be set with
77: :build. (So in this example, it is the same as gmake:build
78: and pkg-config:build.)</p>
79: <pre class="programlisting">
80: USE_TOOLS+= gmake perl:run pkg-config
81: </pre>
82: <p>When using the tools framework, a
83: <code class="varname">TOOLS_PATH.foo</code> variable is defined
84: which contains the full path to the appropriate tool. For example,
1.21 wiz 85: <code class="varname">TOOLS_PATH.bash</code> could be <span class="quote">“<span class="quote">/bin/bash</span>”</span>
1.1 dsieger 86: on Linux systems.</p>
87: <p>If you always need a pkgsrc version of the
88: tool at run-time, then just use <code class="varname">DEPENDS</code> instead.
89: </p>
90: </div>
1.39 asau 91: <div class="sect1">
1.1 dsieger 92: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.5 rillig 93: <a name="platform-tools"></a>18.3. Tools provided by platforms</h2></div></div></div>
1.1 dsieger 94: <p>When improving or porting pkgsrc to a new platform, have a look
95: at (or create) the corresponding platform specific make file fragment under
96: <code class="filename">pkgsrc/mk/tools/tools.${OPSYS}.mk</code> which defines
97: the name of the common tools. For example:</p>
98: <pre class="programlisting">
99: .if exists(/usr/bin/bzcat)
100: TOOLS_PLATFORM.bzcat?= /usr/bin/bzcat
101: .elif exists(/usr/bin/bzip2)
102: TOOLS_PLATFORM.bzcat?= /usr/bin/bzip2 -cd
103: .endif
104:
105: TOOLS_PLATFORM.true?= true # shell builtin
106: </pre>
107: </div>
1.39 asau 108: <div class="sect1">
1.1 dsieger 109: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.5 rillig 110: <a name="tools.questions"></a>18.4. Questions regarding the tools</h2></div></div></div>
1.39 asau 111: <div class="qandaset">
1.84 ! tnn 112: <a name="idm75033168"></a><dl>
1.5 rillig 113: <dt>18.4.1. <a href="tools.html#tools.new">How do I add a new tool?</a>
1.1 dsieger 114: </dt>
1.5 rillig 115: <dt>18.4.2. <a href="tools.html#tools.listall">How do I get a list of all available
1.1 dsieger 116: tools?</a>
117: </dt>
1.5 rillig 118: <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 119: package is using while being built? I want to know whether it
120: uses sed or not.</a>
121: </dt>
122: </dl>
1.39 asau 123: <table border="0" style="width: 100%;">
124: <colgroup>
1.1 dsieger 125: <col align="left" width="1%">
1.21 wiz 126: <col>
1.39 asau 127: </colgroup>
1.1 dsieger 128: <tbody>
1.39 asau 129: <tr class="question">
1.1 dsieger 130: <td align="left" valign="top">
1.84 ! tnn 131: <a name="tools.new"></a><a name="idm75032784"></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>
1.39 asau 139: <tr class="question">
1.1 dsieger 140: <td align="left" valign="top">
1.84 ! tnn 141: <a name="tools.listall"></a><a name="idm75015248"></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>
1.39 asau 150: <tr class="question">
1.1 dsieger 151: <td align="left" valign="top">
1.84 ! tnn 152: <a name="tools.used"></a><a name="idm75014224"></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>