Quote:
Originally Posted by c0uchm0nster
thanks for the reply/links.
I'm aware of the standard system file structure, but aren't there ways to ask the system where it wants certain things?
|
Nope. You have to follow the conventions for a given platform. Typically in your build system you define a PREFIX variable, which usually defaults to /usr/local. Other variables are defined as sub-directories on top of PREFIX, e.g. BINDIR=$PREFIX/bin; DATADIR=$PREFIX/share/$PACKAGENAME and so on.
With this sort of method, it means a lot of programs have to be re-built if the PREFIX changes, although some are written in a way which uses the PREFIX as a default, and maybe looks in an environment variable for other places to check if files were not found in the PREFIX/... location. An example of this is KDE, which checks for the KDEDIRS environment variable at run time and checks this in addition to the compiled-in PREFIX default.
Quote:
Originally Posted by c0uchm0nster
I mean what if a user installs the program for him/herself versus a system-wide install?
|
If the user is building from source, and the source is built using the GNU autotools method (automake, autoconf and friends), the PREFIX is specified using a standard method in build process, specifically using the --prefix option to the invocation of the configure script:
Code:
./configure --prefix=/opt/myapp --other-build-option
...and then to build the app and install it:
Code:
make
sudo make install
Other projects use other build methods, but most will provide some mechanism to do this.
For users who do not want to build their software themselves (I suppose this must be a lot of people), they must rely on pre-built packages. Then it is the choice of the packager what PREFIX to use. The choice will depend on some policy of the distribution. The FHS which jdiggitydogg linked to describes some reasons for putting things in the various prefixes. Quick and dirty rule of thumb:
- /usr is used for packages in the core OS / distro
- /usr/local for other packages
- /opt/programname for optional and other packages, although strictly speaking these should be statically linked. In practise I tend to use /opt/programname when I'm mucking about with new s/w because it's easy to delete the s/w by removing the directory and all its contents.
Hope that helps,
Matthew.