<!-- $NetBSD: binary.xml,v 1.36 2023/07/13 13:29:07 rillig Exp $ -->

<chapter id="binary">
  <title>Creating binary packages</title>

  <sect1 id="building-a-single-binary-package">
    <title>Building a single binary package</title>

    <para>Once you have built and installed a package, you can create
    a <emphasis>binary package</emphasis> which can be installed on
    another system with &man.pkg.add.1;. This saves having to build
    the same package on a group of hosts and wasting CPU time. It also
    provides a simple means for others to install your package, should
    you distribute it.</para>

    <para>To create a binary package, change into the appropriate
    directory in pkgsrc, and run <command>make
    package</command>:</para>

<screen>
&uprompt; <userinput>cd misc/figlet</userinput>
&uprompt; <userinput>make package</userinput>
</screen>

    <para>This will build your package (if not already done) and package
    it into a binary package. You can then use the
    <command>pkg_*</command> tools to manipulate it. Binary packages are
    created in <varname>PACKAGES</varname>, which defaults to
    <filename>/usr/pkgsrc/packages</filename>, in the form of a compressed
    tar file. See <xref linkend="logs.package"/> for a continuation of
    the above <filename role="pkg">misc/figlet</filename>
    example.</para>

    <para>See <xref linkend="submit"/> for information on how to submit
    such a binary package.</para>
  </sect1>

  <sect1 id="settings-for-creationg-of-binary-packages">
    <title>Settings for creation of binary packages</title>

    <para>See <xref linkend="build.helpful-targets"/>.</para>
  </sect1>
</chapter>
