Fink

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 /sw.

4.2 The Directories

Files should go into the following subdirectories of the hierarchy:

FieldValue
/sw/bin

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

/sw/sbin

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

/sw/include

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.

/sw/lib

This directory is for architecture-dependent data files and libraries. Static and shared libraries should be placed directly in /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. /sw/lib/perl5 or /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.

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

This directory is for 64-bit libraries on 32-bit systems, with /sw/lib/ppc64 being used under powerpc architecture, and /sw/lib/x86_64 being used under i386 architecture. Libraries which have been built 'fat' should be stored in /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 /sw/lib.

/sw/share

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

/sw/share/man

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

/sw/share/info

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.

/sw/share/doc

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.

/sw/share/locale

This directory contains message catalogs for internationalization.

/sw/opt

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

/sw/var

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

/sw/etc

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.

/sw/src

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

/sw/Applications

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

/sw/Library/Frameworks

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 /sw. In particular, the following should not be used: /sw/man, /sw/info, /sw/doc, /sw/libexec, /sw/lib/locale.

Next: 5. Compilers