Skip to content

RFC: installation paths and runtime paths #12725

@o11c

Description

@o11c

The directories I am describing is not new; it is only a collection of existing standard practices.

Current practice

Currently, common practice is to install rust packages into ~/.rust. This is unfriendly, since you're adding a junk dir in the middle of someone else's home, and there are better places (mostly ~/.local/lib/rust, but do keep reading).

Installation variables

These are often embedded into the application at configure-time (unlike DESTDIR, which must not be, since it is only for use of packaging tools).

variable default purpose
PREFIX /usr/local architecture-independent files (/usr for distros)
EPREFIX ${PREFIX} architecture-dependent files
BINDIR ${EPREFIX}/bin user executables (${PREFIX}/games for games)
SBINDIR ${EPREFIX}/sbin system admin executables
LIBEXECDIR ${EPREFIX}/libexec program executables
SYSCONFDIR ${PREFIX}/etc read-only single-machine data (/etc for distros)
LOCALSTATEDIR ${PREFIX}/var modifiable single-machine data (/var for distros)
LIBDIR ${EPREFIX}/lib object code libraries
DATAROOTDIR ${PREFIX}/share read-only arch.-independent data root
DATADIR ${DATAROOTDIR} read-only architecture-independent data (${PREFIX}/share/games for games) (should only use ${DATADIR}/${PACKAGE}/)
LOCALEDIR ${DATAROOTDIR}/locale locale-dependent data
DOCDIR ${DATAROOTDIR}/doc/${PACKAGE} documentation root

Working in ${HOME}

(XDG; this applies even if you were installed globally)

variable default purpose
XDG_DATA_HOME $HOME/.local/share dir to read/write user data
XDG_DATA_DIRS /usr/local/share/:/usr/share/ dirs to read data after that (should include ${DATADIR} if you change that)
XDG_CONFIG_HOME $HOME/.config dir to read/write user config
XDG_CONFIG_DIRS /etc/xdg dirs to read config after that
XDG_CACHE_HOME $HOME/.cache dir to read/write nonessential temporary files
XDG_RUNTIME_DIR None (supposed to be set by session manager, often unavailable) private (0700) dir for sockets and named pipes

(To encourage the development of well-behaved software, some helper functions should be put in one of the standard libraries)

Practical installation into ${HOME}

variable default
PREFIX ${HOME}/.local
BINDIR ${HOME}/bin
DATADIR ${XDG_DATA_HOME}
SBINDIR hopeless
SYSCONFDIR ${XDG_CONFIG_HOME}
LOCALSTATEDIR if an application needs this, it probably can't be installed as user. However, ${LOCALSTATEDIR}/cache is vaguely similar to ${XDG_CACHE_HOME} and ${LOCALSTATEDIR}/run is vaguely similar to ${XDG_RUNTIME_DIR}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions