Annotation of htdocs/docs/pkgsrc/tools.html, revision 1.103
1.103 ! sevan 1: <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
1.1 dsieger 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.94 leot 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>
1.1 dsieger 36: </dl>
37: </div>
38: <p>The <code class="varname">USE_TOOLS</code> definition is used both internally
39: by pkgsrc and also for individual packages to define what commands
40: are needed for building a package (like <code class="varname">BUILD_DEPENDS</code>)
41: or for later run-time of an installed packaged (such as
42: <code class="varname">DEPENDS</code>).
43: If the native system provides an adequate tool, then in many cases, a pkgsrc
44: package will not be used.</p>
45: <p>When building a package, the replacement tools are
46: made available in a directory (as symlinks or wrapper scripts)
47: that is early in the executable search path. Just like the buildlink
48: system, this helps with consistent builds.</p>
49: <p>A tool may be needed to help build a specific package. For example,
50: perl, GNU make (gmake) or yacc may be needed.</p>
51: <p>Also a tool may be needed, for example, because the native system's supplied
52: tool may be inefficient for building a package with pkgsrc.
53: For example, a package may need GNU awk, bison (instead of
54: yacc) or a better sed.</p>
55: <p>The tools used by a package can be listed by running
1.8 hubertf 56: <span class="command"><strong>make show-tools</strong></span>.</p>
1.39 asau 57: <div class="sect1">
1.1 dsieger 58: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.5 rillig 59: <a name="pkgsrc-tools"></a>18.1. Tools for pkgsrc builds</h2></div></div></div>
1.1 dsieger 60: <p>The default set of tools used by pkgsrc is defined in
61: <code class="filename">bsd.pkg.mk</code>. This includes standard Unix tools,
1.8 hubertf 62: such as: <span class="command"><strong>cat</strong></span>, <span class="command"><strong>awk</strong></span>,
63: <span class="command"><strong>chmod</strong></span>, <span class="command"><strong>test</strong></span>, and so on.
1.1 dsieger 64: These can be seen by running:
1.8 hubertf 65: <span class="command"><strong>make show-var VARNAME=USE_TOOLS</strong></span>.</p>
1.1 dsieger 66: <p>If a package needs a specific program to build
67: then the <code class="varname">USE_TOOLS</code> variable can be used
68: to define the tools needed.</p>
69: </div>
1.39 asau 70: <div class="sect1">
1.1 dsieger 71: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.5 rillig 72: <a name="package-tools"></a>18.2. Tools needed by packages</h2></div></div></div>
1.26 wiz 73: <p>In the following examples, the :run means that it is needed at
74: run-time (and becomes a DEPENDS).
1.1 dsieger 75: The default is a build dependency which can be set with
76: :build. (So in this example, it is the same as gmake:build
77: and pkg-config:build.)</p>
78: <pre class="programlisting">
79: USE_TOOLS+= gmake perl:run pkg-config
80: </pre>
81: <p>When using the tools framework, a
82: <code class="varname">TOOLS_PATH.foo</code> variable is defined
83: which contains the full path to the appropriate tool. For example,
1.21 wiz 84: <code class="varname">TOOLS_PATH.bash</code> could be <span class="quote">“<span class="quote">/bin/bash</span>”</span>
1.1 dsieger 85: on Linux systems.</p>
86: <p>If you always need a pkgsrc version of the
87: tool at run-time, then just use <code class="varname">DEPENDS</code> instead.
88: </p>
89: </div>
1.39 asau 90: <div class="sect1">
1.1 dsieger 91: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.5 rillig 92: <a name="platform-tools"></a>18.3. Tools provided by platforms</h2></div></div></div>
1.1 dsieger 93: <p>When improving or porting pkgsrc to a new platform, have a look
94: at (or create) the corresponding platform specific make file fragment under
95: <code class="filename">pkgsrc/mk/tools/tools.${OPSYS}.mk</code> which defines
96: the name of the common tools. For example:</p>
97: <pre class="programlisting">
98: .if exists(/usr/bin/bzcat)
99: TOOLS_PLATFORM.bzcat?= /usr/bin/bzcat
100: .elif exists(/usr/bin/bzip2)
101: TOOLS_PLATFORM.bzcat?= /usr/bin/bzip2 -cd
102: .endif
103:
104: TOOLS_PLATFORM.true?= true # shell builtin
105: </pre>
106: </div>
107: </div>
108: <div class="navfooter">
109: <hr>
110: <table width="100%" summary="Navigation footer">
111: <tr>
112: <td width="40%" align="left">
113: <a accesskey="p" href="build.html">Prev</a> </td>
114: <td width="20%" align="center"><a accesskey="u" href="developers-guide.html">Up</a></td>
115: <td width="40%" align="right"> <a accesskey="n" href="fixes.html">Next</a>
116: </td>
117: </tr>
118: <tr>
1.5 rillig 119: <td width="40%" align="left" valign="top">Chapter 17. The build process </td>
1.1 dsieger 120: <td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td>
1.5 rillig 121: <td width="40%" align="right" valign="top"> Chapter 19. Making your package work</td>
1.1 dsieger 122: </tr>
123: </table>
124: </div>
125: </body>
126: </html>
CVSweb <webmaster@jp.NetBSD.org>