Skip to content

Commit 16e8ea3

Browse files
committed
Merge pull request #6045
cc3db87 doc: Documentation in Markdown for Depends Dir (Shawn Wilkinson)
2 parents b4c219b + cc3db87 commit 16e8ea3

File tree

4 files changed

+137
-100
lines changed

4 files changed

+137
-100
lines changed

depends/README.md

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
### Usage
2+
3+
To build dependencies for the current arch+OS:
4+
5+
make
6+
7+
To build for another arch/OS:
8+
9+
make HOST=host-platform-triplet
10+
11+
For example:
12+
13+
make HOST=x86_64-w64-mingw32 -j4
14+
15+
A prefix will be generated that's suitable for plugging into Bitcoin's
16+
configure. In the above example, a dir named i686-w64-mingw32 will be
17+
created. To use it for Bitcoin:
18+
19+
./configure --prefix=`pwd`/depends/x86_64-w64-mingw32
20+
21+
Common `host-platform-triplets` for cross compilation are:
22+
23+
- `i686-w64-mingw32` for Win32
24+
- `x86_64-w64-mingw32` for Win64
25+
- `x86_64-apple-darwin11` for MacOSX
26+
- `arm-linux-gnueabihf` for Linux ARM
27+
28+
No other options are needed, the paths are automatically configured.
29+
30+
Dependency Options:
31+
The following can be set when running make: make FOO=bar
32+
33+
SOURCES_PATH: downloaded sources will be placed here
34+
BASE_CACHE: built packages will be placed here
35+
SDK_PATH: Path where sdk's can be found (used by OSX)
36+
FALLBACK_DOWNLOAD_PATH: If a source file can't be fetched, try here before giving up
37+
NO_QT: Don't download/build/cache qt and its dependencies
38+
NO_WALLET: Don't download/build/cache libs needed to enable the wallet
39+
NO_UPNP: Don't download/build/cache packages needed for enabling upnp
40+
DEBUG: disable some optimizations and enable more runtime checking
41+
42+
If some packages are not built, for example `make NO_WALLET=1`, the appropriate
43+
options will be passed to bitcoin's configure. In this case, `--disable-wallet`.
44+
45+
Additional targets:
46+
47+
download: run 'make download' to fetch all sources without building them
48+
download-osx: run 'make download-osx' to fetch all sources needed for osx builds
49+
download-win: run 'make download-win' to fetch all sources needed for win builds
50+
download-linux: run 'make download-linux' to fetch all sources needed for linux builds
51+
52+
### Other documentation
53+
54+
- [description.md](description.md): General description of the depends system
55+
- [packages.md](packages.md): Steps for adding packages
56+

depends/README.usage

Lines changed: 0 additions & 34 deletions
This file was deleted.

depends/README renamed to depends/description.md

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,26 @@
1-
This is a system of building and caching dependencies necessary for building
2-
Bitcoin.
3-
1+
This is a system of building and caching dependencies necessary for building Bitcoin.
42
There are several features that make it different from most similar systems:
53

6-
- It is designed to be builder and host agnostic
4+
### It is designed to be builder and host agnostic
75

86
In theory, binaries for any target OS/architecture can be created, from a
97
builder running any OS/architecture. In practice, build-side tools must be
108
specified when the defaults don't fit, and packages must be amended to work
119
on new hosts. For now, a build architecture of x86_64 is assumed, either on
1210
Linux or OSX.
1311

14-
- No reliance on timestamps
12+
### No reliance on timestamps
1513

1614
File presence is used to determine what needs to be built. This makes the
1715
results distributable and easily digestable by automated builders.
1816

19-
- Each build only has its specified dependencies available at build-time.
17+
### Each build only has its specified dependencies available at build-time.
2018

2119
For each build, the sysroot is wiped and the (recursive) dependencies are
2220
installed. This makes each build deterministic, since there will never be any
2321
unknown files available to cause side-effects.
2422

25-
- Each package is cached and only rebuilt as needed.
23+
### Each package is cached and only rebuilt as needed.
2624

2725
Before building, a unique build-id is generated for each package. This id
2826
consists of a hash of all files used to build the package (Makefiles, packages,
@@ -32,7 +30,7 @@ any other package that depends on it. If any of the main makefiles (Makefile,
3230
funcs.mk, etc) are changed, all packages will be rebuilt. After building, the
3331
results are cached into a tarball that can be re-used and distributed.
3432

35-
- Package build results are (relatively) deterministic.
33+
### Package build results are (relatively) deterministic.
3634

3735
Each package is configured and patched so that it will yield the same
3836
build-results with each consequent build, within a reasonable set of
@@ -41,13 +39,13 @@ beyond the scope of this system. Additionally, the toolchain itself must be
4139
capable of deterministic results. When revisions are properly bumped, a cached
4240
build should represent an exact single payload.
4341

44-
- Sources are fetched and verified automatically
42+
### Sources are fetched and verified automatically
4543

4644
Each package must define its source location and checksum. The build will fail
4745
if the fetched source does not match. Sources may be pre-seeded and/or cached
4846
as desired.
4947

50-
- Self-cleaning
48+
### Self-cleaning
5149

5250
Build and staging dirs are wiped after use, and any previous version of a
5351
cached result is removed following a successful build. Automated builders

depends/README.packages renamed to depends/packages.md

Lines changed: 73 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -4,121 +4,137 @@ variables, and defining build commands.
44
The package "mylib" will be used here as an example
55

66
General tips:
7-
mylib_foo is written as $(package)_foo in order to make recipes more similar.
7+
- mylib_foo is written as $(package)_foo in order to make recipes more similar.
88

9-
Identifiers:
9+
## Identifiers
1010
Each package is required to define at least these variables:
11-
$(package)_version:
11+
12+
$(package)_version:
1213
Version of the upstream library or program. If there is no version, a
1314
placeholder such as 1.0 can be used.
14-
$(package)_download_path:
15+
16+
$(package)_download_path:
1517
Location of the upstream source, without the file-name. Usually http or
1618
ftp.
17-
$(package)_file_name:
19+
20+
$(package)_file_name:
1821
The upstream source filename available at the download path.
19-
$(package)_sha256_hash:
22+
23+
$(package)_sha256_hash:
2024
The sha256 hash of the upstream file
2125

2226
These variables are optional:
23-
$(package)_build_subdir:
27+
28+
$(package)_build_subdir:
2429
cd to this dir before running configure/build/stage commands.
25-
$(package)_download_file:
30+
31+
$(package)_download_file:
2632
The file-name of the upstream source if it differs from how it should be
2733
stored locally. This can be used to avoid storing file-names with strange
2834
characters.
29-
$(package)_dependencies:
35+
36+
$(package)_dependencies:
3037
Names of any other packages that this one depends on.
31-
$(package)_patches:
38+
39+
$(package)_patches:
3240
Filenames of any patches needed to build the package
33-
$(package)_extra_sources:
41+
42+
$(package)_extra_sources:
3443
Any extra files that will be fetched via $(package)_fetch_cmds. These are
3544
specified so that they can be fetched and verified via 'make download'.
3645

37-
Build Variables:
46+
47+
## Build Variables:
3848
After defining the main identifiers, build variables may be added or customized
3949
before running the build commands. They should be added to a function called
4050
$(package)_set_vars. For example:
4151

42-
define $(package)_set_vars
43-
...
44-
endef
52+
define $(package)_set_vars
53+
...
54+
endef
4555

4656
Most variables can be prefixed with the host, architecture, or both, to make
4757
the modifications specific to that case. For example:
4858

49-
Universal: $(package)_cc=gcc
50-
Linux only: $(package)_linux_cc=gcc
51-
x86_64 only: $(package)_x86_64_cc = gcc
52-
x86_64 linux only: $(package)_x86_64_linux_cc = gcc
59+
Universal: $(package)_cc=gcc
60+
Linux only: $(package)_linux_cc=gcc
61+
x86_64 only: $(package)_x86_64_cc = gcc
62+
x86_64 linux only: $(package)_x86_64_linux_cc = gcc
5363

5464
These variables may be set to override or append their default values.
55-
$(package)_cc
56-
$(package)_cxx
57-
$(package)_objc
58-
$(package)_objcxx
59-
$(package)_ar
60-
$(package)_ranlib
61-
$(package)_libtool
62-
$(package)_nm
63-
$(package)_cflags
64-
$(package)_cxxflags
65-
$(package)_ldflags
66-
$(package)_cppflags
67-
$(package)_config_env
68-
$(package)_build_env
69-
$(package)_stage_env
70-
$(package)_build_opts
71-
$(package)_config_opts
65+
66+
$(package)_cc
67+
$(package)_cxx
68+
$(package)_objc
69+
$(package)_objcxx
70+
$(package)_ar
71+
$(package)_ranlib
72+
$(package)_libtool
73+
$(package)_nm
74+
$(package)_cflags
75+
$(package)_cxxflags
76+
$(package)_ldflags
77+
$(package)_cppflags
78+
$(package)_config_env
79+
$(package)_build_env
80+
$(package)_stage_env
81+
$(package)_build_opts
82+
$(package)_config_opts
7283

7384
The *_env variables are used to add environment variables to the respective
7485
commands.
7586

7687
Many variables respect a debug/release suffix as well, in order to use them for
7788
only the appropriate build config. For example:
78-
$(package)_cflags_release = -O3
79-
$(package)_cflags_i686_debug = -g
80-
$(package)_config_opts_release = --disable-debug
89+
90+
$(package)_cflags_release = -O3
91+
$(package)_cflags_i686_debug = -g
92+
$(package)_config_opts_release = --disable-debug
8193

8294
These will be used in addition to the options that do not specify
8395
debug/release. All builds are considered to be release unless DEBUG=1 is set by
84-
the user.
85-
86-
Other variables may be defined as needed.
96+
the user. Other variables may be defined as needed.
8797

88-
Build commands:
98+
## Build commands:
8999

90100
For each build, a unique build dir and staging dir are created. For example,
91-
work/build/mylib/1.0-1adac830f6e and work/staging/mylib/1.0-1adac830f6e.
101+
`work/build/mylib/1.0-1adac830f6e` and `work/staging/mylib/1.0-1adac830f6e`.
92102

93103
The following build commands are available for each recipe:
94104

95-
$(package)_fetch_cmds:
105+
$(package)_fetch_cmds:
96106
Runs from: build dir
97107
Fetch the source file. If undefined, it will be fetched and verified
98108
against its hash.
99-
$(package)_extract_cmds:
109+
110+
$(package)_extract_cmds:
100111
Runs from: build dir
101112
Verify the source file against its hash and extract it. If undefined, the
102113
source is assumed to be a tarball.
103-
$(package)_preprocess_cmds:
114+
115+
$(package)_preprocess_cmds:
104116
Runs from: build dir/$(package)_build_subdir
105117
Preprocess the source as necessary. If undefined, does nothing.
106-
$(package)_config_cmds:
118+
119+
$(package)_config_cmds:
107120
Runs from: build dir/$(package)_build_subdir
108121
Configure the source. If undefined, does nothing.
109-
$(package)_build_cmds:
122+
123+
$(package)_build_cmds:
110124
Runs from: build dir/$(package)_build_subdir
111125
Build the source. If undefined, does nothing.
112-
$(package)_stage_cmds:
126+
127+
$(package)_stage_cmds:
113128
Runs from: build dir/$(package)_build_subdir
114129
Stage the build results. If undefined, does nothing.
115130

116131
The following variables are available for each recipe:
117-
$(1)_staging_dir: package's destination sysroot path
118-
$(1)_staging_prefix_dir: prefix path inside of the package's staging dir
119-
$(1)_extract_dir: path to the package's extracted sources
120-
$(1)_build_dir: path where configure/build/stage commands will be run
121-
$(1)_patch_dir: path where the package's patches (if any) are found
132+
133+
$(1)_staging_dir: package's destination sysroot path
134+
$(1)_staging_prefix_dir: prefix path inside of the package's staging dir
135+
$(1)_extract_dir: path to the package's extracted sources
136+
$(1)_build_dir: path where configure/build/stage commands will be run
137+
$(1)_patch_dir: path where the package's patches (if any) are found
122138

123139
Notes on build commands:
124140

@@ -127,4 +143,5 @@ configure step to (usually) correctly configure automatically. Any
127143
$($(package)_config_opts) will be appended.
128144

129145
Most autotools projects can be properly staged using:
130-
$(MAKE) DESTDIR=$($(package)_staging_dir) install
146+
147+
$(MAKE) DESTDIR=$($(package)_staging_dir) install

0 commit comments

Comments
 (0)