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)
Best Answer
First off, when using
stow
with a GNU autotoolsconfigure
script, useThat way you don't have to repeat yourself when you invoke
make
.bzip2
comes with a ready-made Makefile. It also has aREADME
file that explains exactly how to install it in a non-standard location:This means that you may use
if you wish.
R comes with a
configure
script, at least in the source distribution of version 3.4.1 which I downloaded for testing.Programs that build using CMake may be installed in a configurable location using
If GNU autotools haven't been used to create a
configure
script, and if it's not a CMake project, then do read theREADME
and/orINSTALL
file about how to install the program (you should obviously do this nonetheless). Most programs are able to install in non-default locations quite easily.If worse comes to worse, just read the Makefile.