Annotation of htdocs/docs/pkgsrc/debug.html, revision 1.4
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">
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">
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>
27: <div class="chapter" lang="en">
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>
34: <div class="itemizedlist"><ul type="disc">
1.3 rillig 35: <li><p>Be sure to set <code class="varname">PKG_DEVELOPER=yes</code> in <a href="configuring.html#mk.conf"><code class="filename">mk.conf</code></a>.</p></li>
1.1 dsieger 36: <li>
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
39: <span><strong class="command">url2pkg</strong></span>:</p>
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>
44: <li><p>Edit the <code class="filename">Makefile</code> as requested.</p></li>
45: <li><p>Fill in the <code class="filename">DESCR</code> file</p></li>
46: <li><p>Run <span><strong class="command">make configure</strong></span></p></li>
47: <li><p>Add any dependencies glimpsed from documentation and the
48: configure step to the package's
49: <code class="filename">Makefile</code>.</p></li>
50: <li>
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
61: phase. <span><strong class="command">mkpatches</strong></span>,
62: <span><strong class="command">patchdiff</strong></span> and <span><strong class="command">pkgvi</strong></span> are
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>
66: <li><p>Look at the <code class="filename">Makefile</code>, fix if
1.4 ! rillig 67: necessary; see <a href="components.html#components.Makefile" title="11.1. Makefile">Section 11.1, “<code class="filename">Makefile</code>”</a>.</p></li>
1.1 dsieger 68: <li>
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 >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>
81: <li>
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>
87: <li>
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>
91: <li>
92: <p>Repeat the above <span><strong class="command">make print-PLIST</strong></span>
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>
96: <li>
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>
100: <li><p>Play with it. Make sure everything works.</p></li>
101: <li>
102: <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
103: reports:</p>
104: <pre class="screen"><code class="prompt">#</code> <strong class="userinput"><code>pkglint</code></strong></pre>
105: </li>
1.4 ! rillig 106: <li><p>Submit (or commit, if you have cvs access); see <a 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>