Annotation of www/checklist.html, Revision 1.17
1.14 rohee 1: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
1.1 marc 2: <html>
3: <head>
4: <meta http-equiv="Content-Type"
5: content="text/html; charset=iso-8859-1">
6: <meta name="resource-type"
7: content="document">
8: <meta name="description"
1.3 marc 9: CONTENT="How to make an OpenBSD port; porting checklist">
1.1 marc 10: <meta name="keywords"
11: content="openbsd,ports">
12: <meta name="distribution"
13: content="global">
14: <meta name="copyright"
15: content="This document copyright 1998 by the OpenBSD project">
1.3 marc 16: <title>OpenBSD Porting Checklist</title>
1.1 marc 17: <link rev="made" HREF="mailto:www@openbsd.org">
18: </head>
19: <body text="#000000" bgcolor="#FFFFFF" link="#23238E">
20: <img height=30 width=141 src=images/smalltitle.gif alt="[OpenBSD]" >
21:
1.14 rohee 22: <h2><font color="#e00000">OpenBSD Porting Checklist</font></h2>
1.1 marc 23:
24: I use this checklist as a reminder of things to do when creating
25: new ports and when validating old ports. I don't claim this list
26: is totally accurate, much less perfect, but only hope that some
1.3 marc 27: find it useful. Direct any questions and/or comments to me at
1.14 rohee 28: <a href="mailto:marc@snafu.org">marc@snafu.org</a>.
1.1 marc 29: <p>
30: <ol>
1.4 ian 31: <li>To avoid duplication, subscribe to the ports@openbsd.org
32: mailing list - somebody may be already working on the same port as you.
33: <p>
1.11 marc 34: <li>Create Makefile -- start with the provided Makefile template
1.15 espie 35: <code>/usr/ports/infrastructure/templates/Makefile.template</code>.
36: This file can be retrieved from any of the anoncvs servers or via the
1.14 rohee 37: OpenBSD cvs/web source browser system
1.11 marc 38: <a href="http://www.openbsd.org/cgi-bin/cvsweb/">http://www.openbsd.org/cgi-bin/cvsweb/</a>.
1.1 marc 39: <p>
1.15 espie 40: <li><code>make fetch-all</code><br>
1.1 marc 41: This verifies that the master site, distname, and extract suffix are
1.15 espie 42: correct. This should fetch <strong>all</strong> files needed for
43: that port, not only those corresponding to current option or the
44: current architecture.
1.1 marc 45: <p>
46: <li><code>make makesum</code><br>
47: This creates the files directory and the md5 checksum for the
48: fetched files.
49: <p>
50: <li><code>make extract</code><br>
51: Ensures that the file can be extracted into the work directory.
1.14 rohee 52: This also verifies that the checksum created in step 4 is good.
1.1 marc 53: <p>
54: <li>Create initial patches<br>
55: When the extract is complete cd to the work directory and read
56: any install docs. You may need to modify the WRKSRC variable
57: in the makefile as well as generate initial patches to configure
1.14 rohee 58: for OpenBSD.
1.17 ! marc 59: <p>Note: Patches go in the directory `patches' and are named patch-xx
1.1 marc 60: where xx should be aa, ab, ..., az, ba, bb ... zz.
61: <ul>
62: <li>only patch one source file per patchfile, please
63: <li>use diff -u to generate patches
64: <li>all patches MUST be relative to ${WRKSRC}
1.17 ! marc 65: <li>add a small explanation of the patch role in the patchfile before
1.14 rohee 66: the patch itself, and an OpenBSD CVS tag
67: <code>$OpenBSD$</code>
1.1 marc 68: </ul>
69: <p>
70: <li><code>make patch</code><br>
71: this will apply patches to the extracted sources. If you want
72: to see the output use the command:
73: <p><code>make PATCH_DEBUG=YES patch</code>
1.7 espie 74: <p>The easiest way to re-run patches is to `make clean && make patch'.
1.1 marc 75: This will delete the work directory and re-extract and patch.
76: <p>
77: <li>add configuration options to Makefile and/or create configuration
78: script.<br>
79: You can add a port configuration script named `configure' to a
80: directory named scripts. This will be run before any
81: configuration specified by GNU_CONFIGURE or HAS_CONFIGURE is run.
82: <p>If GNU_CONFIGURE is used you may want to run ./configure --help
1.14 rohee 83: to see what options are available. Anything that you may want to
1.1 marc 84: override can be changed by adding the --option flags to the
85: CONFIGURE_ARGS parameter in the Makefile
86: <p>
1.12 espie 87: <li>try setting <code>SEPARATE_BUILD</code><br>
88: If the port can build with object files outside its source tree,
89: this is cleaner (many programs using <code>GNU_CONFIGURE</code> can),
90: and may help people who mount their ports tree on several arches.
91: This can also spare you some effort, as you will possibly be able to
92: restart the cycle at <code>configure</code> most of the time.
93: <p>
1.1 marc 94: <li><code>make configure</code><br>
95: Peruse the output (if any) and tweak any options in the Makefile.
1.14 rohee 96: To repeat issue the command
97: `<code>make clean && make configure</code>'.
98: <p>Note: make sure host dependent files go in <code>/etc</code> or
99: <code>/etc/<name></code>, but NEVER replace existing files
100: in <code>/etc</code>. Best to have install place
101: in <code>/usr/local/lib/<name></code> and then copy to
102: <code>/etc</code> or
103: <code>/etc/<name></code> only if the files do not exist.
1.1 marc 104: <p>The OpenBSD file locations are:
1.9 espie 105:
1.1 marc 106: <pre>
107: user executables: /usr/local/bin
108: system admin executables: /usr/local/sbin
109: program executables: /usr/local/libexec
110: libraries /usr/local/lib
1.14 rohee 111: architecture dependent data /usr/local/lib/<name>
1.1 marc 112: installed include files: /usr/local/include or
1.14 rohee 113: /usr/local/include/<name>
114: single-machine data: /etc or /etc/<name>
1.1 marc 115: local state: /var/run
116: GNU info files: /usr/local/info
117: man pages: /usr/local/man/...
1.14 rohee 118: read-only architecture-independent: /usr/local/share/<name>
119: misc documentation: /usr/local/share/doc/<name>
1.1 marc 120: </pre>
1.9 espie 121:
1.1 marc 122: <p>
123: <li><code>make</code><br>
124: Begin a cycle of makes until the port is ready. Patch (see above)
125: clean, and make until the port is generated. Get rid of all warnings
126: if possible, especially security related warnings.
127: <p>
1.12 espie 128: <li>Control <code>SEPARATE_BUILD</code> semantics<br>
129: You have to do this only if the port builds with
130: <code>SEPARATE_BUILD</code> defined.
131: Ideally, the port should no longer modify any file in
132: <code>${WRKSRC}</code> after <code>make patch</code>.
133: You can check this by making sure you don't have any write access
134: to <code>${WRKSRC}</code>. Then you can set
135: <code>SEPARATE_BUILD=concurrent</code>: someone can use the same
136: source tree to build on distinct arches simultaneously.
137: Otherwise, set <code>SEPARATE_BUILD=simple</code>: building on
138: distinct arches simultaneously may meet with problems, as some
139: source files may be regenerated at awkward moments.
140: <p>
1.1 marc 141: <li><code>mkdir pkg; touch pkg/{DESCR,COMMENT,PLIST}</code><br>
142: Create dummy versions of the package files. Edit DESCR and COMMENT.
1.7 espie 143: <p>COMMENT is a <strong>SHORT</strong> one-line description of the port
1.14 rohee 144: (max. 60 characters). Do NOT include the package name (or version number
1.17 ! marc 145: of the software) in the comment. Do NOT start with an uppercase letter
! 146: unless semantically significant, do NOT end with a period.
1.1 marc 147: <p>DESCR is a longer description of the port. One to a few paragraphs
148: concisely explaining what the port does is sufficient.
149: <p>PLIST is kept empty at this point.
150: <p>
151: <li><code>sudo make install</code><br>
152: install the application.
153: <p>
1.16 espie 154: <li>If the port installs dynamic libraries, check their symbol tables
155: with <code>nm</code>, as some mistaken software strips dynamic libraries,
156: which may lead to weird failures later.
157: <p>
1.9 espie 158: <li><strong>Check port for security holes again</strong>. This is
159: especially important for network and setuid programs. See
160: <a href="porting.html#security">our security recommendations</a>
161: for that. Log interesting stuff and fixes in the
162: <code>pkg/SECURITY</code> file. This file
163: should list audited potential problems, along with relevant patches,
164: so that another person can see at first glance what has been done.
165: Example:
166:
1.14 rohee 167: <pre>
168: $OpenBSD$
1.9 espie 169:
170: ${WRKDIR}/receiver.c
171: call to mktemp (wrapper function do_mktemp) does seem to be correct.
172:
173: The server makes extensive use of strlcpy/strlcat/snprintf.
174:
175: </pre>
176:
1.1 marc 177: <li>Create pkg/PLIST<br>
1.17 ! marc 178: After the install is complete use the developer's command:
1.1 marc 179: <p><code>make plist</code>
1.17 ! marc 180: <p>which makes the file PLIST-auto in the pkg directory. This file
1.1 marc 181: is a candidate packing list. Beware: the files are found by
182: timestamp. This means it does NOT:
183: <ul>
184: <li>list any files installed with `tar' as their timestamp
185: will not change and thus won't be found by `find'
186: <li>update the <code>info/dir</code> file if .info files are
187: added. You'll have to add that by hand. Also, be sure that
188: the <code>info/dir</code> is not part of the PLIST.
189: <li>try to do anything special with links or symbolic links. A
190: cursory test of tar shows it does the right thing with links
191: and symbolic links so I don't see why we need to special case
192: anything in the packing list. But still...
193: </ul>
194: <p>Peruse `PLIST-auto' and verify that everything was installed and
195: that it was installed in the proper locations. Anything not installed
196: can be added to a port Makefile `post-install' rule.
197: <p>Copy `PLIST-auto' to `PLIST'
1.10 marc 198: <p>Ports that install shared libraries will need two versions of
199: the PLIST file. <code>PLIST</code> describes the files installed on
200: those architectures that support shared libraries, and
1.13 wvdputte 201: <code>PLIST.noshared</code> describes the files installed on
1.10 marc 202: architectures that do not support shared libs. Typically,
203: <code>PLIST.noshared</code> is a copy of <code>PLIST</code>
204: less references to any shared libraries.
1.1 marc 205: <p>
206: <li>uninstall and reinstall; repeat until perfect.<br>
207: <em>Perfect</em> is when everything installs and uninstalls
1.17 ! marc 208: in its proper location. `<code>pkg_delete <pkg_name></code>' is
1.14 rohee 209: used to uninstall. `sudo make reinstall' is used to reinstall. See the
210: `<code>pkg_create</code>' man page for other commands that may be added
211: to PLIST to ensure all is cleaned up. After an uninstall the command
1.1 marc 212: <p><code>find /usr/local -newer work/.install_started -print</code>
213: <p>should only list standard directory names.
214: <p>
215: <li>Create package:<br>
216: After the port installs correctly issue the command
217: <code>make package</code> to create a package. To test the
218: package first do a <code>pkg_delete</code> and then do a
219: <code>pkg_add</code> The results after an add should EXACTLY
220: match the results after a `make install'.
1.4 ian 221: <p>
1.14 rohee 222: <li>Distribute it!<br>
1.4 ian 223: Since the whole point of this process
224: is to make your ported version of the software available to
225: other OpenBSD users, you now need to disseminate it.
1.14 rohee 226: <ul>
227: <li>First, get others to test it on a variety of
228: platforms (the DEC Alpha is good because it has only static libraries
1.4 ian 229: and because sizeof int != sizeof long; Sun SPARC is good because it is
230: very common and because its byte order is the reverse of i386; if you
1.17 ! marc 231: developed on SPARC, of course, you'd want it tested on i386).
1.4 ian 232: <P>The ports@openbsd mailing list is a good place to find porting-savy
233: people with different platforms!
1.14 rohee 234: <li>Incorporate any feedback you get. Test it again on your platform.
1.4 ian 235: Get those who gave you feedback to test it again from your new port.
1.14 rohee 236: <li>Finally, include it in the "ports" tree.
1.4 ian 237: If you are a developer with CVS access, check it in.
238: We normally use "import" for a new port,
239: rather than adding a zillion (or a dozen) files individually.
240: Import uses "vendor branch" version numbers like 1.1.1.1, but don't worry
241: about that! :-) If you make changes to a specific file (edit, then
242: cvs commit), it will be 1.2, and that will be used.
243: <P>
244: In short, import is typically used when a port is created.
245: From that point on cvs add and cvs rm are typically used to add or remove
246: files, and the normal edit->commit cycle for changes.
247: <P>
248: You might use something like this:
1.14 rohee 249: <pre>
1.4 ian 250: cd kaffe1
251: make clean # you really really don't want to check in all of work!
252: cvs -d cvs.openbsd.org:/cvs import -m 'kaffe port' ports/lang/kaffe1 \
253: <I>YourName</I> <I>YourName_YYYY-MMM-DD</I>
1.14 rohee 254: </pre>
1.4 ian 255: <P>-d cvs.openbsd.org:/cvs says where cvs lives. This can be omitted if you
256: have a CVS_ROOT environment variable defined.
257: <P>-m 'kaffe port' is your login message. Change it to whatever you like
258: <P>ports/lang/kaffe1 is the path relative to /cvs where the port lives
259: <P><I>YourName</I> (replaced with your login name) is the "vendor tag".
260: You imported it so you are the vendor.
261: <P><I>YourName_YYYY-MMM-DD</I> (e.g., ian_2000-Jan-01)
262: is the 'vendor release tag'. This is as good as any.
263: <P>As a real example, here is the output of checking in the Kaffe1 port,
264: which one of us did on September 8, 1998:
1.14 rohee 265: <pre>
1.4 ian 266: $ cd kaffe1
267: $ make clean >/dev/null
268: $ cvs import -m 'kaffe1.0(==JDK1.1) port' ports/lang/kaffe1 ian ian_1998-Sep-08
269: ian@cvs.openbsd.org's password: (not shown, obviously)
270: I ports/lang/kaffe1/CVS
271: I ports/lang/kaffe1/files/CVS
272: I ports/lang/kaffe1/pkg/CVS
273: N ports/lang/kaffe1/Makefile
274: cvs server: Importing /cvs/ports/lang/kaffe1/files
275: N ports/lang/kaffe1/files/md5
276: cvs server: Importing /cvs/ports/lang/kaffe1/pkg
277: N ports/lang/kaffe1/pkg/COMMENT
278: N ports/lang/kaffe1/pkg/DESCR
279: N ports/lang/kaffe1/pkg/PLIST
280:
281: No conflicts created by this import
282: $
1.14 rohee 283: </pre>
1.5 ian 284: <P>Last but not least, add a one-line entry for the new port
285: in its parent directory's makefile, i.e., for ports/lang/kaffe1,
286: add it to ports/lang/Makefile.
1.4 ian 287: <P>If you do not have CVS commit access, send mail to the ports
288: maintainers at ports@openbsd.org,
289: stating that you have a port ready to go into the tree. List the
290: name and version of the program, the platforms it's been tested on,
291: and any limitations.
292: </UL>
293: <P>
294: <LI>Maintain the port!<BR>
295: As time goes by, problems may arise, or new versions of the software
296: may be released. You should strive to keep your port up to date.
297: In other words - iterate, test, test, iterate, ...
1.1 marc 298: </ol>
1.4 ian 299: Thank you for supporting the OpenBSD "ports" process!
1.1 marc 300: <hr>
301: <a href="porting.html"><img height=24 width=24 src=back.gif
302: border=0 alt=Porting></a>
1.14 rohee 303: <a href="mailto:www@openbsd.org">www@openbsd.org</a>
1.17 ! marc 304: <br><small>$OpenBSD: checklist.html,v 1.16 1999/06/01 22:26:38 espie Exp $</small>
1.1 marc 305: </body>
306: </html>