7.4. Gotchas of FreeBSD ports

See the Makefile section for Makefile issues (MANx, CATx, MANCOMPRESSED, ldconfig, RCS IDs) and patches/* for gotchas on using patches from FreeBSD ports.

One of the biggest problems with FreeBSD ports is that too many of them assume they will install into /usr/local, instead of honouring any ${PREFIX} setting properly. To change this, add something like the following into your package Makefile:

pre-configure:
        for f in `find ${WRKDIR} -type f -print \
	          |xargs grep -l '/usr/local'`; do \
                ${SED} -e 's:/usr/local:'${PREFIX}':g' < $$f > $$f.pdone \
		&& ${MV} $$f.pdone $$f; \
        done
  

This is taken from the sysutils/rtty package; be sure this works for your package - it may actually make sense to look for some things in /usr/local, for example. So don't blindly replace all occurrences of /usr/local!

FreeBSD has decided to list manual pages in the package Makefile, with no corresponding entry in the PLIST file. You will thus need to add any MAN[1-8ln] files to the PLIST file before deleting the MAN[1-8ln] definition. Similarly with MLINKS and CAT[1-8ln] entries.

Side note on manpages in PLIST: we don't take any notice of any .gz suffix there, as many FreeBSD ports seem to have .gz pages in PLIST even when they install manpages without compressing them; rather, we add our own .gz suffix there according to MANZ. In short, it does not matter whether the manual page name in the PLIST file has a .gz suffix or not - if it needs one which is not already there, it will be appended automatically, and if there is a .gz suffix which is not needed, it will be deleted automatically.

Some packages use bsd-style .mk files when building, and so any manual pages that are installed will be gzip-compressed, if MANZ is set, or not if MANZ is not set. If the package uses bsd-style .mk files, the variable MANCOMPRESSED_IF_MANZ should be set to a value of yes in the package Makefile.