building and installation process for monotone
==============================================

1. prerequisites:

  * hardware prerequisites:

    - C++ compilers consume a lot of memory building monotone, due to
      monotone's liberal use of C++ features. It may be possible to
      build on a system with 128mb of memory, but not pleasant.

  * software prerequisites:

    - autoconf
    - automake
    - gettext
    - a C++ compiler and library according to the C++11 standard. We
      actively support g++ 4.6 and clang++ 3.3 or newer. Other C++11
      compilers may work, but aren't currently tested.
    - boost 1.35.0 or later: either an installed copy or an extracted
      tarball of its unbuilt sources somewhere in the file system are
      supported
    - zlib 1.1.4 or later
    - libiconv if the iconv() function is missing
    - texinfo (to build the documentation)
    - Botan 1.8.0 or later (Botan might require bzip2, OpenSSL and / or
      GnuMP in addition, depending on the package you're using.)
    - PCRE 7.4 or later
    - SQLite 3.3.8 or later
    - Lua 5.1
    - GNU IDN Library

        on Debian and Ubuntu:

           install the following packages:
             autoconf automake gettext g++ libboost1.35-dev libz-dev
             libbotan1.10-dev libsqlite3-dev libpcre3-dev liblua5.2-dev
             libidn11-dev libgmp3-dev libbz2-dev texinfo

           (monotone works with older and newer Botan versions as well, 
            so libbotan1.8-dev is also good to go.)

        on FreeBSD:

           install the following packages from the ports collection:
             databases/sqlite3 devel/automake devel/boost devel/gettext
             devel/gmake devel/pcre lang/lua security/botan110 dns/libidn

           (monotone works with older and newer Botan versions as well, 
            so security/botan is also good to go.)

        on OpenBSD:

           install the following packages using 'pkg_add':
             autoconf automake boost botan gmake libiconv libidn lua
             pcre sqlite3 

        on NetBSD:

           install the following packages:
             autoconf automake boost-headers botan gmake gcc48
             libiconv libidn lua pcre sqlite3

           and make sure to actually use gcc-4.8 with a proper CXX
           definition, for example: CXX=/usr/pkg/gcc48/bin/g++

        on Gentoo:

           emerge the following packages:
             autoconf automake boost botan gettext libpcre libidn lua
             sqlite zlib

        on Fedora:

           install the following packages:
             autoconf automake gettext boost boost-devel zlib zlib-devel
             lua lua-devel pcre pcre-devel sqlite sqlite-devel libidn
             libidn-devel gcc-c++ texinfo texinfo-tex botan botan-devel

        on RHEL or CentOS (before version 7):

            In addition to the requirements for Fedora, above, you
            will need a more recent C++ compiler. RedHat provides a
            Developer Toolset. CentOS developer Tru Huynh kindly
            offers a public repo here:
              http://people.centos.org/tru/devtools-2/devtools-2.repo

            The newer g++ compiler bundled by AdaCore are also known
            to work.
 
        on openSUSE:

            install the following extra packages with YaST or zypper:
              autoconf automake gettext-tools gcc-c++ boost-devel zlib-devel
              libbotan-devel sqlite3-devel pcre-devel lua-devel libidn-devel
              libbz2-devel texinfo make

        on Mac OS X:

           use MacPorts (http://www.macports.org) to install the
           following packages:
             autoconf automake gettext boost zlib lua pcre botan
             sqlite3 libidn libiconv texinfo

           Monotone only uses header-only libraries from boost, so if
           you don't like to spend a lot of time building boost via
           MacPorts, you can also download and extract it manually and
           let CXXFLAGS point to the include directory of the
           extracted version.

           While monotone can be compiled on 'Mountain Lion' (10.8),
           we recommend at least 'Mavericks' (10.9), because Apple
           defaults to link against stdc++ before that version. On
           'Mountain Lion', you can still compile monotone, but need
           to make sure to use libc++ rather than stdlibc++, i.e. use
           the following flags for monotone as well as botan and
           libidna:
             CXXFLAGS="-stdlib=libc++"
             LDFLAGS="-lc++"

        on Windows:

           (using MinGW): see INSTALL_windows_mingw.txt
           (using MinGW64 32 bit): see INSTALL_windows_msys2_mingw-32.txt
           (using MinGW64 64 bit): see INSTALL_windows_msys2_mingw-64.txt
           (using Cygwin): see INSTALL_windows_cygwin.txt
           (Visual Studio is not really supported, but
            INSTALL_windows_msvc.txt has some old hints)

        on other systems:

           Ensure you have a compiler supporting C++11. Check your
           system package repository; you may need to build some of
           these from source. if your package repository does not
           contain the libraries, see:

                http://gcc.gnu.org/                  for g++
                http://clang.llvm.org/               for clang++
                http://www.boost.org/                for Boost
                http://www.pcre.org/                 for PCRE
                http://www.lua.org/                  for Lua
                http://www.sqlite.org/               for SQLite
                http://botan.randombit.net/          for Botan
                http://www.gnu.org/software/libidn/  for GNU IDN

           Most are C libraries, or used as such. And should therefore
           be compatible between different compilers. Take care with
           libidn and botan, as these are C++ libraries, meaning the
           compiler used and standard library linked against all need
           to match.

1.1 using boost in the build process:

  monotone uses the boost libraries in multiple parts of its code.
  fortunately, it only uses the so-called header-only libraries: these
  can be used very easily from other projects, as there is no need to
  build them by hand prior usage.

  therefore you can use an installed version of boost if shipped with your
  distribution but, if you do not want to mess with the Boost.Build build
  system (which is hard to deal with for beginners), you can simply use an
  extracted copy of the boost sources.  the two procedures are detailed
  below:

  * if your system already has the boost development libraries installed,
    you must tell the compiler where to find them.  their location will
    usually be somewhere under /usr/include.  try the following command:

      ls -d /usr/include/boost*

    if the command shows a single directory named 'boost', you do not have
    to take any extra steps.  configure will automatically find the
    necessary files.  instead, if the command shows a directory name of the
    form boost_1_35_1, boost-1.35.1 or similar, you will have to pass that
    to the configure script.  do so as follows:

      ./configure CPPFLAGS="-I/usr/include/boost-1.35.1"

    if no directories are shown, look for prebuilt boost packages for your
    system and install them.  if there aren't any, resort to the procedure
    described in the following point.

  * if you do not have boost already installed, and you cannot easily
    install it from prebuilt packages, fetch a copy of the boost sources
    from their site (see previous section) and unpack them somewhere in
    your system -- for example, your home directory.  once done, tell the
    configure script where the files are:

      ./configure CPPFLAGS="-I${HOME}/boost-1.35.1"

  it is important to note that, once monotone is built, you can get rid of
  all the boost sources or boost development packages from your system.
  the required header-only libraries will have been built into the final
  binary, which will not rely on any binary boost library.  in some sense,
  you can think of it as static linkage.

2. configuring monotone:

  * if there is no ./configure script in your source tree you'll need
    to create one before proceeding to the next step. one of the
    following auto* commands should work:

        $ aclocal-1.9 && autoreconf --install
        $ AUTOMAKE=automake-1.9 ACLOCAL=aclocal-1.9 autoreconf --install

    If this fails early, check that you have gettext packages installed.

  * type "./configure" for a basic configuration of monotone.  several
    configuration options are available; type "configure --help" for a
    list of all of them. some special options are shown here:

     --enable-ipv6[=auto|no|yes]

       specify whether IPv6 support has to be enabled or disabled.  the
       default is to try automatic detection (auto) and use the guessed
       results.  however, you can force IPv6 detection by saying 'yes'
       or completely disable it using 'no'.

     --disable-nls

       build a version of monotone without support for local message
       catalogs. you might like to do this if you do not have a
       working installation of GNU gettext.

     --enable-pch

       this will enable precompiled headers, which should improve compile
       time. some versions of gcc have problems with this option, so
       try disabling it if you run into trouble.

3. building monotone

  * type "make" to invoke GNU make (please notice it might be named
    "gmake" on systems where system make is not GNU make).
    this should produce a mtn binary in your current directory.
    if not, please send a build log to
    monotone-devel@nongnu.org with a description of the failure.

4. testing monotone

  * there is a "make check" target which you can try, if you'd like to
    confirm monotone's functionality on your system.
    Do not run "make check" as root (Unix)!  Doing so will cause the
    failure of some of the tests!
    Also, make sure your testing process has enough memory.  Experience
    has shown that some tests may fail "mysteriously" when there is too
    little memory.  A possible hint is that 128MB was too little on
    FreeBSD 6 on x86 while 256MB was enough.

    You might also like to try fetching monotone's sources from our
    monotone server. this process will transfer the complete development
    history to your database, and you will then be free to share it with
    others or make changes and submit them to us:

        mtn clone 'mtn://code.monotone.ca/monotone?net.venge.monotone'

5. upgrading

  * if you have an existing monotone installation, you may need to
    perform some additional steps to migrate your data to the newest
    version; see the file UPGRADE for details.

