Packaging - 4. Filesystem Layout

The following file system layout guidelines are part of the Fink packaging policy.

4.1 The Filesystem Hierarchy Standard

Fink follows the spirit of the Filesystem Hierarchy Standard, or FHS for short. It can only follow it in spirit because the FHS was created for system vendors that have control over the / and /usr hierarchies. Fink is an add-on distribution that controls only its install directory (or prefix). The examples use the default prefix of /opt/sw.

4.2 The Directories

Files should go into the following subdirectories of the hierarchy:


This directory is for general executable programs. There are no subdirectories.


This directory is for executable programs that are intended to be used by administrators only. Background daemons go here. There are no subdirectories.


This directory is for C and C++ header files. Subdirectories can be created as necessary. If a package installs header files that can be confused with standard C headers, those headers must go to a subdirectory.


This directory is for architecture-dependent data files and libraries. Static and shared libraries should be placed directly in /opt/sw/lib unless there is a good reason not to. This is also the place for executables that should not be executed directly by the user (which would otherwise be placed in libexec).

A package is free to create a subdirectory to store private data or loadable modules. Make sure to use directory names that make sense for compatibility. It is wise to use the package major version in the directory name or as an additional hierarchy level, e.g. /opt/sw/lib/perl5 or /opt/sw/lib/apache/1.3. Care should be taken when the host type is used to create directories. A powerpc-apple-darwin1.3.3 directory is bad for compatibility, powerpc-apple-darwin1.3 or just powerpc-apple-darwin are better choices.

/opt/sw/lib/ppc64 /opt/sw/lib/x86_64

This directory is for 64-bit libraries on 32-bit systems, with /opt/sw/lib/ppc64 being used under powerpc architecture, and /opt/sw/lib/x86_64 being used under i386 architecture. Libraries which have been built 'fat' should be stored in /opt/sw/lib instead, and should be so indicated by using '32-64' in the corresponding Shlibs entry. Note that under the x86_64 architecture, 64-bit libraries are to be stored in /opt/sw/lib.


This directory is for architecture-independent data files. The same rules as for /opt/sw/lib apply. Some common subdirectories are described below.


This directory contains manual pages. It is organized into the usual section tree. Every program in /opt/sw/bin and /opt/sw/sbin should have an associated manual page here.


This directory contains documentation in the Info format (produced from Texinfo sources). Maintenance of the dir file is automated through Debian's version of install-info (part of the dpkg package). Use the InfoDocs description field to automatically generate appropriate code for the postinst and prerm package scripts. Fink makes sure that no package installs a dir file of its own. There are no subdirectories.


This directory contains documentation that is neither a man page nor an Info document. README, LICENSE and COPYING files go here. Every package must create a subdirectory here, named after the package. The subdirectory name must not contain any version numbers (unless they are a part of the package name proper). Hint: Just use %n.


This directory contains message catalogs for internationalization.


The opt directory stores "add-on" software packages, which for some reason cannot use the standard /opt/sw/bin, /opt/sw/lib, /opt/sw/include, etc. directories. A package to be installed in /opt/sw/opt must locate its static files in a separate /opt/sw/opt/<package> directory tree, where <package> is a name that describes the software package. (Available in fink 0.29.7 or later.)


The var directory stores variable data. This includes spool directories, lock files, state databases, game high scores and log files.


This directory holds configuration files. For packages that have more than one or two files here a subdirectory should be made. The subdirectory must have the name of the package or program in it so that it is identifiable.


This directory is for storing and building source code. Nothing should be installed here by a package.


This directory is for storing OS X-style applications which are launched by double-clicking rather than from the command line.


This directory is for storing OS X-style frameworks, sometimes used by OS X-style applications.

4.3 Things to Avoid

No other directories than the ones mentioned above should exist in /opt/sw. In particular, the following should not be used: /opt/sw/man, /opt/sw/info, /opt/sw/doc, /opt/sw/libexec, /opt/sw/lib/locale.

Next: 5. Compilers