Chapter 6 Special Considerations

Table of Contents
6.1 Shared Libraries
6.2 Ports with Distribution Restrictions
6.3 Building Mechanisms
6.4 Using GNU Autotools
6.5 Using pkg-config
6.6 Using GNU gettext
6.7 Using Perl
6.8 Using X11
6.9 Using GNOME
6.10 Using Qt
6.11 Using KDE
6.12 Using Java
6.13 Web Applications, Apache and PHP
6.14 Using Python
6.15 Using Tcl/Tk
6.16 Using Emacs
6.17 Using Ruby
6.18 Using SDL
6.19 Using wxWidgets
6.20 Using Lua
6.21 Using Xfce
6.22 Using Mozilla
6.23 Using Databases
6.24 Starting and Stopping Services (rc Scripts)
6.25 Adding Users and Groups
6.26 Ports That Rely on Kernel Sources

There are some more things you have to take into account when you create a port. This section explains the most common of those.

6.1 Shared Libraries

If your port installs one or more shared libraries, define a USE_LDCONFIG make variable, which will instruct a bsd.port.mk to run ${LDCONFIG} -m on the directory where the new library is installed (usually PREFIX/lib) during post-install target to register it into the shared library cache. This variable, when defined, will also facilitate addition of an appropriate @exec /sbin/ldconfig -m and @unexec /sbin/ldconfig -R pair into your pkg-plist file, so that a user who installed the package can start using the shared library immediately and de-installation will not cause the system to still believe the library is there.

USE_LDCONFIG=	yes

If you need, you can override the default directory by setting the USE_LDCONFIG value to a list of directories into which shared libraries are to be installed. For example if your port installs shared libraries into PREFIX/lib/foo and PREFIX/lib/bar directories you could use the following in your Makefile:

USE_LDCONFIG=	${PREFIX}/lib/foo ${PREFIX}/lib/bar

Please double-check, often this is not necessary at all or can be avoided through -rpath or setting LD_RUN_PATH during linking (see lang/moscow_ml for an example), or through a shell-wrapper which sets LD_LIBRARY_PATH before invoking the binary, like www/seamonkey does.

When installing 32-bit libraries on 64-bit system, use USE_LDCONFIG32 instead.

Try to keep shared library version numbers in the libfoo.so.0 format. Our runtime linker only cares for the major (first) number.

When the major library version number increments in the update to the new port version, all other ports that link to the affected library should have their PORTREVISION incremented, to force recompilation with the new library version.

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