Annotation of htdocs/docs/pkgsrc/examples.html, revision 1.29
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>Appendix A. A simple example package: bison</title>
1.26 spz 6: <link rel="stylesheet" type="text/css" href="/global.css">
1.1 dsieger 7: <meta name="generator" content="DocBook XSL Stylesheets VX.X.X">
1.15 rillig 8: <link rel="home" href="index.html" title="The pkgsrc guide">
1.1 dsieger 9: <link rel="up" href="index.html" title="The pkgsrc guide">
1.6 rillig 10: <link rel="prev" href="porting.html" title="Chapter 26. Porting pkgsrc">
1.1 dsieger 11: <link rel="next" href="logs.html" title="Appendix B. Build logs">
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">Appendix A. A simple example package: bison</th></tr>
17: <tr>
18: <td width="20%" align="left">
19: <a accesskey="p" href="porting.html">Prev</a> </td>
20: <th width="60%" align="center"> </th>
21: <td width="20%" align="right"> <a accesskey="n" href="logs.html">Next</a>
22: </td>
23: </tr>
24: </table>
25: <hr>
26: </div>
1.24 wiz 27: <div class="appendix" title="Appendix A. A simple example package: bison">
1.1 dsieger 28: <div class="titlepage"><div><div><h2 class="title">
29: <a name="examples"></a>Appendix A. A simple example package: bison</h2></div></div></div>
30: <div class="toc">
31: <p><b>Table of Contents</b></p>
32: <dl>
33: <dt><span class="sect1"><a href="examples.html#example-files">A.1. files</a></span></dt>
34: <dd><dl>
35: <dt><span class="sect2"><a href="examples.html#example-Makefile">A.1.1. Makefile</a></span></dt>
36: <dt><span class="sect2"><a href="examples.html#example-descr">A.1.2. DESCR</a></span></dt>
37: <dt><span class="sect2"><a href="examples.html#example-plist">A.1.3. PLIST</a></span></dt>
1.24 wiz 38: <dt><span class="sect2"><a href="examples.html#checking-package-with-pkglint">A.1.4. Checking a package with <span class="command"><strong>pkglint</strong></span></a></span></dt>
1.1 dsieger 39: </dl></dd>
40: <dt><span class="sect1"><a href="examples.html#steps-for-b-i-p">A.2. Steps for building, installing, packaging</a></span></dt>
41: </dl>
42: </div>
43: <p>We checked to find a piece of software that wasn't in the packages
44: collection, and picked GNU bison. Quite why someone would want to have
1.10 hubertf 45: <span class="command"><strong>bison</strong></span> when Berkeley <span class="command"><strong>yacc</strong></span> is already
1.1 dsieger 46: present in the tree is beyond us, but it's useful for the purposes of
47: this exercise.</p>
1.24 wiz 48: <div class="sect1" title="A.1. files">
1.1 dsieger 49: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
50: <a name="example-files"></a>A.1. files</h2></div></div></div>
1.24 wiz 51: <div class="sect2" title="A.1.1. Makefile">
1.1 dsieger 52: <div class="titlepage"><div><div><h3 class="title">
53: <a name="example-Makefile"></a>A.1.1. Makefile</h3></div></div></div>
54: <pre class="programlisting">
55: # $NetBSD$
56: #
57:
58: DISTNAME= bison-1.25
59: CATEGORIES= devel
60: MASTER_SITES= ${MASTER_SITE_GNU}
61:
62: MAINTAINER= thorpej@NetBSD.org
63: HOMEPAGE= http://www.gnu.org/software/bison/bison.html
64: COMMENT= GNU yacc clone
65:
66: GNU_CONFIGURE= yes
67: INFO_FILES= bison.info
68:
69: .include "../../mk/bsd.pkg.mk"
70: </pre>
71: </div>
1.24 wiz 72: <div class="sect2" title="A.1.2. DESCR">
1.1 dsieger 73: <div class="titlepage"><div><div><h3 class="title">
74: <a name="example-descr"></a>A.1.2. DESCR</h3></div></div></div>
75: <pre class="programlisting">
76: GNU version of yacc. Can make re-entrant parsers, and numerous other
1.10 hubertf 77: improvements. Why you would want this when Berkeley <a class="citerefentry" href="http://netbsd.gw.com/cgi-bin/man-cgi?yacc+1+NetBSD-current"><span class="citerefentry"><span class="refentrytitle">yacc</span>(1)</span></a> is part
1.1 dsieger 78: of the NetBSD source tree is beyond me.
79: </pre>
80: </div>
1.24 wiz 81: <div class="sect2" title="A.1.3. PLIST">
1.1 dsieger 82: <div class="titlepage"><div><div><h3 class="title">
83: <a name="example-plist"></a>A.1.3. PLIST</h3></div></div></div>
84: <pre class="programlisting">
85: @comment $NetBSD$
86: bin/bison
87: man/man1/bison.1.gz
88: share/bison.simple
89: share/bison.hairy
90: </pre>
91: </div>
1.24 wiz 92: <div class="sect2" title="A.1.4. Checking a package with pkglint">
1.1 dsieger 93: <div class="titlepage"><div><div><h3 class="title">
1.10 hubertf 94: <a name="checking-package-with-pkglint"></a>A.1.4. Checking a package with <span class="command"><strong>pkglint</strong></span>
1.1 dsieger 95: </h3></div></div></div>
96: <p>The NetBSD package system comes with
97: <a href="ftp://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc/pkgtools/pkglint/README.html" target="_top"><code class="filename">pkgtools/pkglint</code></a>
98: which helps to check the contents of these
99: files. After installation it is quite easy to use, just change to the
100: directory of the package you wish to examine and execute
1.10 hubertf 101: <span class="command"><strong>pkglint</strong></span>:</p>
1.1 dsieger 102: <pre class="screen"><code class="prompt">$</code> <strong class="userinput"><code>pkglint</code></strong>
103: looks fine.</pre>
104: <p>Depending on the supplied command line arguments (see pkglint(1)),
1.10 hubertf 105: more checks will be performed. Use e.g. <span class="command"><strong>pkglint -Call
1.1 dsieger 106: -Wall</strong></span> for a very thorough check.</p>
107: </div>
108: </div>
1.24 wiz 109: <div class="sect1" title="A.2. Steps for building, installing, packaging">
1.1 dsieger 110: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
111: <a name="steps-for-b-i-p"></a>A.2. Steps for building, installing, packaging</h2></div></div></div>
112: <p>Create the directory where the package lives,
113: plus any auxiliary directories:</p>
114: <pre class="screen"><code class="prompt">#</code> <strong class="userinput"><code>cd /usr/pkgsrc/lang</code></strong>
115: <code class="prompt">#</code> <strong class="userinput"><code>mkdir bison</code></strong>
116: <code class="prompt">#</code> <strong class="userinput"><code>cd bison</code></strong>
117: <code class="prompt">#</code> <strong class="userinput"><code>mkdir patches</code></strong></pre>
118: <p>Create <code class="filename">Makefile</code>, <code class="filename">DESCR</code> and
1.10 hubertf 119: <code class="filename">PLIST</code> (see <a class="xref" href="components.html" title="Chapter 11. Package components - files, directories and contents">Chapter 11, <i>Package components - files, directories and contents</i></a>)
1.1 dsieger 120: then continue with fetching the distfile:</p>
121: <pre class="screen"><code class="prompt">#</code> <strong class="userinput"><code>make fetch</code></strong>
122: >> bison-1.25.tar.gz doesn't seem to exist on this system.
123: >> Attempting to fetch from ftp://prep.ai.mit.edu/pub/gnu//.
124: Requesting ftp://prep.ai.mit.edu/pub/gnu//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
125: ftp: Error retrieving file: 500 Internal error
126:
127: >> Attempting to fetch from ftp://wuarchive.wustl.edu/systems/gnu//.
128: Requesting ftp://wuarchive.wustl.edu/systems/gnu//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
129: ftp: Error retrieving file: 500 Internal error
130:
131: >> Attempting to fetch from ftp://ftp.freebsd.org/pub/FreeBSD/distfiles//.
132: Requesting ftp://ftp.freebsd.org/pub/FreeBSD/distfiles//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
133: Successfully retrieved file.</pre>
134: <p>Generate the checksum of the distfile into
135: <code class="filename">distinfo</code>:</p>
136: <pre class="screen"><code class="prompt">#</code> <strong class="userinput"><code>make makedistinfo</code></strong></pre>
137: <p>Now compile:</p>
138: <pre class="screen"><code class="prompt">#</code> <strong class="userinput"><code>make</code></strong>
139: >> Checksum OK for bison-1.25.tar.gz.
140: ===> Extracting for bison-1.25
141: ===> Patching for bison-1.25
142: ===> Ignoring empty patch directory
143: ===> Configuring for bison-1.25
144: creating cache ./config.cache
145: checking for gcc... cc
146: checking whether we are using GNU C... yes
147: checking for a BSD compatible install... /usr/bin/install -c -o bin -g bin
148: checking how to run the C preprocessor... cc -E
149: checking for minix/config.h... no
150: checking for POSIXized ISC... no
151: checking whether cross-compiling... no
152: checking for ANSI C header files... yes
153: checking for string.h... yes
154: checking for stdlib.h... yes
155: checking for memory.h... yes
156: checking for working const... yes
157: checking for working alloca.h... no
158: checking for alloca... yes
159: checking for strerror... yes
160: updating cache ./config.cache
161: creating ./config.status
162: creating Makefile
163: ===> Building for bison-1.25
164: cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include -g LR0.c
165: cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include -g allocate.c
166: cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include -g closure.c
167: cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include -g conflicts.c
168: cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include -g derives.c
169: cc -c -DXPFILE=\"/usr/pkg/share/bison.simple\" -DXPFILE1=\"/usr/pkg/share/bison.hairy\" -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -g ./files.c
170: cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include -g getargs.c
171: cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include -g gram.c
172: cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include -g lalr.c
173: cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include -g lex.c
174: cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include -g main.c
175: cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include -g nullable.c
176: cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include -g output.c
177: cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include -g print.c
178: cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include -g reader.c
179: cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include -g reduce.c
180: cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include -g symtab.c
181: cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include -g warshall.c
182: cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include -g version.c
183: cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include -g getopt.c
184: cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include -g getopt1.c
185: cc -g -o bison LR0.o allocate.o closure.o conflicts.o derives.o files.o getargs.o gram.o lalr.o lex.o main.o nullable.o output.o print.o reader.o reduce.o symtab.o warshall.o version.o getopt.o getopt1.o
186: ./files.c:240: warning: mktemp() possibly used unsafely, consider using mkstemp()
187: rm -f bison.s1
188: sed -e "/^#line/ s|bison|/usr/pkg/share/bison|" < ./bison.simple > bison.s1</pre>
189: <p>Everything seems OK, so install the files:</p>
190: <pre class="screen"><code class="prompt">#</code> <strong class="userinput"><code>make install</code></strong>
191: >> Checksum OK for bison-1.25.tar.gz.
192: ===> Installing for bison-1.25
193: sh ./mkinstalldirs /usr/pkg/bin /usr/pkg/share /usr/pkg/info /usr/pkg/man/man1
194: rm -f /usr/pkg/bin/bison
195: cd /usr/pkg/share; rm -f bison.simple bison.hairy
196: rm -f /usr/pkg/man/man1/bison.1 /usr/pkg/info/bison.info*
197: install -c -o bin -g bin -m 555 bison /usr/pkg/bin/bison
198: /usr/bin/install -c -o bin -g bin -m 644 bison.s1 /usr/pkg/share/bison.simple
199: /usr/bin/install -c -o bin -g bin -m 644 ./bison.hairy /usr/pkg/share/bison.hairy
200: cd .; for f in bison.info*; do /usr/bin/install -c -o bin -g bin -m 644 $f /usr/pkg/info/$f; done
201: /usr/bin/install -c -o bin -g bin -m 644 ./bison.1 /usr/pkg/man/man1/bison.1
202: ===> Registering installation for bison-1.25</pre>
203: <p>You can now use bison, and also - if you decide so - remove it with
1.10 hubertf 204: <span class="command"><strong>pkg_delete bison</strong></span>. Should you decide that you want a
1.1 dsieger 205: binary package, do this now:</p>
206: <pre class="screen"><code class="prompt">#</code> <strong class="userinput"><code>make package</code></strong>
207: >> Checksum OK for bison-1.25.tar.gz.
208: ===> Building package for bison-1.25
209: Creating package bison-1.25.tgz
210: Registering depends:.
211: Creating gzip'd tar ball in '/u/pkgsrc/lang/bison/bison-1.25.tgz'</pre>
212: <p>Now that you don't need the source and object files
213: any more, clean up:</p>
214: <pre class="screen"><code class="prompt">#</code> <strong class="userinput"><code>make clean</code></strong>
215: ===> Cleaning for bison-1.25</pre>
216: </div>
217: </div>
218: <div class="navfooter">
219: <hr>
220: <table width="100%" summary="Navigation footer">
221: <tr>
222: <td width="40%" align="left">
223: <a accesskey="p" href="porting.html">Prev</a> </td>
224: <td width="20%" align="center"> </td>
225: <td width="40%" align="right"> <a accesskey="n" href="logs.html">Next</a>
226: </td>
227: </tr>
228: <tr>
1.6 rillig 229: <td width="40%" align="left" valign="top">Chapter 26. Porting pkgsrc </td>
1.1 dsieger 230: <td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td>
231: <td width="40%" align="right" valign="top"> Appendix B. Build logs</td>
232: </tr>
233: </table>
234: </div>
235: </body>
236: </html>
CVSweb <webmaster@jp.NetBSD.org>