Chapter 15 Dos and Don'ts

Table of Contents
15.1 Stripping Binaries
15.2 INSTALL_* macros
15.3 WRKDIR
15.4 WRKDIRPREFIX
15.5 Differentiating operating systems and OS versions
15.6 __FreeBSD_version values
15.7 Writing something after bsd.port.mk
15.8 Install additional documentation
15.9 Subdirectories
15.10 Cleaning up empty directories
15.11 UIDs
15.12 Do things rationally
15.13 Respect both CC and CXX
15.14 Respect CFLAGS
15.15 Configuration files
15.16 Feedback
15.17 README.html
15.18 Miscellanea
15.19 If you are stuck...

Here is a list of common dos and don'ts that you encounter during the porting process. You should check your own port against this list, but you can also check ports in the PR database that others have submitted. Submit any comments on ports you check as described in Bug Reports and General Commentary. Checking ports in the PR database will both make it faster for us to commit them, and prove that you know what you are doing.

15.1 Stripping Binaries

Do not strip binaries manually unless you have to. All binaries should be stripped, but the INSTALL_PROGRAM macro will install and strip a binary at the same time (see the next section).

If you need to strip a file, but do not wish to use the INSTALL_PROGRAM macro, ${STRIP} will strip your program. This is typically done within the post-install target. For example:

    post-install:
            ${STRIP} ${PREFIX}/bin/xdl

Use the file(1) command on the installed executable to check whether the binary is stripped or not. If it does not say not stripped, it is stripped. Additionally, strip(1) will not strip a previously stripped program; it will instead exit cleanly.

For questions about the FreeBSD ports system, e-mail <ports@FreeBSD.org>.
For questions about this documentation, e-mail <doc@FreeBSD.org>.