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

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

CVSweb <webmaster@jp.NetBSD.org>