pkgsrc/doc/guide/files/tools.xml
wiz cc4a40a5fd Undocument :pkgsrc in USE_TOOLS. Description was incorrect and it should
not be used by packagers anyway. Addresses PR 45538 by Sergey Svishchev.
2011-10-30 22:08:17 +00:00

125 lines
4 KiB
XML

<!-- $NetBSD: tools.xml,v 1.6 2011/10/30 22:08:17 wiz Exp $ -->
<chapter id="tools">
<title>Tools needed for building or running</title>
<para>The <varname>USE_TOOLS</varname> definition is used both internally
by pkgsrc and also for individual packages to define what commands
are needed for building a package (like <varname>BUILD_DEPENDS</varname>)
or for later run-time of an installed packaged (such as
<varname>DEPENDS</varname>).
If the native system provides an adequate tool, then in many cases, a pkgsrc
package will not be used.</para>
<para>When building a package, the replacement tools are
made available in a directory (as symlinks or wrapper scripts)
that is early in the executable search path. Just like the buildlink
system, this helps with consistent builds.</para>
<para>A tool may be needed to help build a specific package. For example,
perl, GNU make (gmake) or yacc may be needed.</para>
<para>Also a tool may be needed, for example, because the native system's supplied
tool may be inefficient for building a package with pkgsrc.
For example, a package may need GNU awk, bison (instead of
yacc) or a better sed.</para>
<para>The tools used by a package can be listed by running
<command>make show-tools</command>.</para>
<sect1 id="pkgsrc-tools">
<title>Tools for pkgsrc builds</title>
<para>The default set of tools used by pkgsrc is defined in
<filename>bsd.pkg.mk</filename>. This includes standard Unix tools,
such as: <command>cat</command>, <command>awk</command>,
<command>chmod</command>, <command>test</command>, and so on.
These can be seen by running:
<command>make show-var VARNAME=USE_TOOLS</command>.</para>
<para>If a package needs a specific program to build
then the <varname>USE_TOOLS</varname> variable can be used
to define the tools needed.</para>
</sect1>
<sect1 id="package-tools">
<title>Tools needed by packages</title>
<para>In the following examples, the :run means that it is needed at
run-time (and becomes a DEPENDS).
The default is a build dependency which can be set with
:build. (So in this example, it is the same as gmake:build
and pkg-config:build.)</para>
<programlisting>
USE_TOOLS+= gmake perl:run pkg-config
</programlisting>
<para>When using the tools framework, a
<varname>TOOLS_PATH.foo</varname> variable is defined
which contains the full path to the appropriate tool. For example,
<varname>TOOLS_PATH.bash</varname> could be <quote>/bin/bash</quote>
on Linux systems.</para>
<para>If you always need a pkgsrc version of the
tool at run-time, then just use <varname>DEPENDS</varname> instead.
<!-- jlam said: This is not to
say that we can't extend the tools framework to do that, but it hasn't been
something that's come up frequently enough to make it worthwhile to do.
--></para>
</sect1>
<sect1 id="platform-tools">
<title>Tools provided by platforms</title>
<para>When improving or porting pkgsrc to a new platform, have a look
at (or create) the corresponding platform specific make file fragment under
<filename>pkgsrc/mk/tools/tools.${OPSYS}.mk</filename> which defines
the name of the common tools. For example:</para>
<programlisting>
.if exists(/usr/bin/bzcat)
TOOLS_PLATFORM.bzcat?= /usr/bin/bzcat
.elif exists(/usr/bin/bzip2)
TOOLS_PLATFORM.bzcat?= /usr/bin/bzip2 -cd
.endif
TOOLS_PLATFORM.true?= true # shell builtin
</programlisting>
</sect1>
<sect1 id="tools.questions">
<title>Questions regarding the tools</title>
<qandaset>
<qandaentry id="tools.new">
<question><para>How do I add a new tool?</para></question>
<answer><para>TODO</para></answer>
</qandaentry>
<qandaentry id="tools.listall">
<question><para>How do I get a list of all available
tools?</para></question>
<answer><para>TODO</para></answer>
</qandaentry>
<qandaentry id="tools.used">
<question><para>How can I get a list of all the tools that a
package is using while being built? I want to know whether it
uses sed or not.</para></question>
<answer><para>Currently, you can't. (TODO: But I want to be able
to do it.)</para></answer>
</qandaentry>
</qandaset>
</sect1>
</chapter>