diff --git a/doc/build-cross.md b/doc/build-cross.md
deleted file mode 100644
index cbbff64bb2..0000000000
--- a/doc/build-cross.md
+++ /dev/null
@@ -1,122 +0,0 @@
-Cross-compiliation of Dash Core
-===============================
-
-Dash Core can be cross-compiled on Linux to all other supported host systems. This is done by changing
-the `HOST` parameter when building the dependencies and then specifying another `--prefix` directory when building Dash.
-
-The following instructions are only tested on Debian Stretch and Ubuntu Focal.
-
-macOS Cross-compilation
-------------------------
-Cross-compiling to macOS requires a few additional packages to be installed:
-
-```bash
-$ sudo apt-get install python3-setuptools libcap-dev zlib1g-dev libbz2-dev cmake
-```
-
-Additionally, the Mac OSX SDK must be downloaded and extracted manually:
-
-```bash
-$ mkdir -p depends/sdk-sources
-$ mkdir -p depends/SDKs
-$ curl https://bitcoincore.org/depends-sources/sdks/Xcode-12.1-12A7403-extracted-SDK-with-libcxx-headers.tar.gz -o depends/sdk-sources/Xcode-12.1-12A7403-extracted-SDK-with-libcxx-headers.tar.gz
-$ tar -C depends/SDKs -xf depends/sdk-sources/Xcode-12.1-12A7403-extracted-SDK-with-libcxx-headers.tar.gz
-```
-
-When building the dependencies, as described in [build-generic](build-generic.md), use
-
-```bash
-$ make HOST=x86_64-apple-darwin19 -j4
-```
-
-When building Dash Core, use
-
-```bash
-$ ./configure --prefix=`pwd`/depends/x86_64-apple-darwin19
-```
-
-Windows 64bit Cross-compilation
--------------------------------
-The steps below can be performed on Ubuntu (including in a VM) or WSL. The depends system
-will also work on other Linux distributions, however the commands for
-installing the toolchain will be different.
-
-First, install the general dependencies:
-
- sudo apt update
- sudo apt upgrade
- sudo apt install build-essential libtool autotools-dev automake pkg-config bsdmainutils curl git python3
-
-A host toolchain (`build-essential`) is necessary because some dependency
-packages need to build host utilities that are used in the build process.
-
-See [dependencies.md](dependencies.md) for a complete overview.
-
-If you want to build the windows installer with `make deploy` you need [NSIS](https://nsis.sourceforge.io/Main_Page):
-
- sudo apt install nsis
-
-Acquire the source in the usual way:
-
- git clone https://github.com/dashpay/dash.git
- cd dash
-
-### Building for 64-bit Windows
-
-The first step is to install the mingw-w64 cross-compilation tool chain:
-
- sudo apt install g++-mingw-w64-x86-64
-
-Ubuntu Focal 20.04 [1](#footnote1):
-
- sudo update-alternatives --config x86_64-w64-mingw32-g++ # Set the default mingw32 g++ compiler option to posix.
-
-Once the toolchain is installed the build steps are common:
-
-Note that for WSL the Dash Core source path MUST be somewhere in the default mount file system, for
-example /usr/src/dash, AND not under /mnt/d/. If this is not the case the dependency autoconf scripts will fail.
-This means you cannot use a directory that is located directly on the host Windows file system to perform the build.
-
-Build using:
-
- PATH=$(echo "$PATH" | sed -e 's/:\/mnt.*//g') # strip out problematic Windows %PATH% imported var
- cd depends
- make HOST=x86_64-w64-mingw32
- cd ..
- ./autogen.sh # not required when building from tarball
- CONFIG_SITE=$PWD/depends/x86_64-w64-mingw32/share/config.site ./configure --prefix=/
- make
-
-### Depends system
-
-For further documentation on the depends system see [README.md](../depends/README.md) in the depends directory.
-
-ARM-Linux Cross-compilation
--------------------
-Cross-compiling to ARM-Linux requires a few additional packages to be installed:
-
-```bash
-$ sudo apt-get install g++-arm-linux-gnueabihf
-```
-
-When building the dependencies, as described in [build-generic](build-generic.md), use
-
-```bash
-$ make HOST=arm-linux-gnueabihf -j4
-```
-
-When building Dash Core, use
-
-```bash
-$ ./configure --prefix=`pwd`/depends/arm-linux-gnueabihf
-```
-
-Footnotes
----------
-
-1: Starting from Ubuntu Xenial 16.04, both the 32 and 64 bit Mingw-w64 packages install two different
-compiler options to allow a choice between either posix or win32 threads. The default option is win32 threads which is the more
-efficient since it will result in binary code that links directly with the Windows kernel32.lib. Unfortunately, the headers
-required to support win32 threads conflict with some of the classes in the C++11 standard library, in particular std::mutex.
-It's not possible to build the Dash Core code using the win32 version of the Mingw-w64 cross compilers (at least not without
-modifying headers in the Dash Core source code).
diff --git a/doc/build-generic.md b/doc/build-generic.md
deleted file mode 100644
index 1bfb01abb2..0000000000
--- a/doc/build-generic.md
+++ /dev/null
@@ -1,82 +0,0 @@
-GENERIC BUILD NOTES
-====================
-Some notes on how to build Dash Core based on the [depends](../depends/README.md) build system.
-
-Note on old build instructions
-------------------------------
-In the past, the build documentation contained instructions on how to build Dash with system-wide installed dependencies
-like BerkeleyDB 4.8, boost and Qt. Building this way is considered deprecated and only building with the `depends` prefix
-is supported today.
-
-Required build tools and environment
-------------------------------------
-Building the dependencies and Dash Core requires some essential build tools to be installed before. Please see
-[build-unix](build-unix.md), [build-osx](build-osx.md) and [build-windows](build-windows.md) for details.
-
-Building dependencies
----------------------
-Dash inherited the `depends` folder from Bitcoin, which contains all dependencies required to build Dash. These
-dependencies must be built before Dash can actually be built. To do so, perform the following:
-
-```bash
-$ cd depends
-$ make -j4 # Choose a good -j value, depending on the number of CPU cores available
-$ cd ..
-```
-
-This will download and build all dependencies required to build Dash Core. Caching of build results will ensure that only
-the packages are rebuilt which have changed since the last depends build.
-
-It is required to re-run the above commands from time to time when dependencies have been updated or added. If this is
-not done, build failures might occur when building Dash.
-
-Please read the [depends](../depends/README.md) documentation for more details on supported hosts and configuration
-options. If no host is specified (as in the above example) when calling `make`, the depends system will default to your
-local host system.
-
-See [dependencies.md](dependencies.md) for a complete overview.
-
-Building Dash Core
----------------------
-
-```bash
-$ ./autogen.sh
-$ ./configure --prefix=`pwd`/depends/
-$ make
-$ make install # optional
-```
-
-Please replace `` with your local system's `host-platform-triplet`. The following triplets are usually valid:
-- `i686-pc-linux-gnu` for Linux32
-- `x86_64-pc-linux-gnu` for Linux64
-- `x86_64-w64-mingw32` for Win64
-- `x86_64-apple-darwin19` for macOS
-- `arm-linux-gnueabihf` for Linux ARM 32 bit
-- `aarch64-linux-gnu` for Linux ARM 64 bit
-
-If you want to cross-compile for another platform, choose the appropriate `` and make sure to build the
-dependencies with the same host before.
-
-If you want to build for the same host but different distro, add `--enable-glibc-back-compat LDFLAGS=-static-libstdc++` when calling `./configure`.
-
-
-ccache
-------
-`./configure` of Dash Core will autodetect the presence of ccache and enable use of it. To disable ccache, use
-`./configure --prefix= --disable-ccache`. When installed and enabled, [ccache](https://ccache.samba.org/) will
-cache build results on source->object level.
-
-The default maximum cache size is 5G, which might not be enough to cache multiple builds when switching Git branches
-very often. It is advised to increase the maximum cache size:
-
-```bash
-$ ccache -M20G
-```
-
-Additional Configure Flags
---------------------------
-A list of additional configure flags can be displayed with:
-
-```bash
-./configure --help
-```
diff --git a/doc/build-netbsd.md b/doc/build-netbsd.md
index 3fc9f6d19b..c2a35819d0 100644
--- a/doc/build-netbsd.md
+++ b/doc/build-netbsd.md
@@ -19,6 +19,7 @@ automake
boost
git
gmake
+gmp
libevent
libtool
pkg-config
diff --git a/doc/build-openbsd.md b/doc/build-openbsd.md
index ddb4f85ace..48dd5d395e 100644
--- a/doc/build-openbsd.md
+++ b/doc/build-openbsd.md
@@ -16,6 +16,7 @@ pkg_add gmake libtool libevent
pkg_add autoconf # (select highest version, e.g. 2.69)
pkg_add automake # (select highest version, e.g. 1.15)
pkg_add python # (select highest version, e.g. 3.5)
+pkg_add gmp
```
See [dependencies.md](dependencies.md) for a complete overview.
diff --git a/doc/build-osx.md b/doc/build-osx.md
index b0309e187f..4489193c5a 100644
--- a/doc/build-osx.md
+++ b/doc/build-osx.md
@@ -17,12 +17,12 @@ When the popup appears, click `Install`.
Then install [Homebrew](https://brew.sh).
-## Base build dependencies
-
+## Dependencies
```shell
-brew install automake libtool pkg-config libnatpmp sqlite
+brew install automake berkeley-db4 libtool boost gmp miniupnpc pkg-config python qt libevent libnatpmp qrencode sqlite
```
+If you run into issues, check [Homebrew's troubleshooting page](https://docs.brew.sh/Troubleshooting).
See [dependencies.md](dependencies.md) for a complete overview.
If you want to build the disk image with `make deploy` (.dmg / optional), you need RSVG:
@@ -30,16 +30,36 @@ If you want to build the disk image with `make deploy` (.dmg / optional), you ne
brew install librsvg
```
-If you run into issues, check [Homebrew's troubleshooting page](https://docs.brew.sh/Troubleshooting).
+**Note**: You only need Berkeley DB if the wallet is enabled (see [*Disable-wallet mode*](/doc/build-osx.md#disable-wallet-mode)).
-## Building
+## Build Dash Core
-It's possible that your `PATH` environment variable contains some problematic strings, run
-```shell
-export PATH=$(echo "$PATH" | sed -e '/\\/!s/ /\\ /g') # fix whitespaces
-```
+1. Clone the Dash Core source code:
+ ```shell
+ git clone https://github.com/dashpay/dash
+ cd dash
+ ```
-Next, follow the instructions in [build-generic](build-generic.md)
+2. Build Dash Core:
+
+ Configure and build the headless Dash Core binaries as well as the GUI (if Qt is found).
+
+ You can disable the GUI build by passing `--without-gui` to configure.
+ ```shell
+ ./autogen.sh
+ ./configure
+ make
+ ```
+
+3. It is recommended to build and run the unit tests:
+ ```shell
+ make check
+ ```
+
+4. You can also create a `.dmg` that contains the `.app` bundle (optional):
+ ```shell
+ make deploy
+ ```
## `disable-wallet` mode
When the intention is to run only a P2P node without a wallet, Dash Core may be
@@ -65,8 +85,7 @@ touch "/Users/${USER}/Library/Application Support/DashCore/dash.conf"
chmod 600 "/Users/${USER}/Library/Application Support/DashCore/dash.conf"
```
-The first time you run dashd, it will start downloading the blockchain. This process could
-take many hours, or even days on slower than average systems.
+The first time you run dashd, it will start downloading the blockchain. This process could take many hours, or even days on slower than average systems.
You can monitor the download process by looking at the debug.log file:
```shell
@@ -76,7 +95,13 @@ tail -f $HOME/Library/Application\ Support/DashCore/debug.log
## Other commands:
```shell
-./src/dashd -daemon # Starts the dash daemon.
-./src/dash-cli --help # Outputs a list of command-line options.
-./src/dash-cli help # Outputs a list of RPC commands when the daemon is running.
+./src/dashd -daemon # Starts the dash daemon.
+./src/dash-cli --help # Outputs a list of command-line options.
+./src/dash-cli help # Outputs a list of RPC commands when the daemon is running.
```
+
+## Notes
+
+* Tested on OS X 10.12 Sierra through macOS 10.15 Catalina on 64-bit Intel
+processors only.
+* Building with downloaded Qt binaries is not officially supported. See the notes in [#7714](https://github.com/bitcoin/bitcoin/issues/7714).
diff --git a/doc/build-unix.md b/doc/build-unix.md
index 7c890f40c0..1f2d719342 100644
--- a/doc/build-unix.md
+++ b/doc/build-unix.md
@@ -2,49 +2,237 @@ UNIX BUILD NOTES
====================
Some notes on how to build Dash Core in Unix.
-(For BSD specific instructions, see [build-openbsd.md](build-openbsd.md) and/or
-[build-netbsd.md](build-netbsd.md))
+(for OpenBSD specific instructions, see [build-openbsd.md](build-openbsd.md))
-Base build dependencies
------------------------
-Building the dependencies and Dash Core requires some essential build tools and libraries to be installed before.
+Note
+---------------------
+Always use absolute paths to configure and compile Dash Core and the dependencies.
+For example, when specifying the path of the dependency:
-Run the following commands to install required packages:
+ ../dist/configure --enable-cxx --disable-shared --with-pic --prefix=$BDB_PREFIX
+
+Here BDB_PREFIX must be an absolute path - it is defined using $(pwd) which ensures
+the usage of the absolute path.
+
+To Build
+---------------------
-##### Debian/Ubuntu:
```bash
-$ sudo apt-get install curl build-essential libtool autotools-dev automake pkg-config python3 bsdmainutils bison libsqlite3-dev
+./autogen.sh
+./configure
+make
+make install # optional
```
-##### Fedora:
-```bash
-$ sudo dnf install gcc-c++ libtool make autoconf automake python3 libstdc++-static patch sqlite-devel zeromq-devel
-```
+This will build dash-qt as well, if the dependencies are met.
-##### Arch Linux:
-```bash
-$ pacman -S base-devel python3
-```
+Dependencies
+---------------------
-##### Alpine Linux:
-```sh
-$ sudo apk --update --no-cache add autoconf automake curl g++ gcc libexecinfo-dev libexecinfo-static libtool make perl pkgconfig python3 patch linux-headers
-```
+These dependencies are required:
-##### FreeBSD/OpenBSD:
-```bash
-pkg_add gmake libtool
-pkg_add autoconf # (select highest version, e.g. 2.69)
-pkg_add automake # (select highest version, e.g. 1.15)
-pkg_add python # (select highest version, e.g. 3.5)
-```
+ Library | Purpose | Description
+ ------------|------------------|----------------------
+ libboost | Utility | Library for threading, data structures, etc
+ libevent | Networking | OS independent asynchronous networking
+
+Optional dependencies:
+
+ Library | Purpose | Description
+ ------------|------------------|----------------------
+ gmp | Optimized math routines | Arbitrary precision arithmetic library
+ miniupnpc | UPnP Support | Firewall-jumping support
+ libnatpmp | NAT-PMP Support | Firewall-jumping support
+ libdb4.8 | Berkeley DB | Wallet storage (only needed when wallet enabled)
+ qt | GUI | GUI toolkit (only needed when GUI enabled)
+ libqrencode | QR codes in GUI | Optional for generating QR codes (only needed when GUI enabled)
+ univalue | Utility | JSON parsing and encoding (bundled version will be used unless --with-system-univalue passed to configure)
+ libzmq3 | ZMQ notification | Optional, allows generating ZMQ notifications (requires ZMQ version >= 4.0.0)
+ sqlite3 | SQLite DB | Wallet storage (only needed when wallet enabled)
For the versions used, see [dependencies.md](dependencies.md)
-Building
---------
+Memory Requirements
+--------------------
+
+C++ compilers are memory-hungry. It is recommended to have at least 1.5 GB of
+memory available when compiling Dash Core. On systems with less, gcc can be
+tuned to conserve memory with additional CXXFLAGS:
+
+
+ ./configure CXXFLAGS="--param ggc-min-expand=1 --param ggc-min-heapsize=32768"
+
+Dependency Build Instructions: Ubuntu & Debian
+----------------------------------------------
+Build requirements:
+
+ sudo apt-get install build-essential libtool autotools-dev automake pkg-config libevent-dev bsdmainutils bison python3
+
+Options when installing required Boost library files:
+
+1. On at least Ubuntu 14.04+ and Debian 7+ there are generic names for the
+individual boost development packages, so the following can be used to only
+install necessary parts of boost:
+
+ sudo apt-get install libboost-system-dev libboost-filesystem-dev libboost-test-dev libboost-thread-dev
+
+2. If that doesn't work, you can install all boost development packages with:
+
+ sudo apt-get install libboost-all-dev
+
+BerkeleyDB is required for the wallet.
+
+**For Ubuntu only:** db4.8 packages are available [here](https://launchpad.net/~bitcoin/+archive/bitcoin).
+You can add the repository and install using the following commands:
+
+ sudo apt-get install software-properties-common
+ sudo add-apt-repository ppa:bitcoin/bitcoin
+ sudo apt-get update
+ sudo apt-get install libdb4.8-dev libdb4.8++-dev
+
+Ubuntu and Debian have their own `libdb-dev` and `libdb++-dev` packages, but these will install
+BerkeleyDB 5.1 or later. This will break binary wallet compatibility with the distributed executables, which
+are based on BerkeleyDB 4.8. If you do not care about wallet compatibility,
+pass `--with-incompatible-bdb` to configure.
+
+SQLite is required for the wallet:
+
+ sudo apt install libsqlite3-dev
+
+To build Dash Core without wallet, see [*Disable-wallet mode*](/doc/build-unix.md#disable-wallet-mode)
+
+Optional port mapping libraries (see: `--with-miniupnpc`, `--enable-upnp-default`, and `--with-natpmp`, `--enable-natpmp-default`):
+
+ sudo apt install libminiupnpc-dev libnatpmp-dev
+
+ZMQ dependencies (provides ZMQ API):
+
+ sudo apt-get install libzmq3-dev
+
+GMP dependencies (provides platform-optimized routines):
+
+ sudo apt-get install libgmp-dev
+
+Dependencies for the GUI: Ubuntu & Debian
+-----------------------------------------
+
+If you want to build dash-qt, make sure that the required packages for Qt development
+are installed. Qt 5 is necessary to build the GUI.
+To build without GUI pass `--without-gui`.
+
+To build with Qt 5 you need the following:
+
+ sudo apt-get install libqt5gui5 libqt5core5a libqt5dbus5 qttools5-dev qttools5-dev-tools
+
+libqrencode (optional) can be installed with:
+
+ sudo apt-get install libqrencode-dev
+
+Once these are installed, they will be found by configure and a dash-qt executable will be
+built by default.
+
+
+Dependency Build Instructions: Fedora
+-------------------------------------
+Build requirements:
+
+ sudo dnf install gcc-c++ libtool make autoconf automake libevent-devel boost-devel libdb4-devel libdb4-cxx-devel python3
+
+Optional port mapping libraries (see: `--with-miniupnpc`, `--enable-upnp-default`, and `--with-natpmp`, `--enable-natpmp-default`):
+
+ sudo dnf install miniupnpc-devel libnatpmp-devel
+
+ZMQ dependencies (provides ZMQ API):
+
+ sudo dnf install zeromq-devel
+
+GMP dependencies (provides platform-optimized routines):
+
+ sudo dnf install gmp-devel
+
+GUI dependencies:
+
+If you want to build dash-qt, make sure that the required packages for Qt development
+are installed. Qt 5 is necessary to build the GUI.
+To build without GUI pass `--without-gui`.
+
+To build with Qt 5 you need the following:
+
+ sudo dnf install qt5-qttools-devel qt5-qtbase-devel
+
+libqrencode (optional) can be installed with:
+
+ sudo dnf install qrencode-devel
+
+SQLite can be installed with:
+
+ sudo dnf install sqlite-devel
+
+Notes
+-----
+The release is built with GCC and then "strip dashd" to strip the debug
+symbols, which reduces the executable size by about 90%.
+
+
+miniupnpc
+---------
+
+[miniupnpc](https://miniupnp.tuxfamily.org) may be used for UPnP port mapping. It can be downloaded from [here](
+https://miniupnp.tuxfamily.org/files/). UPnP support is compiled in and
+turned off by default. See the configure options for upnp behavior desired:
+
+ --without-miniupnpc No UPnP support miniupnp not required
+ --disable-upnp-default (the default) UPnP support turned off by default at runtime
+ --enable-upnp-default UPnP support turned on by default at runtime
+
+libnatpmp
+---------
+
+[libnatpmp](https://miniupnp.tuxfamily.org/libnatpmp.html) may be used for NAT-PMP port mapping. It can be downloaded
+from [here](https://miniupnp.tuxfamily.org/files/). NAT-PMP support is compiled in and
+turned off by default. See the configure options for NAT-PMP behavior desired:
+
+ --without-natpmp No NAT-PMP support, libnatpmp not required
+ --disable-natpmp-default (the default) NAT-PMP support turned off by default at runtime
+ --enable-natpmp-default NAT-PMP support turned on by default at runtime
+
+Berkeley DB
+-----------
+It is recommended to use Berkeley DB 4.8. If you have to build it yourself:
+
+```bash
+DASH_ROOT=$(pwd)
+
+# Pick some path to install BDB to, here we create a directory within the dash directory
+BDB_PREFIX="${DASH_ROOT}/db4"
+mkdir -p $BDB_PREFIX
+
+# Fetch the source and verify that it is not tampered with
+wget 'http://download.oracle.com/berkeley-db/db-4.8.30.NC.tar.gz'
+echo '12edc0df75bf9abd7f82f821795bcee50f42cb2e5f76a6a281b85732798364ef db-4.8.30.NC.tar.gz' | sha256sum -c
+# -> db-4.8.30.NC.tar.gz: OK
+tar -xzvf db-4.8.30.NC.tar.gz
+
+# Build the library and install to our prefix
+cd db-4.8.30.NC/build_unix/
+# Note: Do a static build so that it can be embedded into the executable, instead of having to find a .so at runtime
+../dist/configure --enable-cxx --disable-shared --with-pic --prefix=$BDB_PREFIX
+make install
+
+# Configure Dash Core to use our own-built instance of BDB
+cd $DASH_ROOT
+./autogen.sh
+./configure LDFLAGS="-L${BDB_PREFIX}/lib/" CPPFLAGS="-I${BDB_PREFIX}/include/" # (other args...)
+```
+
+Boost
+-----
+If you need to build Boost yourself:
+
+ sudo su
+ ./bootstrap.sh
+ ./bjam install
-Follow the instructions in [build-generic](build-generic.md)
Security
--------
@@ -54,8 +242,8 @@ This can be disabled with:
Hardening Flags:
- ./configure --prefix= --enable-hardening
- ./configure --prefix= --disable-hardening
+ ./configure --enable-hardening
+ ./configure --disable-hardening
Hardening enables the following features:
@@ -97,7 +285,7 @@ Disable-wallet mode
When the intention is to run only a P2P node without a wallet, Dash Core may be compiled in
disable-wallet mode with:
- ./configure --prefix= --disable-wallet
+ ./configure --disable-wallet
In this case there is no dependency on Berkeley DB 4.8 and SQLite.
@@ -109,55 +297,77 @@ A list of additional configure flags can be displayed with:
./configure --help
+
+Setup and Build Example: Arch Linux
+-----------------------------------
+This example lists the steps necessary to setup and build a command line only, non-wallet distribution of the latest changes on Arch Linux:
+
+ pacman -S git base-devel boost libevent python
+ git clone https://github.com/dashpay/dash.git
+ cd dash/
+ ./autogen.sh
+ ./configure --disable-wallet --without-gui --without-miniupnpc
+ make check
+
+Note:
+Enabling wallet support requires either compiling against a Berkeley DB newer than 4.8 (package `db`) using `--with-incompatible-bdb`,
+or building and depending on a local version of Berkeley DB 4.8. The readily available Arch Linux packages are currently built using
+`--with-incompatible-bdb` according to the [PKGBUILD](https://projects.archlinux.org/svntogit/community.git/tree/bitcoin/trunk/PKGBUILD).
+As mentioned above, when maintaining portability of the wallet between the standard Dash Core distributions and independently built
+node software is desired, Berkeley DB 4.8 must be used.
+
+
+ARM Cross-compilation
+-------------------
+These steps can be performed on, for example, an Ubuntu VM. The depends system
+will also work on other Linux distributions, however the commands for
+installing the toolchain will be different.
+
+Make sure you install the build requirements mentioned above.
+Then, install the toolchain and curl:
+
+ sudo apt-get install g++-arm-linux-gnueabihf curl
+
+To build executables for ARM:
+
+ cd depends
+ make HOST=arm-linux-gnueabihf NO_QT=1
+ cd ..
+ ./configure --prefix=$PWD/depends/arm-linux-gnueabihf --enable-glibc-back-compat --enable-reduce-exports LDFLAGS=-static-libstdc++
+ make
+
+
+For further documentation on the depends system see [README.md](../depends/README.md) in the depends directory.
+
Building on FreeBSD
--------------------
-(TODO, this is untested, please report if it works and if changes to this documentation are needed)
+(Updated as of FreeBSD 11.0)
-Building on FreeBSD is basically the same as on Linux based systems, with the difference that you have to use `gmake`
-instead of `make`.
+Clang is installed by default as `cc` compiler, this makes it easier to get
+started than on [OpenBSD](build-openbsd.md). Installing dependencies:
+
+ pkg install autoconf automake libtool pkgconf
+ pkg install boost-libs libevent
+ pkg install gmake
+
+You need to use GNU make (`gmake`) instead of `make`.
+
+For the wallet (optional):
+
+ pkg install db5
+
+This will give a warning "configure: WARNING: Found Berkeley DB other
+than 4.8; wallets opened by this build will not be portable!", but as FreeBSD never
+had a binary release, this may not matter. If backwards compatibility
+with 4.8-built Dash Core is needed follow the steps under "Berkeley DB" above.
+
+Then build using:
+
+ ./autogen.sh
+ ./configure --with-incompatible-bdb BDB_CFLAGS="-I/usr/local/include/db5" BDB_LIBS="-L/usr/local/lib -ldb_cxx-5"
+ gmake
*Note on debugging*: The version of `gdb` installed by default is [ancient and considered harmful](https://wiki.freebsd.org/GdbRetirement).
It is not suitable for debugging a multi-threaded C++ program, not even for getting backtraces. Please install the package `gdb` and
-use the versioned gdb command e.g. `gdb7111`.
-
-Building on OpenBSD
--------------------
-
-(TODO, this is untested, please report if it works and if changes to this documentation are needed)
-
-**Important**: From OpenBSD 6.2 onwards a C++11-supporting clang compiler is
-part of the base image, and while building it is necessary to make sure that this
-compiler is used and not ancient g++ 4.2.1. This is done by appending
-`CC=cc CXX=c++` to configuration commands. Mixing different compilers
-within the same executable will result in linker errors.
-
-```bash
-$ cd depends
-$ make CC=cc CXX=c++
-$ cd ..
-$ export AUTOCONF_VERSION=2.69 # replace this with the autoconf version that you installed
-$ export AUTOMAKE_VERSION=1.15 # replace this with the automake version that you installed
-$ ./autogen.sh
-$ ./configure --prefix= CC=cc CXX=c++
-$ gmake # use -jX here for parallelism
-```
-
-OpenBSD Resource limits
--------------------
-If the build runs into out-of-memory errors, the instructions in this section
-might help.
-
-The standard ulimit restrictions in OpenBSD are very strict:
-
- data(kbytes) 1572864
-
-This is, unfortunately, in some cases not enough to compile some `.cpp` files in the project,
-(see issue [#6658](https://github.com/bitcoin/bitcoin/issues/6658)).
-If your user is in the `staff` group the limit can be raised with:
-
- ulimit -d 3000000
-
-The change will only affect the current shell and processes spawned by it. To
-make the change system-wide, change `datasize-cur` and `datasize-max` in
-`/etc/login.conf`, and reboot.
+use the versioned gdb command e.g. `gdb7111`.
\ No newline at end of file
diff --git a/doc/build-windows.md b/doc/build-windows.md
index 8213ac3726..3125eb0de4 100644
--- a/doc/build-windows.md
+++ b/doc/build-windows.md
@@ -51,7 +51,51 @@ recommended, but it is possible to compile the 32-bit version.
Cross-compilation
-------------------
-Follow the instructions for Windows in [build-cross](build-cross.md)
+These steps can be performed on, for example, an Ubuntu VM. The depends system
+will also work on other Linux distributions, however the commands for
+installing the toolchain will be different.
+
+First, install the general dependencies:
+
+ sudo apt-get install build-essential libtool autotools-dev automake pkg-config bsdmainutils bison curl
+
+A host toolchain (`build-essential`) is necessary because some dependency
+packages (such as `protobuf`) need to build host utilities that are used in the
+build process.
+
+## Building for 64-bit Windows
+
+To build executables for Windows 64-bit, install the following dependencies:
+
+ sudo apt-get install g++-mingw-w64-x86-64 mingw-w64-x86-64-dev
+
+Then build using:
+
+ cd depends
+ make HOST=x86_64-w64-mingw32
+ cd ..
+ ./autogen.sh # not required when building from tarball
+ CONFIG_SITE=$PWD/depends/x86_64-w64-mingw32/share/config.site ./configure --prefix=/
+ make
+
+## Building for 32-bit Windows
+
+To build executables for Windows 32-bit, install the following dependencies:
+
+ sudo apt-get install g++-mingw-w64-i686 mingw-w64-i686-dev
+
+Then build using:
+
+ cd depends
+ make HOST=i686-w64-mingw32
+ cd ..
+ ./autogen.sh # not required when building from tarball
+ CONFIG_SITE=$PWD/depends/i686-w64-mingw32/share/config.site ./configure --prefix=/
+ make
+
+## Depends system
+
+For further documentation on the depends system see [README.md](../depends/README.md) in the depends directory.
Installation
-------------