0.0 Using A Pre-compiled Binary
Pre-compiled binaries are available for recent releases. Just download the appropriate executable for your platform and put it on your $PATH. To uninstall, simply delete the executable. To upgrade from an older release, just overwrite the older binary with the newer one.
0.1 Executive Summary
Building and installing is very simple. Three steps:
- Download and unpack a source tarball or ZIP.
- ./configure; make
- Move the resulting "fossil" or "fossil.exe" executable to someplace on your $PATH.
1.0 Obtaining The Source Code
Fossil is self-hosting, so you can obtain a ZIP archive or tarball containing a snapshot of the latest version directly from Fossil's own fossil repository. Additionally, source archives of released versions of fossil are available from the downloads page. To obtain a development version of fossil, follow these steps:
Point your web browser to https://www.fossil-scm.org/
Click on the Timeline link at the top of the page.
Select a version of of Fossil you want to download. The latest version on the trunk branch is usually a good choice. Click on its link.
Finally, click on one of the "Zip Archive" or "Tarball" links, according to your preference. These link will build a ZIP archive or a gzip-compressed tarball of the complete source code and download it to your computer.
Aside: Is it really safe to use an unreleased development version of the Fossil source code?
Yes! Any check-in on the trunk branch of the Fossil Fossil self-hosting repository will work fine. (Dodgy code is always on a branch.) In the unlikely event that you pick a version with a serious bug, it still won't clobber your files. Fossil uses several self-checks prior to committing any repository change that prevent loss-of-work due to bugs.
The Fossil self-hosting repositories, especially the one at http://www.fossil-scm.org/fossil, usually run a version of trunk that is less than a week or two old. Look at the bottom left-hand corner of this screen (to the right of "This page was generated in...") to see exactly which version of Fossil is rendering this page. It is always safe to use whatever version of the Fossil code you find running on the main Fossil website.
Unpack the ZIP or tarball you downloaded then cd into the directory created.
(Optional, Debian-compatible Linux only) Make sure you have all the necessary tools and libraries at hand by running: sudo apt install tcl-dev tk libssl-dev.
(Optional, Unix only) Run ./configure to construct a makefile.
The build system for Fossil on Unix-like systems assumes that the OpenSSL development and runtime files are available on your system, because unprotected repositories are trivial to attack otherwise. Indeed, some public Fossil repositories — including Fossil's own — today run in an HTTPS-only mode, so that you can't even do an anonymous clone from them without using the TLS features added to Fossil by OpenSSL. To weaken that stance could allow a man in the middle attack, such as one that substitutes malicious code into your Fossil repository clone.
You can force the Fossil build system to avoid searching for, building against, and linking to the OpenSSL library by passing --with-openssl=none to the configure script.
If you do not have the OpenSSL development libraries on your system, we recommend that you install them, typically via your OS's package manager. The Fossil build system goes to a lot of effort to seek these out wherever they may be found, so that is typically all you need to do.
For more advanced use cases, see the OpenSSL discussion in the "TLS and Fossil" document.
To build a statically linked binary (suitable for use inside a chroot jail) add the --static option.
To enable the native Tcl integration feature feature, add the --with-tcl=1 and --with-tcl-private-stubs=1 options.
Other configuration options can be seen by running ./configure --help
Run "make" to build the "fossil" or "fossil.exe" executable. The details depend on your platform and compiler.
Unix → the configure-generated Makefile should work on all Unix and Unix-like systems. Simply type "make".
Unix without running "configure" → if you prefer to avoid running configure, you can also use: make -f Makefile.classic. You may want to make minor edits to Makefile.classic to configure the build for your system.
MinGW 3.x (not 4.x) / MinGW-w64 → Use the MinGW makefile: "make -f win/Makefile.mingw". On a Windows box you will need either Cygwin or Msys as build environment. On Cygwin, Linux or Darwin you may want to make minor edits to win/Makefile.mingw to configure the cross-compile environment.
To enable the native Tcl integration feature, use a command line like the following (all on one line):
make -f win/Makefile.mingw FOSSIL_ENABLE_TCL=1 FOSSIL_ENABLE_TCL_STUBS=1 FOSSIL_ENABLE_TCL_PRIVATE_STUBS=1
Alternatively, ./configure may now be used to create a Makefile suitable for use with MinGW; however, options passed to configure that are not applicable on Windows may cause the configuration or compilation to fail (e.g. fusefs, internal-sqlite, etc).
HINT: Do not use MinGW-4.x, it may compile but the Fossil binary will not work correctly, see ticket.
MSVC → Use the MSVC makefile. First change to the "win/" subdirectory ("cd win") then run "nmake /f Makefile.msc".
Alternatively, the batch file "win\buildmsvc.bat" may be used and it will attempt to detect and use the latest installed version of MSVC.
To enable the optional OpenSSL support, first download the official source code for OpenSSL and extract it to an appropriately named "openssl-X.Y.ZA" subdirectory within the local compat directory (e.g. "compat/openssl-1.1.1c"), then make sure that some recent Perl binaries are installed locally, and finally run one of the following commands:
nmake /f Makefile.msc FOSSIL_ENABLE_SSL=1 FOSSIL_BUILD_SSL=1 PERLDIR=C:\full\path\to\Perl\bin
To enable the optional native Tcl integration feature, run one of the following commands or add the "FOSSIL_ENABLE_TCL=1" argument to one of the other NMAKE command lines:
buildmsvc.bat FOSSIL_ENABLE_SSL=1 FOSSIL_BUILD_SSL=1 PERLDIR=C:\full\path\to\Perl\bin
nmake /f Makefile.msc FOSSIL_ENABLE_TCL=1
Cygwin → The same as other Unix-like systems. It is recommended to configure using: "configure --disable-internal-sqlite", making sure you have the "libsqlite3-devel" , "zlib-devel" and "openssl-devel" packages installed first.
The finished binary is named "fossil" (or "fossil.exe" on Windows). Put this binary in a directory that is somewhere on your PATH environment variable. It does not matter where.
(Optional:) To uninstall, just delete the binary.
4.0 Additional Considerations
If the makefiles that come with Fossil do not work for you, or for some other reason you want to know how to build Fossil manually, then refer to the Fossil Build Process document which describes in detail what the makefiles do behind the scenes.
The fossil executable is self-contained and stand-alone and usually requires no special libraries or other software to be installed. However, the "--tk" option to the diff command requires that Tcl/Tk be installed on the local machine. You can get Tcl/Tk from ActiveState.
To build on older Macs (circa 2002, MacOS 10.2) edit the Makefile generated by configure to add the following lines:
TCC += -DSQLITE_WITHOUT_ZONEMALLOC TCC += -D_BSD_SOURCE TCC += -DWITHOUT_ICONV TCC += -Dsocketlen_t=int TCC += -DSQLITE_MAX_MMAP_SIZE=0