Recently, I had to build fossil from source on Ubuntu because I needed to make a change to the source code.

It required a number of dependencies which is expected to be installed.

They are –
gcc (obviously!)
zlib1g and zlib1g-dev
tcl-dev
tk
libssl
libssl-dev

Installing all of them together –

sudo apt-get install -y gcc zlib1g zlib1g-dev tcl-dev tk libssl libsssl-dev

Download source from fossil download page.

After untarring everything, navigate to the source directory and then the following commands –

$> ./configure
$> make


This creates a binary in the current directory which can then be put in usr/bin/