ftp://ftp.gnu.org/pub/gnu/stow/stow-1.3.3.tar.gz
Stow online manual:
http://www.gnu.org/software/stow/manual.html
Stow is one of my favorite programs. It is the original Package Manager. Long before RPM's and apt-get, there was Stow!
Stow should be the very first source tarball you ever install on your own. Not only do you learn the standard method for building and installing from source, but as an added benefit you start out with a tool that will save you hundreds of hours as you go on to build other software packages later.
The first thing to do is to make yourself a place to build from source. I recommed /build, so:
mkdir /build
cd /build
Now, get the stow source tarball:
ncftpget ftp://ftp.gnu.org/pub/gnu/stow/stow-1.3.3.tar.gz
And unpack it:
tar xzf stow-1.3.3.tar.gz
NOTE: for .bz2 tarballs, the correct options are xjf, as opposed to xzf for .gz files, okay?
cd to the source toplevel:
cd stow-1.3.3
check out the configure options:
./configure --help
hmmm... only interesting one is --prefix=. Well, we need to have a install prefix location for all the packages we will be building. I recommend /usr/local, which probably already exists on your system (it does, don't worry), so:
./configure --prefix=/usr/local/stow/pkgname-1.2.3
Lots of interesting stuff will start to happen when you type that, and after a short time your command prompt will return. Then you need to actually build the package:
make
A lot more interesting stuff will happen. When it finishes up it is time to install the package. Installing stow is slightly different from all other software you will install in the future, because stow is going to be used on itself just this once, and that is a little weird!
First, we are going to make a very special directory:
mkdir -p /usr/local/stow
And now we are going to tell make to install stow under /usr/local/stow/stow-1.3.3:
make prefix=/usr/local/stow/stow-1.3.3 install
And now we are going to stow Stow using Stow:
cd /usr/local/stow
/usr/local/stow/stow-1.3.3/bin/stow stow-1.3.3
Done, whew!
And after that, whenever you want to install a package from source, you put your source tarball into the /build directory and:
tar xzf pkgname-1.2.3.tar.gz
cd pkgname-1.2.3
./configure --help
./configure --prefix=/usr/local/stow/pkgname-1.2.3 (and possibly other options...)
make
make install
cd /usr/local/stow
rm -f /usr/local/info/dir
stow pkgname-1.2.3
ldconfig
And in most cases, everything will work splendidly. One very common hitch that you will run into at some point is that many packages have a file called /usr/local/stow/pkgname-N.N.N/info/dir, which will cause stow to complain when it has already been stowed as part of another package. Good news. You can just delete the file and everything will still function flawlessly. You will note that I have included just such a step in my instructions to save you the trauma of discovering it for yourself.
Another less common hitch is that the make install rules are not quite correct, causing complaints about missing directories. This is overcome by doing:
mkdir -p /usr/local/stow/pkgname-1.2.3/bin
mkdir -p /usr/local/stow/pkgname-1.2.3/lib
mkdir -p /usr/local/stow/pkgname-1.2.3/include
make prefix=/usr/local/stow/pkgname-1.2.3 install
In place of the make install line above.
When time comes that a new version of a package comes out, you can un-stow the old version before you build the new version to prevent conflicts by doing this:
cd /usr/local/stow
stow -D pkgname-O.L.D
And if the new version turns out to be a buggy release, you can revert to the old version by unstowing the new version and stowing the old. This is what saves you hundreds of hours, because there are plenty of buggy releases ;^)
Stow is a brilliant piece of software that I would hate to be without!