In the program GNU Stow, the symlink farm manager/package manager/whatever you want to call it, you can run the following commands to install a package to /usr/local
:
./configure --prefix=/usr/local
make
sudo make prefix=/usr/local/stow/foo-1.2 install # well not nessecarily sudo but this is personal preference
cd /usr/local/stow
sudo stow foo-1.2 # you have to have sudo here
Basically you are tricking the package so that programs link against /usr/local
, but it is actually installed in /usr/local/stow/foo-1.2
.
But what if there is no configure script? How can I trick it then? Some notable programs without configure scripts:
- bzip2 (this is the program I wrote the question for)
- R (the programming language)