Annotation of htdocs/docs/pkgsrc/debug.html, revision 1.7

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.4       rillig      5: <title>Chapter 20. Debugging</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.6       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.4       rillig     10: <link rel="prev" href="fixes.html" title="Chapter 19. Making your package work">
                     11: <link rel="next" href="submit.html" title="Chapter 21. Submitting and Committing">
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.4       rillig     16: <tr><th colspan="3" align="center">Chapter 20. Debugging</th></tr>
1.1       dsieger    17: <tr>
                     18: <td width="20%" align="left">
                     19: <a accesskey="p" href="fixes.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="submit.html">Next</a>
                     22: </td>
                     23: </tr>
                     24: </table>
                     25: <hr>
                     26: </div>
1.7     ! wiz        27: <div class="chapter" title="Chapter 20. Debugging">
1.1       dsieger    28: <div class="titlepage"><div><div><h2 class="title">
1.4       rillig     29: <a name="debug"></a>Chapter 20. Debugging</h2></div></div></div>
1.1       dsieger    30: <p>To check out all the gotchas when building a package, here are
                     31:   the steps that I do in order to get a package working.  Please note
                     32:   this is basically the same as what was explained in the previous
                     33:   sections, only with some debugging aids.</p>
1.7     ! wiz        34: <div class="itemizedlist"><ul class="itemizedlist" type="disc">
        !            35: <li class="listitem"><p>Be sure to set <code class="varname">PKG_DEVELOPER=yes</code> in <a class="link" href="configuring.html#mk.conf"><code class="filename">mk.conf</code></a>.</p></li>
        !            36: <li class="listitem">
1.1       dsieger    37: <p>Install <a href="ftp://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc/pkgtools/url2pkg/README.html" target="_top"><code class="filename">pkgtools/url2pkg</code></a>,
                     38:       create a directory for a new package, change into it, then run
1.5       hubertf    39:       <span class="command"><strong>url2pkg</strong></span>:</p>
1.1       dsieger    40: <pre class="screen"><code class="prompt">%</code> <strong class="userinput"><code>mkdir /usr/pkgsrc/<em class="replaceable"><code>category</code></em>/<em class="replaceable"><code>examplepkg</code></em></code></strong>
                     41: <code class="prompt">%</code> <strong class="userinput"><code>cd /usr/pkgsrc/<em class="replaceable"><code>category</code></em>/<em class="replaceable"><code>examplepkg</code></em></code></strong>
                     42: <code class="prompt">%</code> <strong class="userinput"><code>url2pkg http://www.example.com/path/to/distfile.tar.gz</code></strong></pre>
                     43: </li>
1.7     ! wiz        44: <li class="listitem"><p>Edit the <code class="filename">Makefile</code> as requested.</p></li>
        !            45: <li class="listitem"><p>Fill in the <code class="filename">DESCR</code> file</p></li>
        !            46: <li class="listitem"><p>Run <span class="command"><strong>make configure</strong></span></p></li>
        !            47: <li class="listitem"><p>Add any dependencies glimpsed from documentation and the
1.1       dsieger    48:       configure step to the package's
                     49:       <code class="filename">Makefile</code>.</p></li>
1.7     ! wiz        50: <li class="listitem">
1.1       dsieger    51: <p>Make the package compile, doing multiple rounds of</p>
                     52: <pre class="screen"><code class="prompt">%</code> <strong class="userinput"><code>make</code></strong>
                     53: <code class="prompt">%</code> <strong class="userinput"><code>pkgvi ${WRKSRC}/some/file/that/does/not/compile</code></strong>
                     54: <code class="prompt">%</code> <strong class="userinput"><code>mkpatches</code></strong>
                     55: <code class="prompt">%</code> <strong class="userinput"><code>patchdiff</code></strong>
                     56: <code class="prompt">%</code> <strong class="userinput"><code>mv ${WRKDIR}/.newpatches/* patches</code></strong>
                     57: <code class="prompt">%</code> <strong class="userinput"><code>make mps</code></strong>
                     58: <code class="prompt">%</code> <strong class="userinput"><code>make clean</code></strong></pre>
                     59: <p>Doing this step as non-root user will ensure that no files
                     60:       are modified that shouldn't be, especially during the build
1.5       hubertf    61:       phase.  <span class="command"><strong>mkpatches</strong></span>,
                     62:       <span class="command"><strong>patchdiff</strong></span> and <span class="command"><strong>pkgvi</strong></span> are
1.1       dsieger    63:       from the <a href="ftp://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc/pkgtools/pkgdiff/README.html" target="_top"><code class="filename">pkgtools/pkgdiff</code></a>
                     64:       package.</p>
                     65: </li>
1.7     ! wiz        66: <li class="listitem"><p>Look at the <code class="filename">Makefile</code>, fix if
        !            67:       necessary; see <a class="xref" href="components.html#components.Makefile" title="11.1. Makefile">Section 11.1, &#8220;<code class="filename">Makefile</code>&#8221;</a>.</p></li>
        !            68: <li class="listitem">
1.1       dsieger    69: <p>Generate a <code class="filename">PLIST</code>:</p>
                     70: <pre class="screen"><code class="prompt">#</code> <strong class="userinput"><code>make install</code></strong>
                     71: <code class="prompt">#</code> <strong class="userinput"><code>make print-PLIST &gt;PLIST</code></strong>
                     72: <code class="prompt">#</code> <strong class="userinput"><code>make deinstall</code></strong>
                     73: <code class="prompt">#</code> <strong class="userinput"><code>make install</code></strong>
                     74: <code class="prompt">#</code> <strong class="userinput"><code>make deinstall</code></strong></pre>
                     75: <p>You usually need to be <code class="username">root</code> to do
                     76:       this.  Look if there are any files left:</p>
                     77: <pre class="screen"><code class="prompt">#</code> <strong class="userinput"><code>make print-PLIST</code></strong></pre>
                     78: <p>If this reveals any files that are missing in
                     79:       <code class="filename">PLIST</code>, add them.</p>
                     80: </li>
1.7     ! wiz        81: <li class="listitem">
1.1       dsieger    82: <p>Now that the <code class="filename">PLIST</code> is OK, install the
                     83:       package again and make a binary package:</p>
                     84: <pre class="screen"><code class="prompt">#</code> <strong class="userinput"><code>make reinstall</code></strong>
                     85: <code class="prompt">#</code> <strong class="userinput"><code>make package</code></strong></pre>
                     86: </li>
1.7     ! wiz        87: <li class="listitem">
1.1       dsieger    88: <p>Delete the installed package:</p>
                     89: <pre class="screen"><code class="prompt">#</code> <strong class="userinput"><code>pkg_delete <em class="replaceable"><code>examplepkg</code></em></code></strong></pre>
                     90: </li>
1.7     ! wiz        91: <li class="listitem">
1.5       hubertf    92: <p>Repeat the above <span class="command"><strong>make print-PLIST</strong></span>
1.1       dsieger    93:       command, which shouldn't find anything now:</p>
                     94: <pre class="screen"><code class="prompt">#</code> <strong class="userinput"><code>make print-PLIST</code></strong></pre>
                     95: </li>
1.7     ! wiz        96: <li class="listitem">
1.1       dsieger    97: <p>Reinstall the binary package:</p>
                     98: <pre class="screen"><code class="prompt">#</code> <strong class="userinput"><code>pkg_add .../<em class="replaceable"><code>examplepkg</code></em>.tgz</code></strong></pre>
                     99: </li>
1.7     ! wiz       100: <li class="listitem"><p>Play with it.  Make sure everything works.</p></li>
        !           101: <li class="listitem">
1.5       hubertf   102: <p>Run <span class="command"><strong>pkglint</strong></span> from <a href="ftp://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc/pkgtools/pkglint/README.html" target="_top"><code class="filename">pkgtools/pkglint</code></a>, and fix the problems it
1.1       dsieger   103:       reports:</p>
                    104: <pre class="screen"><code class="prompt">#</code> <strong class="userinput"><code>pkglint</code></strong></pre>
                    105: </li>
1.7     ! wiz       106: <li class="listitem"><p>Submit (or commit, if you have cvs access); see <a class="xref" href="submit.html" title="Chapter 21. Submitting and Committing">Chapter 21, <i>Submitting and Committing</i></a>.</p></li>
1.1       dsieger   107: </ul></div>
                    108: </div>
                    109: <div class="navfooter">
                    110: <hr>
                    111: <table width="100%" summary="Navigation footer">
                    112: <tr>
                    113: <td width="40%" align="left">
                    114: <a accesskey="p" href="fixes.html">Prev</a> </td>
                    115: <td width="20%" align="center"><a accesskey="u" href="developers-guide.html">Up</a></td>
                    116: <td width="40%" align="right"> <a accesskey="n" href="submit.html">Next</a>
                    117: </td>
                    118: </tr>
                    119: <tr>
1.4       rillig    120: <td width="40%" align="left" valign="top">Chapter 19. Making your package work </td>
1.1       dsieger   121: <td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td>
1.4       rillig    122: <td width="40%" align="right" valign="top"> Chapter 21. Submitting and Committing</td>
1.1       dsieger   123: </tr>
                    124: </table>
                    125: </div>
                    126: </body>
                    127: </html>

CVSweb <webmaster@jp.NetBSD.org>