Annotation of htdocs/docs/pkgsrc/tools.html, revision 1.22
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">
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.21 wiz 27: <div class="chapter" title="Chapter 18. Tools needed for building or running">
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>
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.21 wiz 58: <div class="sect1" title="18.1. Tools for pkgsrc builds">
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.21 wiz 71: <div class="sect1" title="18.2. Tools needed by packages">
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.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,
1.21 wiz 88: <code class="varname">TOOLS_PATH.bash</code> could be <span class="quote">“<span class="quote">/bin/bash</span>”</span>
1.1 dsieger 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>
1.21 wiz 94: <div class="sect1" title="18.3. Tools provided by platforms">
1.1 dsieger 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>
1.21 wiz 111: <div class="sect1" title="18.4. Questions regarding the tools">
1.1 dsieger 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.21 wiz 114: <div class="qandaset" title="Frequently Asked Questions">
1.22 ! wiz 115: <a name="id1168229329564"></a><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>
1.21 wiz 126: <table border="0" width="100%" summary="Q and A Set">
1.1 dsieger 127: <col align="left" width="1%">
1.21 wiz 128: <col>
1.1 dsieger 129: <tbody>
1.21 wiz 130: <tr class="question" title="18.4.1.">
1.1 dsieger 131: <td align="left" valign="top">
1.22 ! wiz 132: <a name="tools.new"></a><a name="id1168229329568"></a><p><b>18.4.1.</b></p>
1.1 dsieger 133: </td>
134: <td align="left" valign="top"><p>How do I add a new tool?</p></td>
135: </tr>
136: <tr class="answer">
137: <td align="left" valign="top"></td>
138: <td align="left" valign="top"><p>TODO</p></td>
139: </tr>
1.21 wiz 140: <tr class="question" title="18.4.2.">
1.1 dsieger 141: <td align="left" valign="top">
1.22 ! wiz 142: <a name="tools.listall"></a><a name="id1168229329576"></a><p><b>18.4.2.</b></p>
1.1 dsieger 143: </td>
144: <td align="left" valign="top"><p>How do I get a list of all available
145: tools?</p></td>
146: </tr>
147: <tr class="answer">
148: <td align="left" valign="top"></td>
149: <td align="left" valign="top"><p>TODO</p></td>
150: </tr>
1.21 wiz 151: <tr class="question" title="18.4.3.">
1.1 dsieger 152: <td align="left" valign="top">
1.22 ! wiz 153: <a name="tools.used"></a><a name="id1168229329585"></a><p><b>18.4.3.</b></p>
1.1 dsieger 154: </td>
155: <td align="left" valign="top"><p>How can I get a list of all the tools that a
156: package is using while being built? I want to know whether it
157: uses sed or not.</p></td>
158: </tr>
159: <tr class="answer">
160: <td align="left" valign="top"></td>
161: <td align="left" valign="top"><p>Currently, you can't. (TODO: But I want to be able
162: to do it.)</p></td>
163: </tr>
164: </tbody>
165: </table>
166: </div>
167: </div>
168: </div>
169: <div class="navfooter">
170: <hr>
171: <table width="100%" summary="Navigation footer">
172: <tr>
173: <td width="40%" align="left">
174: <a accesskey="p" href="build.html">Prev</a> </td>
175: <td width="20%" align="center"><a accesskey="u" href="developers-guide.html">Up</a></td>
176: <td width="40%" align="right"> <a accesskey="n" href="fixes.html">Next</a>
177: </td>
178: </tr>
179: <tr>
1.5 rillig 180: <td width="40%" align="left" valign="top">Chapter 17. The build process </td>
1.1 dsieger 181: <td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td>
1.5 rillig 182: <td width="40%" align="right" valign="top"> Chapter 19. Making your package work</td>
1.1 dsieger 183: </tr>
184: </table>
185: </div>
186: </body>
187: </html>
CVSweb <webmaster@jp.NetBSD.org>