Skip to content

Commit 99e6490

Browse files
committed
doc: shuffle depends instructions
Native compilation is explained before cross-compilation. Move install and (g)make steps up. In the Configuring section, use Linux native compilation as the example instead of Windows cross-compile.
1 parent 5b8046a commit 99e6490

File tree

1 file changed

+79
-67
lines changed

1 file changed

+79
-67
lines changed

depends/README.md

Lines changed: 79 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,96 @@
1-
### Usage
1+
# Depends build
2+
3+
This is a system of building and caching dependencies necessary for building
4+
Bitcoin Core. It supports cross-compilation. For more details see [description.md](description.md),
5+
as well as [packages.md](packages.md) for how to add packages.
6+
7+
## Usage
8+
9+
### Ubuntu & Debian
10+
11+
apt install cmake curl make patch
12+
13+
Skip the following packages if you don't intend to use the GUI and will build with [`NO_QT=1`](#dependency-options):
14+
15+
apt install bison g++ ninja-build pkgconf python3 xz-utils
216

317
To build dependencies for the current arch+OS:
418

519
make
620

7-
To build for another arch/OS:
21+
### FreeBSD
822

9-
make HOST=host-platform-triplet
23+
pkg install bash
1024

11-
For example:
25+
To build dependencies for the current arch+OS:
1226

13-
make HOST=x86_64-w64-mingw32 -j4
27+
make
28+
29+
### NetBSD
30+
31+
pkgin install bash gmake
32+
33+
To build dependencies for the current arch+OS:
34+
35+
gmake
36+
37+
### OpenBSD
38+
39+
pkg_add bash gmake gtar
40+
41+
To build dependencies for the current arch+OS:
42+
43+
gmake
44+
45+
## Configuring Bitcoin Core
1446

1547
**When configuring Bitcoin Core, CMake by default will ignore the depends output.** In
1648
order for it to pick up libraries, tools, and settings from the depends build,
1749
you must specify the toolchain file.
18-
In the above example, a file named `depends/x86_64-w64-mingw32/toolchain.cmake` will be
50+
In the above example for Ubuntu, a file named `depends/x86_64-pc-linux-gnu/toolchain.cmake` will be
1951
created. To use it during configuring Bitcoin Core:
2052

21-
cmake -B build --toolchain depends/x86_64-w64-mingw32/toolchain.cmake
53+
cmake -B build --toolchain depends/x86_64-pc-linux-gnu/toolchain.cmake
54+
55+
## Dependency Options
56+
57+
The following can be set when running make: `make FOO=bar`
58+
59+
- `SOURCES_PATH`: Downloaded sources will be placed here
60+
- `BASE_CACHE`: Built packages will be placed here
61+
- `SDK_PATH`: Path where SDKs can be found (used by macOS)
62+
- `FALLBACK_DOWNLOAD_PATH`: If a source file can't be fetched, try here before giving up
63+
- `C_STANDARD`: Set the C standard version used. Defaults to `c11`.
64+
- `CXX_STANDARD`: Set the C++ standard version used. Defaults to `c++20`.
65+
- `NO_BOOST`: Don't download/build/cache Boost
66+
- `NO_LIBEVENT`: Don't download/build/cache Libevent
67+
- `NO_QT`: Don't download/build/cache Qt and its dependencies
68+
- `NO_QR`: Don't download/build/cache packages needed for enabling qrencode
69+
- `NO_ZMQ`: Don't download/build/cache packages needed for enabling ZeroMQ
70+
- `NO_WALLET`: Don't download/build/cache libs needed to enable the wallet (SQLite)
71+
- `NO_BDB`: Don't download/build/cache BerkeleyDB
72+
- `NO_USDT`: Don't download/build/cache packages needed for enabling USDT tracepoints
73+
- `MULTIPROCESS`: Build libmultiprocess (experimental)
74+
- `DEBUG`: Disable some optimizations and enable more runtime checking
75+
- `HOST_ID_SALT`: Optional salt to use when generating host package ids
76+
- `BUILD_ID_SALT`: Optional salt to use when generating build package ids
77+
- `LOG`: Use file-based logging for individual packages. During a package build its log file
78+
resides in the `depends` directory, and the log file is printed out automatically in case
79+
of build error. After successful build log files are moved along with package archives
80+
- `LTO`: Enable options needed for LTO. Does not add `-flto` related options to *FLAGS.
81+
82+
If some packages are not built, for example `make NO_WALLET=1`, the appropriate CMake cache
83+
variables will be set when generating the Bitcoin Core buildsystem. In this case, `-DENABLE_WALLET=OFF`.
84+
85+
## Cross compilation
86+
87+
To build for another arch/OS:
88+
89+
make HOST=host-platform-triplet
90+
91+
For example:
92+
93+
make HOST=x86_64-w64-mingw32 -j4
2294

2395
Common `host-platform-triplet`s for cross compilation are:
2496

@@ -37,18 +109,6 @@ Common `host-platform-triplet`s for cross compilation are:
37109

38110
The paths are automatically configured and no other options are needed.
39111

40-
### Install the required dependencies: Ubuntu & Debian
41-
42-
#### Common
43-
44-
apt install cmake curl make patch
45-
46-
#### GUI
47-
48-
Skip the following packages if you don't intend to use the GUI and will build with [`NO_QT=1`](#dependency-options):
49-
50-
apt install bison g++ ninja-build pkgconf python3 xz-utils
51-
52112
#### For macOS cross compilation
53113

54114
apt install clang lld llvm zip
@@ -88,57 +148,9 @@ For linux S390X cross compilation:
88148

89149
sudo apt-get install g++-s390x-linux-gnu binutils-s390x-linux-gnu
90150

91-
### Install the required dependencies: FreeBSD
92-
93-
pkg install bash
94-
95-
### Install the required dependencies: NetBSD
96-
97-
pkgin install bash gmake
98-
99-
### Install the required dependencies: OpenBSD
100-
101-
pkg_add bash gmake gtar
102-
103-
### Dependency Options
104-
105-
The following can be set when running make: `make FOO=bar`
106-
107-
- `SOURCES_PATH`: Downloaded sources will be placed here
108-
- `BASE_CACHE`: Built packages will be placed here
109-
- `SDK_PATH`: Path where SDKs can be found (used by macOS)
110-
- `FALLBACK_DOWNLOAD_PATH`: If a source file can't be fetched, try here before giving up
111-
- `C_STANDARD`: Set the C standard version used. Defaults to `c11`.
112-
- `CXX_STANDARD`: Set the C++ standard version used. Defaults to `c++20`.
113-
- `NO_BOOST`: Don't download/build/cache Boost
114-
- `NO_LIBEVENT`: Don't download/build/cache Libevent
115-
- `NO_QT`: Don't download/build/cache Qt and its dependencies
116-
- `NO_QR`: Don't download/build/cache packages needed for enabling qrencode
117-
- `NO_ZMQ`: Don't download/build/cache packages needed for enabling ZeroMQ
118-
- `NO_WALLET`: Don't download/build/cache libs needed to enable the wallet (SQLite)
119-
- `NO_BDB`: Don't download/build/cache BerkeleyDB
120-
- `NO_USDT`: Don't download/build/cache packages needed for enabling USDT tracepoints
121-
- `MULTIPROCESS`: Build libmultiprocess (experimental)
122-
- `DEBUG`: Disable some optimizations and enable more runtime checking
123-
- `HOST_ID_SALT`: Optional salt to use when generating host package ids
124-
- `BUILD_ID_SALT`: Optional salt to use when generating build package ids
125-
- `LOG`: Use file-based logging for individual packages. During a package build its log file
126-
resides in the `depends` directory, and the log file is printed out automatically in case
127-
of build error. After successful build log files are moved along with package archives
128-
- `LTO`: Enable options needed for LTO. Does not add `-flto` related options to *FLAGS.
129-
130-
If some packages are not built, for example `make NO_WALLET=1`, the appropriate CMake cache
131-
variables will be set when generating the Bitcoin Core buildsystem. In this case, `-DENABLE_WALLET=OFF`.
132-
133151
### Additional targets
134152

135153
download: run 'make download' to fetch all sources without building them
136154
download-osx: run 'make download-osx' to fetch all sources needed for macOS builds
137155
download-win: run 'make download-win' to fetch all sources needed for win builds
138156
download-linux: run 'make download-linux' to fetch all sources needed for linux builds
139-
140-
141-
### Other documentation
142-
143-
- [description.md](description.md): General description of the depends system
144-
- [packages.md](packages.md): Steps for adding packages

0 commit comments

Comments
 (0)