How do I put GNOME someplace special, like /opt/gnome?

Many people like to put GNOME off by itself, in its own directory. Doing this makes it easier to uninstall in an emergency, easier to control who has access to GNOME, it lets you export the gnome directory to other systems, and so on. To do this requires a little bit of preparation, and knowledge of your system. For this discussion, I'll be putting GNOME in the /opt/gnome directory. Just replace /opt/gnome with whatever other directory you want.

The biggest issue are making sure the system can find the GNOME binaries in /opt/gnome/bin, the libraries in /opt/gnome/lib, and the man files in /opt/gnome/man.

To tell the system to look into /opt/gnome/bin to find the GNOME binaries, just make sure it is included in the PATH environment variable. For example: PATH="/bin:/usr/bin:/opt/gnome/bin".

Then, you generally need to tell the loader where to find the libraries. On most commercial Unixes, you add /opt/gnome/lib to the environment variable LD_LIBRARY_PATH, in the same manner as PATH, above. On some systems, you use LD_RUN_PATH instead. On systems using ELF format binaries, such as GNU/Linux or FreeBSD, you add the library path to the file /etc/ld.so.conf, and run ldconfig. On statically linked systems, you don't have to worry about any of the above, but buy more hard drive space, you are sure to need it. Consult your system documentation if you are unsure how to tell the loader which directories to search.

You also should tell man where to find man pages installed by GNOME. Simply insert a line into /etc/man.config, saying MANPATH /opt/gnome/man.

The other issue is there are a couple of directories which GNOME will put things in, which would be better put elsewhere. The easiest way of doing this is with symbolic links. Type the following:

$ mkdir /opt/gnome/share
$ cd /opt/gnome/share
$ ln -s /usr/share/locale locale
$ ln -s /usr/share/aclocal aclocal

Now you're all set to use /opt/gnome as a prefix when compiling. To do this, just give the ./configure command the option --prefix=/opt/gnome. Of course, if you want someplace special other than /opt/gnome, just replace it with the directory you do want in all the instances above.