Since several months, I would always like to build software from source. It began when I would install vim 8.0 but no packages for Ubuntu were available. I wrote an article about it.
I began by building from source and install it with sudo. But, I had some issues when the package was updated because there were some conflicts.
For these reasons, I decided to build from source and to install the binaries in a separated directory in my home, called $HOME/.install-compiled/. When the binaries are installed in this directory, I only need to extend my PATH with the appropriate subdirectories.
Here some example.
In Ubuntu, the version provided by packages is 2.7.4 from 2016. The current version if 2.13. All source codes I need are in a directory called $HOME/.compile. I use the following commands to build git from source and install it locally.
mkdir -p $HOME/.compile git clone https://github.com/git/git $HOME/.compile/git cd $HOME/.compile/git ./configure --prefix=$HOME/.install-compiled/git make -j 8 make install
The usual commands to build C programs are ./configure && make && make install and you can pass some arguments like –prefix=path to ./configure to change the directory where the binaries must be installed.
Even if I’m a vim user since several years, I switched to Emacs some months ago. I also want to have the latest version and I use the following commands.
mkdir -p $HOME/.compile git clone https://github.com/emacs-mirror/emacs $HOME/.compile/emacs cd $HOME/.compile/emacs ./configure --prefix=$HOME/.install-compiled/emacs make -j 8 make install
Usually you will easily find the commands to build. If configure is used, you can often use the flag –prefix (it is recommended by the GNU project to always add it when you provide a configure script). I personally recommend it to avoid conflicts and to easily remove the version you don’t want to use anymore.
Hope it can help you.